1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
.\" Copyright (c) 2002 Michael Kerrisk <mtk16@ext.canterbury.ac.nz>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" added note on self-signalling, aeb, 2002-06-07
.\"
.TH RT_SIGQUEUEINFO 2 2003-04-07 "Linux 2.4.19" "Linux Programmer's Manual"
.SH NAME
rt_sigqueueinfo \- queue a signal and data to a process
.SH SYNOPSIS
.BI "long sys_rt_sigqueueinfo(int " pid ", int " sig ", siginfo_t * " uinfo ");
.SH DESCRIPTION
.BR sys_rt_sigqueueinfo ()
sends the signal specified in
.I sig
to the process whose PID is given in
.IR pid .
The null signal (0) can be used to check if a process with a given
PID exists.
.PP
The
.I uinfo
argument is used to specify an accompanying item of data (either an integer
or a pointer value) in the sigval part of the
siginfo_t structure to be sent with the signal.
If the receiving process has installed a handler for this signal using the
.B SA_SIGINFO
flag to
.BR sigaction (2),
then it can obtain this data via the
.I si_value
field of the
.I siginfo_t
structure passed as the second argument to the handler.
Furthermore, the
.I si_code
field of that structure will be set to
.BR SI_QUEUE .
.SH "RETURN VALUE"
On success,
.BR sys_rt_sigqueueinfo ()
returns 0, indicating that the signal was successfully
queued to the receiving proces.
Otherwise, one of the following errors is returned.
.SH ERRORS
.TP
.B -EAGAIN
The limit of signals which may be queued has been reached.
.TP
.B -EINVAL
.I sig
was invalid.
.TP
.B -ESRCH
No process has a PID matching
.IR pid .
.TP
.B -EPERM
The process does not have permission to send the signal
to the receiving process.
.TP
.B -EFAULT
memory error.
.SH NOTES
If this function results in the sending of a signal to the process
that invoked it, and that signal was not blocked by the calling thread,
and no other threads were willing to handle this signal (either by
having it unblocked, or by waiting for it using
.BR sigwait (3)),
then at least some signal must be delivered to this thread before this
function returns.
.SH "CONFORMING TO"
POSIX 1003.1-2001
.SH "SEE ALSO"
.BR kill (2),
.BR sigaction (2),
.BR signal (2),
.BR sigwait (3),
.BR signal (7),
.BR sigqueue (2)
.\" Copyright (c) 2002, 2011 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
.TH rt_sigqueueinfo 2 2023-03-30 "Linux man-pages 6.04"
.SH NAME
rt_sigqueueinfo, rt_tgsigqueueinfo \- queue a signal and data
.SH LIBRARY
Standard C library
.RI ( libc ", " \-lc )
.SH SYNOPSIS
.nf
.BR "#include <linux/signal.h>" " /* Definition of " SI_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int syscall(SYS_rt_sigqueueinfo, pid_t " tgid ,
.BI " int " sig ", siginfo_t *" info );
.BI "int syscall(SYS_rt_tgsigqueueinfo, pid_t " tgid ", pid_t " tid ,
.BI " int " sig ", siginfo_t *" info );
.fi
.PP
.IR Note :
There are no glibc wrappers for these system calls; see NOTES.
.SH DESCRIPTION
The
.BR rt_sigqueueinfo ()
and
.BR rt_tgsigqueueinfo ()
system calls are the low-level interfaces used to send a signal plus data
to a process or thread.
The receiver of the signal can obtain the accompanying data
by establishing a signal handler with the
.BR sigaction (2)
.B SA_SIGINFO
flag.
.PP
These system calls are not intended for direct application use;
they are provided to allow the implementation of
.BR sigqueue (3)
and
.BR pthread_sigqueue (3).
.PP
The
.BR rt_sigqueueinfo ()
system call sends the signal
.I sig
to the thread group with the ID
.IR tgid .
(The term "thread group" is synonymous with "process", and
.I tid
corresponds to the traditional UNIX process ID.)
The signal will be delivered to an arbitrary member of the thread group
(i.e., one of the threads that is not currently blocking the signal).
.PP
The
.I info
argument specifies the data to accompany the signal.
This argument is a pointer to a structure of type
.IR siginfo_t ,
described in
.BR sigaction (2)
(and defined by including
.IR <sigaction.h> ).
The caller should set the following fields in this structure:
.TP
.I si_code
This should be one of the
.B SI_*
codes in the Linux kernel source file
.IR include/asm\-generic/siginfo.h .
If the signal is being sent to any process other than the caller itself,
the following restrictions apply:
.RS
.IP \[bu] 3
The code can't be a value greater than or equal to zero.
In particular, it can't be
.BR SI_USER ,
which is used by the kernel to indicate a signal sent by
.BR kill (2),
and nor can it be
.BR SI_KERNEL ,
which is used to indicate a signal generated by the kernel.
.IP \[bu]
The code can't (since Linux 2.6.39) be
.BR SI_TKILL ,
which is used by the kernel to indicate a signal sent using
.\" tkill(2) or
.BR tgkill (2).
.RE
.TP
.I si_pid
This should be set to a process ID,
typically the process ID of the sender.
.TP
.I si_uid
This should be set to a user ID,
typically the real user ID of the sender.
.TP
.I si_value
This field contains the user data to accompany the signal.
For more information, see the description of the last
.RI ( "union sigval" )
argument of
.BR sigqueue (3).
.PP
Internally, the kernel sets the
.I si_signo
field to the value specified in
.IR sig ,
so that the receiver of the signal can also obtain
the signal number via that field.
.PP
The
.BR rt_tgsigqueueinfo ()
system call is like
.BR rt_sigqueueinfo (),
but sends the signal and data to the single thread
specified by the combination of
.IR tgid ,
a thread group ID,
and
.IR tid ,
a thread in that thread group.
.SH RETURN VALUE
On success, these system calls return 0.
On error, they return \-1 and
.I errno
is set to indicate the error.
.SH ERRORS
.TP
.B EAGAIN
The limit of signals which may be queued has been reached.
(See
.BR signal (7)
for further information.)
.TP
.B EINVAL
.IR sig ,
.IR tgid ,
or
.I tid
was invalid.
.TP
.B EPERM
The caller does not have permission to send the signal to the target.
For the required permissions, see
.BR kill (2).
.TP
.B EPERM
.I tgid
specifies a process other than the caller and
.I info\->si_code
is invalid.
.TP
.B ESRCH
.BR rt_sigqueueinfo ():
No thread group matching
.I tgid
was found.
.PP
.BR rt_tgsigqueinfo ():
No thread matching
.I tgid
and
.I tid
was found.
.SH STANDARDS
Linux.
.SH HISTORY
.TP
.BR rt_sigqueueinfo ()
Linux 2.2.
.TP
.BR rt_tgsigqueueinfo ()
Linux 2.6.31.
.SH NOTES
Since these system calls are not intended for application use,
there are no glibc wrapper functions; use
.BR syscall (2)
in the unlikely case that you want to call them directly.
.PP
As with
.BR kill (2),
the null signal (0) can be used to check if the specified process
or thread exists.
.SH SEE ALSO
.BR kill (2),
.BR pidfd_send_signal (2),
.BR sigaction (2),
.BR sigprocmask (2),
.BR tgkill (2),
.BR pthread_sigqueue (3),
.BR sigqueue (3),
.BR signal (7)
|