1*b1e515a3SDavid Xu.\" Copyright (c) 2005 David Xu <[email protected]> 2*b1e515a3SDavid 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.\" 30e84ece6bSDavid Xu.Dd Nov 11, 2005 31e84ece6bSDavid Xu.Dt SIGQUEUE 2 32e84ece6bSDavid Xu.Os 33e84ece6bSDavid Xu.Sh NAME 34e84ece6bSDavid Xu.Nm sigqueue 35e84ece6bSDavid Xu.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 45e84ece6bSDavid Xufunction 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 54e84ece6bSDavid Xuno signal is actually sent. The null signal can be used to check the 55e84ece6bSDavid Xuvalidity of pid. 56e84ece6bSDavid Xu.Pp 57e84ece6bSDavid XuThe conditions required for a process to have permission to queue a 58e84ece6bSDavid Xusignal to another process are the same as for the 59e84ece6bSDavid Xu.Fn kill 60e84ece6bSDavid Xufunction. 61e84ece6bSDavid XuThe 62e84ece6bSDavid Xu.Fn sigqueue 63e84ece6bSDavid Xufunction queues a signal to a single process specified by the pid argument. 64e84ece6bSDavid Xu.Pp 65e84ece6bSDavid XuThe sigqueue() function returns immediately. If the resources were 66e84ece6bSDavid Xuavailable to queue the signal, the signal will be queued and sent to 67e84ece6bSDavid Xuthe receiving process. 68e84ece6bSDavid Xu.Pp 69e84ece6bSDavid XuIf the value of 70e84ece6bSDavid Xu.Fa pid 71e84ece6bSDavid Xucauses 72e84ece6bSDavid Xu.Fa signo 73e84ece6bSDavid Xuto be generated for the sending process, and if 74e84ece6bSDavid Xu.Fa signo 75e84ece6bSDavid Xuis not blocked for the calling thread and if no other thread has 76e84ece6bSDavid Xu.Fa signo 77e84ece6bSDavid Xuunblocked or is waiting in a 78e84ece6bSDavid Xu.Fn sigwait 79e84ece6bSDavid Xufunction for 80b71ec5beSDavid Xu.Fa signo , 81b71ec5beSDavid Xueither 82e84ece6bSDavid Xu.Fa signo 83e84ece6bSDavid Xuor at least the pending, unblocked signal will be delivered to the 84e84ece6bSDavid Xucalling thread before the 85e84ece6bSDavid Xu.Fn sigqueue 86e84ece6bSDavid Xufunction returns. Should any multiple pending signals in the range 87e84ece6bSDavid XuSIGRTMIN to SIGRTMAX be selected for delivery, it is the lowest numbered 88e84ece6bSDavid Xuone. The selection order between realtime and non-realtime signals, or 89e84ece6bSDavid Xubetween multiple pending non-realtime signals, is unspecified. 90e84ece6bSDavid Xu.Sh RETURN VALUES 91e84ece6bSDavid XuUpon successful completion, the specified signal has been queued, and 92e84ece6bSDavid Xuthe 93e84ece6bSDavid Xu.Fn sigqueue 94e84ece6bSDavid Xufunction returns a value of zero. Otherwise, the function returns a value 95e84ece6bSDavid Xuof -1 and set errno to indicate the error. 96e84ece6bSDavid Xu.Sh ERRORS 97e84ece6bSDavid XuThe 98e84ece6bSDavid Xu.Fn sigqueue 99e84ece6bSDavid Xuwill fail if: 100e84ece6bSDavid Xu.Bl -tag -width Er 101e84ece6bSDavid Xu.It Bq Er EAGAIN 102e84ece6bSDavid XuNo resources are available to queue the signal. The process has already 103e84ece6bSDavid Xuqueued {SIGQUEUE_MAX} signals that are still pending at the receiver(s), 104e84ece6bSDavid Xuor a system-wide resource limit has been exceeded. 105e84ece6bSDavid Xu.It Bq Er EINVAL 106e84ece6bSDavid XuThe value of the 107e84ece6bSDavid Xu.Fa signo 108e84ece6bSDavid Xuargument is an invalid or unsupported signal number. 109e84ece6bSDavid Xu.It Bq Er EEPERM 110e84ece6bSDavid XuThe process does not have the appropriate privilege to send the signal 111e84ece6bSDavid Xuto the receiving process. 112e84ece6bSDavid Xu.It Bq Er ESRCH 113e84ece6bSDavid XuThe process pid does not exist. 114e84ece6bSDavid Xu.El 115e84ece6bSDavid Xu.Sh SEE ALSO 116e84ece6bSDavid Xu.Xr sigwait 2 , 117e84ece6bSDavid Xu.Xr sigtimedwait 2 , 118e84ece6bSDavid Xu.Xr sigwaitinfo 2 , 119e84ece6bSDavid Xu.Xr sigqueue 2 , 120e84ece6bSDavid Xu.Xr sigaction 2 , 121e84ece6bSDavid Xu.Xr sigpending 2 , 122e84ece6bSDavid Xu.Xr sigsuspend 2 , 123e84ece6bSDavid Xu.Xr pause 3 , 124e84ece6bSDavid Xu.Xr pthread_sigmask 3 125e84ece6bSDavid Xu.Sh STANDARDS 126e84ece6bSDavid XuThe 127e84ece6bSDavid Xu.Fn sigqueue 128e84ece6bSDavid Xufunction conforms to 129e84ece6bSDavid Xu.St -p1003.1-96 . 130