]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/sigqueue.3
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man3 / sigqueue.3
CommitLineData
c11b1abf 1.\" Copyright (c) 2002 Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 2.\"
5fbde956 3.\" SPDX-License-Identifier: Linux-man-pages-copyleft
fea681da 4.\"
d9bfdb9c 5.\" added note on self-signaling, aeb, 2002-06-07
fea681da
MK
6.\" added note on CAP_KILL, mtk, 2004-06-16
7.\"
45186a5d 8.TH SIGQUEUE 3 2021-03-22 "Linux man-pages (unreleased)"
fea681da 9.SH NAME
46d7906b 10sigqueue \- queue a signal and data to a process
d4d95d11
AC
11.SH LIBRARY
12Standard C library
8fc3b2cf 13.RI ( libc ", " \-lc )
fea681da 14.SH SYNOPSIS
c7db92b9 15.nf
fea681da 16.B #include <signal.h>
68e4db0a 17.PP
c10859eb 18.BI "int sigqueue(pid_t " pid ", int " sig ", const union sigval " value );
c7db92b9 19.fi
68e4db0a 20.PP
d39ad78f 21.RS -4
cc4615cc
MK
22Feature Test Macro Requirements for glibc (see
23.BR feature_test_macros (7)):
d39ad78f 24.RE
68e4db0a 25.PP
cc4615cc 26.BR sigqueue ():
1dd0d7b4 27.nf
5c10d2c5 28 _POSIX_C_SOURCE >= 199309L
1dd0d7b4 29.fi
fea681da
MK
30.SH DESCRIPTION
31.BR sigqueue ()
32sends the signal specified in
33.I sig
34to the process whose PID is given in
35.IR pid .
36The permissions required to send a signal are the same as for
37.BR kill (2).
c13182ef 38As with
fea681da
MK
39.BR kill (2),
40the null signal (0) can be used to check if a process with a given
41PID exists.
42.PP
43The
44.I value
45argument is used to specify an accompanying item of data (either an integer
46or a pointer value) to be sent with the signal, and has the following type:
51f5698d 47.PP
088a639b 48.in +4n
bdd915e2 49.EX
fea681da
MK
50union sigval {
51 int sival_int;
52 void *sival_ptr;
53};
bdd915e2 54.EE
088a639b 55.in
847e0d88 56.PP
fea681da
MK
57If the receiving process has installed a handler for this signal using the
58.B SA_SIGINFO
59flag to
60.BR sigaction (2),
61then it can obtain this data via the
62.I si_value
c13182ef 63field of the
fea681da
MK
64.I siginfo_t
65structure passed as the second argument to the handler.
66Furthermore, the
67.I si_code
68field of that structure will be set to
69.BR SI_QUEUE .
47297adb 70.SH RETURN VALUE
c13182ef 71On success,
fea681da
MK
72.BR sigqueue ()
73returns 0, indicating that the signal was successfully
d301ee6c 74queued to the receiving process.
2b9b829d 75Otherwise, \-1 is returned and
fea681da
MK
76.I errno
77is set to indicate the error.
78.SH ERRORS
79.TP
80.B EAGAIN
81The limit of signals which may be queued has been reached.
82(See
83.BR signal (7)
84for further information.)
85.TP
86.B EINVAL
87.I sig
88was invalid.
89.TP
90.B EPERM
91The process does not have permission to send the signal
92to the receiving process.
93For the required permissions, see
94.BR kill (2).
95.TP
96.B ESRCH
97No process has a PID matching
98.IR pid .
cdd160d9 99.SH VERSIONS
d7f69577
MK
100.BR sigqueue ()
101and the underlying
28d0f81e 102.BR rt_sigqueueinfo (2)
d7f69577 103system call first appeared in Linux 2.2.
19d5bec9 104.SH ATTRIBUTES
32917ac0
PH
105For an explanation of the terms used in this section, see
106.BR attributes (7).
c466875e
MK
107.ad l
108.nh
32917ac0
PH
109.TS
110allbox;
c466875e 111lbx lb lb
32917ac0
PH
112l l l.
113Interface Attribute Value
114T{
19d5bec9 115.BR sigqueue ()
32917ac0
PH
116T} Thread safety MT-Safe
117.TE
c466875e
MK
118.hy
119.ad
120.sp 1
3113c7f3 121.SH STANDARDS
0ce44b60 122POSIX.1-2001, POSIX.1-2008.
fea681da
MK
123.SH NOTES
124If this function results in the sending of a signal to the process
125that invoked it, and that signal was not blocked by the calling thread,
126and no other threads were willing to handle this signal (either by
127having it unblocked, or by waiting for it using
128.BR sigwait (3)),
129then at least some signal must be delivered to this thread before this
130function returns.
0722a578 131.SS C library/kernel differences
4fd2f449
MK
132On Linux,
133.BR sigqueue ()
134is implemented using the
5b36ada0
MK
135.BR rt_sigqueueinfo (2)
136system call.
137The system call differs in its third argument, which is the
cdd160d9
MK
138.I siginfo_t
139structure that will be supplied to the receiving process's
140signal handler or returned by the receiving process's
141.BR sigtimedwait (2)
142call.
e0bf9127 143Inside the glibc
cdd160d9
MK
144.BR sigqueue ()
145wrapper, this argument,
5b36ada0 146.IR uinfo ,
cdd160d9 147is initialized as follows:
e646a1ba 148.PP
088a639b 149.in +4n
e646a1ba 150.EX
d2919f1e 151uinfo.si_signo = sig; /* Argument supplied to sigqueue() */
5b36ada0
MK
152uinfo.si_code = SI_QUEUE;
153uinfo.si_pid = getpid(); /* Process ID of sender */
154uinfo.si_uid = getuid(); /* Real UID of sender */
d2919f1e 155uinfo.si_value = val; /* Argument supplied to sigqueue() */
b8302363 156.EE
cdd160d9 157.in
47297adb 158.SH SEE ALSO
fea681da 159.BR kill (2),
d4b94904 160.BR rt_sigqueueinfo (2),
fea681da
MK
161.BR sigaction (2),
162.BR signal (2),
36757dc1 163.BR pthread_sigqueue (3),
fea681da
MK
164.BR sigwait (3),
165.BR signal (7)