]>
Commit | Line | Data |
---|---|---|
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 | 10 | sigqueue \- queue a signal and data to a process |
d4d95d11 AC |
11 | .SH LIBRARY |
12 | Standard 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 |
22 | Feature 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 () | |
32 | sends the signal specified in | |
33 | .I sig | |
34 | to the process whose PID is given in | |
35 | .IR pid . | |
36 | The permissions required to send a signal are the same as for | |
37 | .BR kill (2). | |
c13182ef | 38 | As with |
fea681da MK |
39 | .BR kill (2), |
40 | the null signal (0) can be used to check if a process with a given | |
41 | PID exists. | |
42 | .PP | |
43 | The | |
44 | .I value | |
45 | argument is used to specify an accompanying item of data (either an integer | |
46 | or 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 |
50 | union sigval { |
51 | int sival_int; | |
52 | void *sival_ptr; | |
53 | }; | |
bdd915e2 | 54 | .EE |
088a639b | 55 | .in |
847e0d88 | 56 | .PP |
fea681da MK |
57 | If the receiving process has installed a handler for this signal using the |
58 | .B SA_SIGINFO | |
59 | flag to | |
60 | .BR sigaction (2), | |
61 | then it can obtain this data via the | |
62 | .I si_value | |
c13182ef | 63 | field of the |
fea681da MK |
64 | .I siginfo_t |
65 | structure passed as the second argument to the handler. | |
66 | Furthermore, the | |
67 | .I si_code | |
68 | field of that structure will be set to | |
69 | .BR SI_QUEUE . | |
47297adb | 70 | .SH RETURN VALUE |
c13182ef | 71 | On success, |
fea681da MK |
72 | .BR sigqueue () |
73 | returns 0, indicating that the signal was successfully | |
d301ee6c | 74 | queued to the receiving process. |
2b9b829d | 75 | Otherwise, \-1 is returned and |
fea681da MK |
76 | .I errno |
77 | is set to indicate the error. | |
78 | .SH ERRORS | |
79 | .TP | |
80 | .B EAGAIN | |
81 | The limit of signals which may be queued has been reached. | |
82 | (See | |
83 | .BR signal (7) | |
84 | for further information.) | |
85 | .TP | |
86 | .B EINVAL | |
87 | .I sig | |
88 | was invalid. | |
89 | .TP | |
90 | .B EPERM | |
91 | The process does not have permission to send the signal | |
92 | to the receiving process. | |
93 | For the required permissions, see | |
94 | .BR kill (2). | |
95 | .TP | |
96 | .B ESRCH | |
97 | No process has a PID matching | |
98 | .IR pid . | |
cdd160d9 | 99 | .SH VERSIONS |
d7f69577 MK |
100 | .BR sigqueue () |
101 | and the underlying | |
28d0f81e | 102 | .BR rt_sigqueueinfo (2) |
d7f69577 | 103 | system call first appeared in Linux 2.2. |
19d5bec9 | 104 | .SH ATTRIBUTES |
32917ac0 PH |
105 | For 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 |
110 | allbox; | |
c466875e | 111 | lbx lb lb |
32917ac0 PH |
112 | l l l. |
113 | Interface Attribute Value | |
114 | T{ | |
19d5bec9 | 115 | .BR sigqueue () |
32917ac0 PH |
116 | T} Thread safety MT-Safe |
117 | .TE | |
c466875e MK |
118 | .hy |
119 | .ad | |
120 | .sp 1 | |
3113c7f3 | 121 | .SH STANDARDS |
0ce44b60 | 122 | POSIX.1-2001, POSIX.1-2008. |
fea681da MK |
123 | .SH NOTES |
124 | If this function results in the sending of a signal to the process | |
125 | that invoked it, and that signal was not blocked by the calling thread, | |
126 | and no other threads were willing to handle this signal (either by | |
127 | having it unblocked, or by waiting for it using | |
128 | .BR sigwait (3)), | |
129 | then at least some signal must be delivered to this thread before this | |
130 | function returns. | |
0722a578 | 131 | .SS C library/kernel differences |
4fd2f449 MK |
132 | On Linux, |
133 | .BR sigqueue () | |
134 | is implemented using the | |
5b36ada0 MK |
135 | .BR rt_sigqueueinfo (2) |
136 | system call. | |
137 | The system call differs in its third argument, which is the | |
cdd160d9 MK |
138 | .I siginfo_t |
139 | structure that will be supplied to the receiving process's | |
140 | signal handler or returned by the receiving process's | |
141 | .BR sigtimedwait (2) | |
142 | call. | |
e0bf9127 | 143 | Inside the glibc |
cdd160d9 MK |
144 | .BR sigqueue () |
145 | wrapper, this argument, | |
5b36ada0 | 146 | .IR uinfo , |
cdd160d9 | 147 | is initialized as follows: |
e646a1ba | 148 | .PP |
088a639b | 149 | .in +4n |
e646a1ba | 150 | .EX |
d2919f1e | 151 | uinfo.si_signo = sig; /* Argument supplied to sigqueue() */ |
5b36ada0 MK |
152 | uinfo.si_code = SI_QUEUE; |
153 | uinfo.si_pid = getpid(); /* Process ID of sender */ | |
154 | uinfo.si_uid = getuid(); /* Real UID of sender */ | |
d2919f1e | 155 | uinfo.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) |