Start of man-pages-5.14: updating Changes and Changes.old
[man-pages.git] / man2 / rt_sigqueueinfo.2
blobd48ecbdcd9b467a9943002a80eff2273b056b35c
1 .\" Copyright (c) 2002, 2011 Michael Kerrisk <mtk.manpages@gmail.com>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
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.
12 .\"
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
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.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH RT_SIGQUEUEINFO 2 2021-03-22 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 rt_sigqueueinfo, rt_tgsigqueueinfo \- queue a signal and data
28 .SH SYNOPSIS
29 .nf
30 .BR "#include <linux/signal.h>" "     /* Definition of " SI_* " constants */"
31 .BR "#include <sys/syscall.h>" "      /* Definition of " SYS_* " constants */"
32 .B #include <unistd.h>
33 .PP
34 .BI "int syscall(SYS_rt_sigqueueinfo, pid_t " tgid ,
35 .BI "            int " sig ", siginfo_t *" info );
36 .BI "int syscall(SYS_rt_tgsigqueueinfo, pid_t " tgid ", pid_t " tid ,
37 .BI "            int " sig ", siginfo_t *" info );
38 .fi
39 .PP
40 .IR Note :
41 There are no glibc wrappers for these system calls; see NOTES.
42 .SH DESCRIPTION
43 The
44 .BR rt_sigqueueinfo ()
45 and
46 .BR rt_tgsigqueueinfo ()
47 system calls are the low-level interfaces used to send a signal plus data
48 to a process or thread.
49 The receiver of the signal can obtain the accompanying data
50 by establishing a signal handler with the
51 .BR sigaction (2)
52 .B SA_SIGINFO
53 flag.
54 .PP
55 These system calls are not intended for direct application use;
56 they are provided to allow the implementation of
57 .BR sigqueue (3)
58 and
59 .BR pthread_sigqueue (3).
60 .PP
61 The
62 .BR rt_sigqueueinfo ()
63 system call sends the signal
64 .I sig
65 to the thread group with the ID
66 .IR tgid .
67 (The term "thread group" is synonymous with "process", and
68 .I tid
69 corresponds to the traditional UNIX process ID.)
70 The signal will be delivered to an arbitrary member of the thread group
71 (i.e., one of the threads that is not currently blocking the signal).
72 .PP
73 The
74 .I info
75 argument specifies the data to accompany the signal.
76 This argument is a pointer to a structure of type
77 .IR siginfo_t ,
78 described in
79 .BR sigaction (2)
80 (and defined by including
81 .IR <sigaction.h> ).
82 The caller should set the following fields in this structure:
83 .TP
84 .I si_code
85 This should be one of the
86 .B SI_*
87 codes in the Linux kernel source file
88 .IR include/asm\-generic/siginfo.h .
89 If the signal is being sent to any process other than the caller itself,
90 the following restrictions apply:
91 .RS
92 .IP * 3
93 The code can't be a value greater than or equal to zero.
94 In particular, it can't be
95 .BR SI_USER ,
96 which is used by the kernel to indicate a signal sent by
97 .BR kill (2),
98 and nor can it be
99 .BR SI_KERNEL ,
100 which is used to indicate a signal generated by the kernel.
101 .IP *
102 The code can't (since Linux 2.6.39) be
103 .BR SI_TKILL ,
104 which is used by the kernel to indicate a signal sent using
105 .\" tkill(2) or
106 .BR tgkill (2).
109 .I si_pid
110 This should be set to a process ID,
111 typically the process ID of the sender.
113 .I si_uid
114 This should be set to a user ID,
115 typically the real user ID of the sender.
117 .I si_value
118 This field contains the user data to accompany the signal.
119 For more information, see the description of the last
120 .RI ( "union sigval" )
121 argument of
122 .BR sigqueue (3).
124 Internally, the kernel sets the
125 .I si_signo
126 field to the value specified in
127 .IR sig ,
128 so that the receiver of the signal can also obtain
129 the signal number via that field.
132 .BR rt_tgsigqueueinfo ()
133 system call is like
134 .BR rt_sigqueueinfo (),
135 but sends the signal and data to the single thread
136 specified by the combination of
137 .IR tgid ,
138 a thread group ID,
140 .IR tid ,
141 a thread in that thread group.
142 .SH RETURN VALUE
143 On success, these system calls return 0.
144 On error, they return \-1 and
145 .I errno
146 is set to indicate the error.
147 .SH ERRORS
149 .B EAGAIN
150 The limit of signals which may be queued has been reached.
151 (See
152 .BR signal (7)
153 for further information.)
155 .B EINVAL
156 .IR sig ,
157 .IR tgid ,
159 .IR tid
160 was invalid.
162 .B EPERM
163 The caller does not have permission to send the signal to the target.
164 For the required permissions, see
165 .BR kill (2).
167 .B EPERM
168 .I tgid
169 specifies a process other than the caller and
170 .I info\->si_code
171 is invalid.
173 .B ESRCH
174 .BR rt_sigqueueinfo ():
175 No thread group matching
176 .I tgid
177 was found.
179 .BR rt_tgsigqueinfo ():
180 No thread matching
181 .I tgid
183 .I tid
184 was found.
185 .SH VERSIONS
187 .BR rt_sigqueueinfo ()
188 system call was added to Linux in version 2.2.
190 .BR rt_tgsigqueueinfo ()
191 system call was added to Linux in version 2.6.31.
192 .SH CONFORMING TO
193 These system calls are Linux-specific.
194 .SH NOTES
195 Since these system calls are not intended for application use,
196 there are no glibc wrapper functions; use
197 .BR syscall (2)
198 in the unlikely case that you want to call them directly.
200 As with
201 .BR kill (2),
202 the null signal (0) can be used to check if the specified process
203 or thread exists.
204 .SH SEE ALSO
205 .BR kill (2),
206 .BR pidfd_send_signal (2),
207 .BR sigaction (2),
208 .BR sigprocmask (2),
209 .BR tgkill (2),
210 .BR pthread_sigqueue (3),
211 .BR sigqueue (3),
212 .BR signal (7)