]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/sigqueue.3
fuse.4: ffix
[thirdparty/man-pages.git] / man3 / sigqueue.3
CommitLineData
c11b1abf 1.\" Copyright (c) 2002 Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
c13182ef 12.\"
fea681da
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
10d76543
MK
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
c13182ef 20.\"
fea681da
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
fea681da 24.\"
d9bfdb9c 25.\" added note on self-signaling, aeb, 2002-06-07
fea681da
MK
26.\" added note on CAP_KILL, mtk, 2004-06-16
27.\"
4b8c67d9 28.TH SIGQUEUE 3 2017-09-15 "Linux" "Linux Programmer's Manual"
fea681da 29.SH NAME
46d7906b 30sigqueue \- queue a signal and data to a process
fea681da
MK
31.SH SYNOPSIS
32.B #include <signal.h>
68e4db0a 33.PP
c10859eb 34.BI "int sigqueue(pid_t " pid ", int " sig ", const union sigval " value );
68e4db0a 35.PP
cc4615cc
MK
36.in -4n
37Feature Test Macro Requirements for glibc (see
38.BR feature_test_macros (7)):
39.in
68e4db0a 40.PP
cc4615cc
MK
41.BR sigqueue ():
42_POSIX_C_SOURCE\ >=\ 199309L
fea681da
MK
43.SH DESCRIPTION
44.BR sigqueue ()
45sends the signal specified in
46.I sig
47to the process whose PID is given in
48.IR pid .
49The permissions required to send a signal are the same as for
50.BR kill (2).
c13182ef 51As with
fea681da
MK
52.BR kill (2),
53the null signal (0) can be used to check if a process with a given
54PID exists.
55.PP
56The
57.I value
58argument is used to specify an accompanying item of data (either an integer
59or a pointer value) to be sent with the signal, and has the following type:
51f5698d 60.PP
088a639b 61.in +4n
bdd915e2 62.EX
fea681da
MK
63union sigval {
64 int sival_int;
65 void *sival_ptr;
66};
bdd915e2 67.EE
088a639b 68.in
847e0d88 69.PP
fea681da
MK
70If the receiving process has installed a handler for this signal using the
71.B SA_SIGINFO
72flag to
73.BR sigaction (2),
74then it can obtain this data via the
75.I si_value
c13182ef 76field of the
fea681da
MK
77.I siginfo_t
78structure passed as the second argument to the handler.
79Furthermore, the
80.I si_code
81field of that structure will be set to
82.BR SI_QUEUE .
47297adb 83.SH RETURN VALUE
c13182ef 84On success,
fea681da
MK
85.BR sigqueue ()
86returns 0, indicating that the signal was successfully
d301ee6c 87queued to the receiving process.
2b9b829d 88Otherwise, \-1 is returned and
fea681da
MK
89.I errno
90is set to indicate the error.
91.SH ERRORS
92.TP
93.B EAGAIN
94The limit of signals which may be queued has been reached.
95(See
96.BR signal (7)
97for further information.)
98.TP
99.B EINVAL
100.I sig
101was invalid.
102.TP
103.B EPERM
104The process does not have permission to send the signal
105to the receiving process.
106For the required permissions, see
107.BR kill (2).
108.TP
109.B ESRCH
110No process has a PID matching
111.IR pid .
cdd160d9 112.SH VERSIONS
d7f69577
MK
113.BR sigqueue ()
114and the underlying
115.BR rt_sigqueueinfo ()
116system call first appeared in Linux 2.2.
19d5bec9 117.SH ATTRIBUTES
32917ac0
PH
118For an explanation of the terms used in this section, see
119.BR attributes (7).
120.TS
121allbox;
122lb lb lb
123l l l.
124Interface Attribute Value
125T{
19d5bec9 126.BR sigqueue ()
32917ac0
PH
127T} Thread safety MT-Safe
128.TE
47297adb 129.SH CONFORMING TO
0ce44b60 130POSIX.1-2001, POSIX.1-2008.
fea681da
MK
131.SH NOTES
132If this function results in the sending of a signal to the process
133that invoked it, and that signal was not blocked by the calling thread,
134and no other threads were willing to handle this signal (either by
135having it unblocked, or by waiting for it using
136.BR sigwait (3)),
137then at least some signal must be delivered to this thread before this
138function returns.
0722a578 139.SS C library/kernel differences
4fd2f449
MK
140On Linux,
141.BR sigqueue ()
142is implemented using the
5b36ada0
MK
143.BR rt_sigqueueinfo (2)
144system call.
145The system call differs in its third argument, which is the
cdd160d9
MK
146.I siginfo_t
147structure that will be supplied to the receiving process's
148signal handler or returned by the receiving process's
149.BR sigtimedwait (2)
150call.
e0bf9127 151Inside the glibc
cdd160d9
MK
152.BR sigqueue ()
153wrapper, this argument,
5b36ada0 154.IR uinfo ,
cdd160d9 155is initialized as follows:
e646a1ba 156.PP
088a639b 157.in +4n
e646a1ba 158.EX
d2919f1e 159uinfo.si_signo = sig; /* Argument supplied to sigqueue() */
5b36ada0
MK
160uinfo.si_code = SI_QUEUE;
161uinfo.si_pid = getpid(); /* Process ID of sender */
162uinfo.si_uid = getuid(); /* Real UID of sender */
d2919f1e 163uinfo.si_value = val; /* Argument supplied to sigqueue() */
b8302363 164.EE
cdd160d9 165.in
47297adb 166.SH SEE ALSO
fea681da 167.BR kill (2),
d4b94904 168.BR rt_sigqueueinfo (2),
fea681da
MK
169.BR sigaction (2),
170.BR signal (2),
36757dc1 171.BR pthread_sigqueue (3),
fea681da
MK
172.BR sigwait (3),
173.BR signal (7)