xref: /freebsd-14.2/lib/libc/sys/sigqueue.2 (revision 6f59c4c0)
15507a2aeSRuslan Ermilov.\" Copyright (c) 2005 David Xu <[email protected]>
2b1e515a3SDavid Xu.\" All rights reserved.
3e84ece6bSDavid Xu.\"
4e84ece6bSDavid Xu.\" Redistribution and use in source and binary forms, with or without
5e84ece6bSDavid Xu.\" modification, are permitted provided that the following conditions
6e84ece6bSDavid Xu.\" are met:
7e84ece6bSDavid Xu.\" 1. Redistributions of source code must retain the above copyright
8e84ece6bSDavid Xu.\"    notice(s), this list of conditions and the following disclaimer as
9e84ece6bSDavid Xu.\"    the first lines of this file unmodified other than the possible
10e84ece6bSDavid Xu.\"    addition of one or more copyright notices.
11e84ece6bSDavid Xu.\" 2. Redistributions in binary form must reproduce the above copyright
12e84ece6bSDavid Xu.\"    notice(s), this list of conditions and the following disclaimer in
13e84ece6bSDavid Xu.\"    the documentation and/or other materials provided with the
14e84ece6bSDavid Xu.\"    distribution.
15e84ece6bSDavid Xu.\"
16e84ece6bSDavid Xu.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
17e84ece6bSDavid Xu.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18e84ece6bSDavid Xu.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19e84ece6bSDavid Xu.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
20e84ece6bSDavid Xu.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21e84ece6bSDavid Xu.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22e84ece6bSDavid Xu.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23e84ece6bSDavid Xu.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24e84ece6bSDavid Xu.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25e84ece6bSDavid Xu.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26e84ece6bSDavid Xu.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27e84ece6bSDavid Xu.\"
28e84ece6bSDavid Xu.\" $FreeBSD$
29e84ece6bSDavid Xu.\"
305507a2aeSRuslan Ermilov.Dd November 11, 2005
31e84ece6bSDavid Xu.Dt SIGQUEUE 2
32e84ece6bSDavid Xu.Os
33e84ece6bSDavid Xu.Sh NAME
34e84ece6bSDavid Xu.Nm sigqueue
355507a2aeSRuslan Ermilov.Nd "queue a signal to a process (REALTIME)"
36e84ece6bSDavid Xu.Sh LIBRARY
37e84ece6bSDavid Xu.Lb libc
38e84ece6bSDavid Xu.Sh SYNOPSIS
39e84ece6bSDavid Xu.In signal.h
40e84ece6bSDavid Xu.Ft int
41e84ece6bSDavid Xu.Fn sigqueue "pid_t pid" "int signo" "const union sigval value"
42e84ece6bSDavid Xu.Sh DESCRIPTION
43e84ece6bSDavid XuThe
44e84ece6bSDavid Xu.Fn sigqueue
455507a2aeSRuslan Ermilovsystem call causes the signal specified by
46e84ece6bSDavid Xu.Fa signo
47e84ece6bSDavid Xuto be sent with the value specified by
48e84ece6bSDavid Xu.Fa value
49e84ece6bSDavid Xuto the process specified by
50e84ece6bSDavid Xu.Fa pid .
51e84ece6bSDavid XuIf
52e84ece6bSDavid Xu.Fa signo
53e84ece6bSDavid Xuis zero (the null signal), error checking is performed but
545507a2aeSRuslan Ermilovno signal is actually sent.
555507a2aeSRuslan ErmilovThe null signal can be used to check the
565507a2aeSRuslan Ermilovvalidity of PID.
57e84ece6bSDavid Xu.Pp
58e84ece6bSDavid XuThe conditions required for a process to have permission to queue a
59e84ece6bSDavid Xusignal to another process are the same as for the
605507a2aeSRuslan Ermilov.Xr kill 2
615507a2aeSRuslan Ermilovsystem call.
62e84ece6bSDavid XuThe
63e84ece6bSDavid Xu.Fn sigqueue
645507a2aeSRuslan Ermilovsystem call queues a signal to a single process specified by the
655507a2aeSRuslan Ermilov.Fa pid
665507a2aeSRuslan Ermilovargument.
67e84ece6bSDavid Xu.Pp
685507a2aeSRuslan ErmilovThe
695507a2aeSRuslan Ermilov.Fn sigqueue
705507a2aeSRuslan Ermilovsystem call returns immediately.
715507a2aeSRuslan ErmilovIf the resources were
72e84ece6bSDavid Xuavailable to queue the signal, the signal will be queued and sent to
73e84ece6bSDavid Xuthe receiving process.
74e84ece6bSDavid Xu.Pp
75e84ece6bSDavid XuIf the value of
76e84ece6bSDavid Xu.Fa pid
77e84ece6bSDavid Xucauses
78e84ece6bSDavid Xu.Fa signo
79e84ece6bSDavid Xuto be generated for the sending process, and if
80e84ece6bSDavid Xu.Fa signo
81e84ece6bSDavid Xuis not blocked for the calling thread and if no other thread has
82e84ece6bSDavid Xu.Fa signo
83e84ece6bSDavid Xuunblocked or is waiting in a
84e84ece6bSDavid Xu.Fn sigwait
855507a2aeSRuslan Ermilovsystem call for
86b71ec5beSDavid Xu.Fa signo ,
87b71ec5beSDavid Xueither
88e84ece6bSDavid Xu.Fa signo
89e84ece6bSDavid Xuor at least the pending, unblocked signal will be delivered to the
905507a2aeSRuslan Ermilovcalling thread before
91e84ece6bSDavid Xu.Fn sigqueue
925507a2aeSRuslan Ermilovreturns.
935507a2aeSRuslan ErmilovShould any multiple pending signals in the range
945507a2aeSRuslan Ermilov.Dv SIGRTMIN
955507a2aeSRuslan Ermilovto
965507a2aeSRuslan Ermilov.Dv SIGRTMAX
975507a2aeSRuslan Ermilovbe selected for delivery, it is the lowest numbered
985507a2aeSRuslan Ermilovone.
995507a2aeSRuslan ErmilovThe selection order between realtime and non-realtime signals, or
100e84ece6bSDavid Xubetween multiple pending non-realtime signals, is unspecified.
101e84ece6bSDavid Xu.Sh RETURN VALUES
1025507a2aeSRuslan Ermilov.Rv -std
103e84ece6bSDavid Xu.Sh ERRORS
104e84ece6bSDavid XuThe
105e84ece6bSDavid Xu.Fn sigqueue
1065507a2aeSRuslan Ermilovsystem call
107e84ece6bSDavid Xuwill fail if:
108e84ece6bSDavid Xu.Bl -tag -width Er
109e84ece6bSDavid Xu.It Bq Er EAGAIN
1105507a2aeSRuslan ErmilovNo resources are available to queue the signal.
1115507a2aeSRuslan ErmilovThe process has already
1125507a2aeSRuslan Ermilovqueued
1135507a2aeSRuslan Ermilov.Brq Dv SIGQUEUE_MAX
1145507a2aeSRuslan Ermilovsignals that are still pending at the receiver(s),
115e84ece6bSDavid Xuor a system-wide resource limit has been exceeded.
116e84ece6bSDavid Xu.It Bq Er EINVAL
117e84ece6bSDavid XuThe value of the
118e84ece6bSDavid Xu.Fa signo
119e84ece6bSDavid Xuargument is an invalid or unsupported signal number.
120e84ece6bSDavid Xu.It Bq Er EEPERM
121e84ece6bSDavid XuThe process does not have the appropriate privilege to send the signal
122e84ece6bSDavid Xuto the receiving process.
123e84ece6bSDavid Xu.It Bq Er ESRCH
1245507a2aeSRuslan ErmilovThe process
1255507a2aeSRuslan Ermilov.Fa pid
1265507a2aeSRuslan Ermilovdoes not exist.
127e84ece6bSDavid Xu.El
128e84ece6bSDavid Xu.Sh SEE ALSO
129e84ece6bSDavid Xu.Xr sigaction 2 ,
130e84ece6bSDavid Xu.Xr sigpending 2 ,
1315507a2aeSRuslan Ermilov.Xr sigqueue 2 ,
132e84ece6bSDavid Xu.Xr sigsuspend 2 ,
1335507a2aeSRuslan Ermilov.Xr sigtimedwait 2 ,
1345507a2aeSRuslan Ermilov.Xr sigwait 2 ,
1355507a2aeSRuslan Ermilov.Xr sigwaitinfo 2 ,
136e84ece6bSDavid Xu.Xr pause 3 ,
137e84ece6bSDavid Xu.Xr pthread_sigmask 3
138e84ece6bSDavid Xu.Sh STANDARDS
139e84ece6bSDavid XuThe
140e84ece6bSDavid Xu.Fn sigqueue
1415507a2aeSRuslan Ermilovsystem call conforms to
142*6f59c4c0SDavid Xu.St -p1003.1-2004
143*6f59c4c0SDavid Xu.Sh HISTORY
144*6f59c4c0SDavid XuSupport for POSIX realtime signal queue first appeared in
145*6f59c4c0SDavid Xu.Fx 7.0 .
146