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