xref: /freebsd-14.2/lib/libc/sys/sigqueue.2 (revision e84ece6b)
1*e84ece6bSDavid Xu.\"
2*e84ece6bSDavid Xu.\" Redistribution and use in source and binary forms, with or without
3*e84ece6bSDavid Xu.\" modification, are permitted provided that the following conditions
4*e84ece6bSDavid Xu.\" are met:
5*e84ece6bSDavid Xu.\" 1. Redistributions of source code must retain the above copyright
6*e84ece6bSDavid Xu.\"    notice(s), this list of conditions and the following disclaimer as
7*e84ece6bSDavid Xu.\"    the first lines of this file unmodified other than the possible
8*e84ece6bSDavid Xu.\"    addition of one or more copyright notices.
9*e84ece6bSDavid Xu.\" 2. Redistributions in binary form must reproduce the above copyright
10*e84ece6bSDavid Xu.\"    notice(s), this list of conditions and the following disclaimer in
11*e84ece6bSDavid Xu.\"    the documentation and/or other materials provided with the
12*e84ece6bSDavid Xu.\"    distribution.
13*e84ece6bSDavid Xu.\"
14*e84ece6bSDavid Xu.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
15*e84ece6bSDavid Xu.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16*e84ece6bSDavid Xu.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17*e84ece6bSDavid Xu.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
18*e84ece6bSDavid Xu.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19*e84ece6bSDavid Xu.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20*e84ece6bSDavid Xu.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
21*e84ece6bSDavid Xu.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22*e84ece6bSDavid Xu.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
23*e84ece6bSDavid Xu.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
24*e84ece6bSDavid Xu.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*e84ece6bSDavid Xu.\"
26*e84ece6bSDavid Xu.\" $FreeBSD$
27*e84ece6bSDavid Xu.\"
28*e84ece6bSDavid Xu.Dd Nov 11, 2005
29*e84ece6bSDavid Xu.Dt SIGQUEUE 2
30*e84ece6bSDavid Xu.Os
31*e84ece6bSDavid Xu.Sh NAME
32*e84ece6bSDavid Xu.Nm sigqueue
33*e84ece6bSDavid Xu.Nd queue a signal to a process (REALTIME)
34*e84ece6bSDavid Xu.Sh LIBRARY
35*e84ece6bSDavid Xu.Lb libc
36*e84ece6bSDavid Xu.Sh SYNOPSIS
37*e84ece6bSDavid Xu.In signal.h
38*e84ece6bSDavid Xu.Ft int
39*e84ece6bSDavid Xu.Fn sigqueue "pid_t pid" "int signo" "const union sigval value"
40*e84ece6bSDavid Xu.Sh DESCRIPTION
41*e84ece6bSDavid XuThe
42*e84ece6bSDavid Xu.Fn sigqueue
43*e84ece6bSDavid Xufunction causes the signal specified by
44*e84ece6bSDavid Xu.Fa signo
45*e84ece6bSDavid Xuto be sent with the value specified by
46*e84ece6bSDavid Xu.Fa value
47*e84ece6bSDavid Xuto the process specified by
48*e84ece6bSDavid Xu.Fa pid .
49*e84ece6bSDavid XuIf
50*e84ece6bSDavid Xu.Fa signo
51*e84ece6bSDavid Xuis zero (the null signal), error checking is performed but
52*e84ece6bSDavid Xuno signal is actually sent. The null signal can be used to check the
53*e84ece6bSDavid Xuvalidity of pid.
54*e84ece6bSDavid Xu.Pp
55*e84ece6bSDavid XuThe conditions required for a process to have permission to queue a
56*e84ece6bSDavid Xusignal to another process are the same as for the
57*e84ece6bSDavid Xu.Fn kill
58*e84ece6bSDavid Xufunction.
59*e84ece6bSDavid XuThe
60*e84ece6bSDavid Xu.Fn sigqueue
61*e84ece6bSDavid Xufunction queues a signal to a single process specified by the pid argument.
62*e84ece6bSDavid Xu.Pp
63*e84ece6bSDavid XuThe sigqueue() function returns immediately. If the resources were
64*e84ece6bSDavid Xuavailable to queue the signal, the signal will be queued and sent to
65*e84ece6bSDavid Xuthe receiving process.
66*e84ece6bSDavid Xu.Pp
67*e84ece6bSDavid XuIf the value of
68*e84ece6bSDavid Xu.Fa pid
69*e84ece6bSDavid Xucauses
70*e84ece6bSDavid Xu.Fa signo
71*e84ece6bSDavid Xuto be generated for the sending process, and if
72*e84ece6bSDavid Xu.Fa signo
73*e84ece6bSDavid Xuis not blocked for the calling thread and if no other thread has
74*e84ece6bSDavid Xu.Fa signo
75*e84ece6bSDavid Xuunblocked or is waiting in a
76*e84ece6bSDavid Xu.Fn sigwait
77*e84ece6bSDavid Xufunction for
78*e84ece6bSDavid Xu.Fa signo, either
79*e84ece6bSDavid Xu.Fa signo
80*e84ece6bSDavid Xuor at least the pending, unblocked signal will be delivered to the
81*e84ece6bSDavid Xucalling thread before the
82*e84ece6bSDavid Xu.Fn sigqueue
83*e84ece6bSDavid Xufunction returns. Should any multiple pending signals in the range
84*e84ece6bSDavid XuSIGRTMIN to SIGRTMAX be selected for delivery, it is the lowest numbered
85*e84ece6bSDavid Xuone. The selection order between realtime and non-realtime signals, or
86*e84ece6bSDavid Xubetween multiple pending non-realtime signals, is unspecified.
87*e84ece6bSDavid Xu.Sh RETURN VALUES
88*e84ece6bSDavid XuUpon successful completion, the specified signal has been queued, and
89*e84ece6bSDavid Xuthe
90*e84ece6bSDavid Xu.Fn sigqueue
91*e84ece6bSDavid Xufunction returns a value of zero. Otherwise, the function returns a value
92*e84ece6bSDavid Xuof -1 and set errno to indicate the error.
93*e84ece6bSDavid Xu.Sh ERRORS
94*e84ece6bSDavid XuThe
95*e84ece6bSDavid Xu.Fn sigqueue
96*e84ece6bSDavid Xuwill fail if:
97*e84ece6bSDavid Xu.Bl -tag -width Er
98*e84ece6bSDavid Xu.It Bq Er EAGAIN
99*e84ece6bSDavid XuNo resources are available to queue the signal. The process has already
100*e84ece6bSDavid Xuqueued {SIGQUEUE_MAX} signals that are still pending at the receiver(s),
101*e84ece6bSDavid Xuor a system-wide resource limit has been exceeded.
102*e84ece6bSDavid Xu.It Bq Er EINVAL
103*e84ece6bSDavid XuThe value of the
104*e84ece6bSDavid Xu.Fa signo
105*e84ece6bSDavid Xuargument is an invalid or unsupported signal number.
106*e84ece6bSDavid Xu.It Bq Er EEPERM
107*e84ece6bSDavid XuThe process does not have the appropriate privilege to send the signal
108*e84ece6bSDavid Xuto the receiving process.
109*e84ece6bSDavid Xu.It Bq Er ESRCH
110*e84ece6bSDavid XuThe process pid does not exist.
111*e84ece6bSDavid Xu.El
112*e84ece6bSDavid Xu.Sh SEE ALSO
113*e84ece6bSDavid Xu.Xr sigwait 2 ,
114*e84ece6bSDavid Xu.Xr sigtimedwait 2 ,
115*e84ece6bSDavid Xu.Xr sigwaitinfo 2 ,
116*e84ece6bSDavid Xu.Xr sigqueue 2 ,
117*e84ece6bSDavid Xu.Xr sigaction 2 ,
118*e84ece6bSDavid Xu.Xr sigpending 2 ,
119*e84ece6bSDavid Xu.Xr sigsuspend 2 ,
120*e84ece6bSDavid Xu.Xr pause 3 ,
121*e84ece6bSDavid Xu.Xr pthread_sigmask 3
122*e84ece6bSDavid Xu.Sh STANDARDS
123*e84ece6bSDavid XuThe
124*e84ece6bSDavid Xu.Fn sigqueue
125*e84ece6bSDavid Xufunction conforms to
126*e84ece6bSDavid Xu.St -p1003.1-96 .
127