1*8269e767SBrooks Davis.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org> 2*8269e767SBrooks Davis.\" All rights reserved. 3*8269e767SBrooks Davis.\" 4*8269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without 5*8269e767SBrooks Davis.\" modification, are permitted provided that the following conditions 6*8269e767SBrooks Davis.\" are met: 7*8269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 8*8269e767SBrooks Davis.\" notice(s), this list of conditions and the following disclaimer as 9*8269e767SBrooks Davis.\" the first lines of this file unmodified other than the possible 10*8269e767SBrooks Davis.\" addition of one or more copyright notices. 11*8269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 12*8269e767SBrooks Davis.\" notice(s), this list of conditions and the following disclaimer in 13*8269e767SBrooks Davis.\" the documentation and/or other materials provided with the 14*8269e767SBrooks Davis.\" distribution. 15*8269e767SBrooks Davis.\" 16*8269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 17*8269e767SBrooks Davis.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18*8269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19*8269e767SBrooks Davis.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE 20*8269e767SBrooks Davis.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21*8269e767SBrooks Davis.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22*8269e767SBrooks Davis.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23*8269e767SBrooks Davis.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24*8269e767SBrooks Davis.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25*8269e767SBrooks Davis.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 26*8269e767SBrooks Davis.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27*8269e767SBrooks Davis.\" 28*8269e767SBrooks Davis.Dd May 5, 2017 29*8269e767SBrooks Davis.Dt SIGQUEUE 2 30*8269e767SBrooks Davis.Os 31*8269e767SBrooks Davis.Sh NAME 32*8269e767SBrooks Davis.Nm sigqueue 33*8269e767SBrooks Davis.Nd "queue a signal to a process (REALTIME)" 34*8269e767SBrooks Davis.Sh LIBRARY 35*8269e767SBrooks Davis.Lb libc 36*8269e767SBrooks Davis.Sh SYNOPSIS 37*8269e767SBrooks Davis.In signal.h 38*8269e767SBrooks Davis.Ft int 39*8269e767SBrooks Davis.Fn sigqueue "pid_t pid" "int signo" "const union sigval value" 40*8269e767SBrooks Davis.Sh DESCRIPTION 41*8269e767SBrooks DavisThe 42*8269e767SBrooks Davis.Fn sigqueue 43*8269e767SBrooks Davissystem call causes the signal specified by 44*8269e767SBrooks Davis.Fa signo 45*8269e767SBrooks Davisto be sent with the value specified by 46*8269e767SBrooks Davis.Fa value 47*8269e767SBrooks Davisto the process specified by 48*8269e767SBrooks Davis.Fa pid . 49*8269e767SBrooks DavisIf 50*8269e767SBrooks Davis.Fa signo 51*8269e767SBrooks Davisis zero (the null signal), error checking is performed but 52*8269e767SBrooks Davisno signal is actually sent. 53*8269e767SBrooks DavisThe null signal can be used to check the 54*8269e767SBrooks Davisvalidity of PID. 55*8269e767SBrooks Davis.Pp 56*8269e767SBrooks DavisThe conditions required for a process to have permission to queue a 57*8269e767SBrooks Davissignal to another process are the same as for the 58*8269e767SBrooks Davis.Xr kill 2 59*8269e767SBrooks Davissystem call. 60*8269e767SBrooks DavisThe 61*8269e767SBrooks Davis.Fn sigqueue 62*8269e767SBrooks Davissystem call queues a signal to a single process specified by the 63*8269e767SBrooks Davis.Fa pid 64*8269e767SBrooks Davisargument. 65*8269e767SBrooks Davis.Pp 66*8269e767SBrooks DavisThe 67*8269e767SBrooks Davis.Fn sigqueue 68*8269e767SBrooks Davissystem call returns immediately. 69*8269e767SBrooks DavisIf the resources were 70*8269e767SBrooks Davisavailable to queue the signal, the signal will be queued and sent to 71*8269e767SBrooks Davisthe receiving process. 72*8269e767SBrooks Davis.Pp 73*8269e767SBrooks DavisIf the value of 74*8269e767SBrooks Davis.Fa pid 75*8269e767SBrooks Daviscauses 76*8269e767SBrooks Davis.Fa signo 77*8269e767SBrooks Davisto be generated for the sending process, and if 78*8269e767SBrooks Davis.Fa signo 79*8269e767SBrooks Davisis not blocked for the calling thread and if no other thread has 80*8269e767SBrooks Davis.Fa signo 81*8269e767SBrooks Davisunblocked or is waiting in a 82*8269e767SBrooks Davis.Fn sigwait 83*8269e767SBrooks Davissystem call for 84*8269e767SBrooks Davis.Fa signo , 85*8269e767SBrooks Daviseither 86*8269e767SBrooks Davis.Fa signo 87*8269e767SBrooks Davisor at least the pending, unblocked signal will be delivered to the 88*8269e767SBrooks Daviscalling thread before 89*8269e767SBrooks Davis.Fn sigqueue 90*8269e767SBrooks Davisreturns. 91*8269e767SBrooks DavisShould any multiple pending signals in the range 92*8269e767SBrooks Davis.Dv SIGRTMIN 93*8269e767SBrooks Davisto 94*8269e767SBrooks Davis.Dv SIGRTMAX 95*8269e767SBrooks Davisbe selected for delivery, it is the lowest numbered 96*8269e767SBrooks Davisone. 97*8269e767SBrooks DavisThe selection order between realtime and non-realtime signals, or 98*8269e767SBrooks Davisbetween multiple pending non-realtime signals, is unspecified. 99*8269e767SBrooks Davis.Sh RETURN VALUES 100*8269e767SBrooks Davis.Rv -std 101*8269e767SBrooks Davis.Sh ERRORS 102*8269e767SBrooks DavisThe 103*8269e767SBrooks Davis.Fn sigqueue 104*8269e767SBrooks Davissystem call 105*8269e767SBrooks Daviswill fail if: 106*8269e767SBrooks Davis.Bl -tag -width Er 107*8269e767SBrooks Davis.It Bq Er EAGAIN 108*8269e767SBrooks DavisNo resources are available to queue the signal. 109*8269e767SBrooks DavisThe process has already 110*8269e767SBrooks Davisqueued 111*8269e767SBrooks Davis.Brq Dv SIGQUEUE_MAX 112*8269e767SBrooks Davissignals that are still pending at the receiver(s), 113*8269e767SBrooks Davisor a system-wide resource limit has been exceeded. 114*8269e767SBrooks Davis.It Bq Er EINVAL 115*8269e767SBrooks DavisThe value of the 116*8269e767SBrooks Davis.Fa signo 117*8269e767SBrooks Davisargument is an invalid or unsupported signal number. 118*8269e767SBrooks Davis.It Bq Er EPERM 119*8269e767SBrooks DavisThe process does not have the appropriate privilege to send the signal 120*8269e767SBrooks Davisto the receiving process. 121*8269e767SBrooks Davis.It Bq Er ESRCH 122*8269e767SBrooks DavisThe process 123*8269e767SBrooks Davis.Fa pid 124*8269e767SBrooks Davisdoes not exist. 125*8269e767SBrooks Davis.El 126*8269e767SBrooks Davis.Sh SEE ALSO 127*8269e767SBrooks Davis.Xr kill 2 , 128*8269e767SBrooks Davis.Xr sigaction 2 , 129*8269e767SBrooks Davis.Xr sigpending 2 , 130*8269e767SBrooks Davis.Xr sigsuspend 2 , 131*8269e767SBrooks Davis.Xr sigtimedwait 2 , 132*8269e767SBrooks Davis.Xr sigwait 2 , 133*8269e767SBrooks Davis.Xr sigwaitinfo 2 , 134*8269e767SBrooks Davis.Xr pause 3 , 135*8269e767SBrooks Davis.Xr pthread_sigmask 3 , 136*8269e767SBrooks Davis.Xr siginfo 3 137*8269e767SBrooks Davis.Sh STANDARDS 138*8269e767SBrooks DavisThe 139*8269e767SBrooks Davis.Fn sigqueue 140*8269e767SBrooks Davissystem call conforms to 141*8269e767SBrooks Davis.St -p1003.1-2004 . 142*8269e767SBrooks Davis.Sh HISTORY 143*8269e767SBrooks DavisSupport for 144*8269e767SBrooks Davis.Tn POSIX 145*8269e767SBrooks Davisrealtime signal queue first appeared in 146*8269e767SBrooks Davis.Fx 7.0 . 147*8269e767SBrooks Davis.Sh CAVEATS 148*8269e767SBrooks DavisWhen using 149*8269e767SBrooks Davis.Nm 150*8269e767SBrooks Davisto send signals to a process which might have a different ABI 151*8269e767SBrooks Davis(for instance, one is 32-bit and the other 64-bit), 152*8269e767SBrooks Davisthe 153*8269e767SBrooks Davis.Va sival_int 154*8269e767SBrooks Davismember of 155*8269e767SBrooks Davis.Fa value 156*8269e767SBrooks Daviscan be delivered reliably, but the 157*8269e767SBrooks Davis.Va sival_ptr 158*8269e767SBrooks Davismay be truncated in endian dependent ways and must not be relied on. 159*8269e767SBrooks DavisFurther, many pointer integrity schemes disallow sending pointers to other 160*8269e767SBrooks Davisprocesses, and this technique should not be used in programs intended to 161*8269e767SBrooks Davisbe portable. 162