console_codes.4: tfix
[man-pages.git] / man2 / rt_sigqueueinfo.2
blob2dd1a5877ac62e56ab124233cad4bb7fa837b675
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 .BI "int rt_sigqueueinfo(pid_t " tgid ", int " sig ", siginfo_t *" info );
31 .BI "int rt_tgsigqueueinfo(pid_t " tgid ", pid_t " tid ", int " sig \
32 ", siginfo_t *" info );
33 .fi
34 .PP
35 .IR Note :
36 There are no glibc wrappers for these system calls; see NOTES.
37 .SH DESCRIPTION
38 The
39 .BR rt_sigqueueinfo ()
40 and
41 .BR rt_tgsigqueueinfo ()
42 system calls are the low-level interfaces used to send a signal plus data
43 to a process or thread.
44 The receiver of the signal can obtain the accompanying data
45 by establishing a signal handler with the
46 .BR sigaction (2)
47 .B SA_SIGINFO
48 flag.
49 .PP
50 These system calls are not intended for direct application use;
51 they are provided to allow the implementation of
52 .BR sigqueue (3)
53 and
54 .BR pthread_sigqueue (3).
55 .PP
56 The
57 .BR rt_sigqueueinfo ()
58 system call sends the signal
59 .I sig
60 to the thread group with the ID
61 .IR tgid .
62 (The term "thread group" is synonymous with "process", and
63 .I tid
64 corresponds to the traditional UNIX process ID.)
65 The signal will be delivered to an arbitrary member of the thread group
66 (i.e., one of the threads that is not currently blocking the signal).
67 .PP
68 The
69 .I info
70 argument specifies the data to accompany the signal.
71 This argument is a pointer to a structure of type
72 .IR siginfo_t ,
73 described in
74 .BR sigaction (2)
75 (and defined by including
76 .IR <sigaction.h> ).
77 The caller should set the following fields in this structure:
78 .TP
79 .I si_code
80 This should be one of the
81 .B SI_*
82 codes in the Linux kernel source file
83 .IR include/asm\-generic/siginfo.h .
84 If the signal is being sent to any process other than the caller itself,
85 the following restrictions apply:
86 .RS
87 .IP * 3
88 The code can't be a value greater than or equal to zero.
89 In particular, it can't be
90 .BR SI_USER ,
91 which is used by the kernel to indicate a signal sent by
92 .BR kill (2),
93 and nor can it be
94 .BR SI_KERNEL ,
95 which is used to indicate a signal generated by the kernel.
96 .IP *
97 The code can't (since Linux 2.6.39) be
98 .BR SI_TKILL ,
99 which is used by the kernel to indicate a signal sent using
100 .\" tkill(2) or
101 .BR tgkill (2).
104 .I si_pid
105 This should be set to a process ID,
106 typically the process ID of the sender.
108 .I si_uid
109 This should be set to a user ID,
110 typically the real user ID of the sender.
112 .I si_value
113 This field contains the user data to accompany the signal.
114 For more information, see the description of the last
115 .RI ( "union sigval" )
116 argument of
117 .BR sigqueue (3).
119 Internally, the kernel sets the
120 .I si_signo
121 field to the value specified in
122 .IR sig ,
123 so that the receiver of the signal can also obtain
124 the signal number via that field.
127 .BR rt_tgsigqueueinfo ()
128 system call is like
129 .BR rt_sigqueueinfo (),
130 but sends the signal and data to the single thread
131 specified by the combination of
132 .IR tgid ,
133 a thread group ID,
135 .IR tid ,
136 a thread in that thread group.
137 .SH RETURN VALUE
138 On success, these system calls return 0.
139 On error, they return \-1 and
140 .I errno
141 is set to indicate the error.
142 .SH ERRORS
144 .B EAGAIN
145 The limit of signals which may be queued has been reached.
146 (See
147 .BR signal (7)
148 for further information.)
150 .B EINVAL
151 .IR sig ,
152 .IR tgid ,
154 .IR tid
155 was invalid.
157 .B EPERM
158 The caller does not have permission to send the signal to the target.
159 For the required permissions, see
160 .BR kill (2).
162 .B EPERM
163 .I tgid
164 specifies a process other than the caller and
165 .I info\->si_code
166 is invalid.
168 .B ESRCH
169 .BR rt_sigqueueinfo ():
170 No thread group matching
171 .I tgid
172 was found.
174 .BR rt_tgsigqueinfo ():
175 No thread matching
176 .I tgid
178 .I tid
179 was found.
180 .SH VERSIONS
182 .BR rt_sigqueueinfo ()
183 system call was added to Linux in version 2.2.
185 .BR rt_tgsigqueueinfo ()
186 system call was added to Linux in version 2.6.31.
187 .SH CONFORMING TO
188 These system calls are Linux-specific.
189 .SH NOTES
190 Since these system calls are not intended for application use,
191 there are no glibc wrapper functions; use
192 .BR syscall (2)
193 in the unlikely case that you want to call them directly.
195 As with
196 .BR kill (2),
197 the null signal (0) can be used to check if the specified process
198 or thread exists.
199 .SH SEE ALSO
200 .BR kill (2),
201 .BR pidfd_send_signal (2),
202 .BR sigaction (2),
203 .BR sigprocmask (2),
204 .BR tgkill (2),
205 .BR pthread_sigqueue (3),
206 .BR sigqueue (3),
207 .BR signal (7)