2005-11-18 11:53:23 +00:00
|
|
|
.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
|
2005-11-12 01:19:05 +00:00
|
|
|
.\" All rights reserved.
|
2005-11-11 03:13:25 +00:00
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice(s), this list of conditions and the following disclaimer as
|
|
|
|
.\" the first lines of this file unmodified other than the possible
|
|
|
|
.\" addition of one or more copyright notices.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice(s), this list of conditions and the following disclaimer in
|
|
|
|
.\" the documentation and/or other materials provided with the
|
|
|
|
.\" distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
|
|
|
|
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
|
|
|
|
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
|
|
.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
|
|
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
|
|
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
2005-11-18 11:53:23 +00:00
|
|
|
.Dd November 11, 2005
|
2005-11-11 03:13:25 +00:00
|
|
|
.Dt SIGQUEUE 2
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm sigqueue
|
2005-11-18 11:53:23 +00:00
|
|
|
.Nd "queue a signal to a process (REALTIME)"
|
2005-11-11 03:13:25 +00:00
|
|
|
.Sh LIBRARY
|
|
|
|
.Lb libc
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.In signal.h
|
|
|
|
.Ft int
|
|
|
|
.Fn sigqueue "pid_t pid" "int signo" "const union sigval value"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Fn sigqueue
|
2005-11-18 11:53:23 +00:00
|
|
|
system call causes the signal specified by
|
2005-11-11 03:13:25 +00:00
|
|
|
.Fa signo
|
|
|
|
to be sent with the value specified by
|
|
|
|
.Fa value
|
|
|
|
to the process specified by
|
|
|
|
.Fa pid .
|
|
|
|
If
|
|
|
|
.Fa signo
|
|
|
|
is zero (the null signal), error checking is performed but
|
2005-11-18 11:53:23 +00:00
|
|
|
no signal is actually sent.
|
|
|
|
The null signal can be used to check the
|
|
|
|
validity of PID.
|
2005-11-11 03:13:25 +00:00
|
|
|
.Pp
|
|
|
|
The conditions required for a process to have permission to queue a
|
|
|
|
signal to another process are the same as for the
|
2005-11-18 11:53:23 +00:00
|
|
|
.Xr kill 2
|
|
|
|
system call.
|
2005-11-11 03:13:25 +00:00
|
|
|
The
|
|
|
|
.Fn sigqueue
|
2005-11-18 11:53:23 +00:00
|
|
|
system call queues a signal to a single process specified by the
|
|
|
|
.Fa pid
|
|
|
|
argument.
|
2005-11-11 03:13:25 +00:00
|
|
|
.Pp
|
2005-11-18 11:53:23 +00:00
|
|
|
The
|
|
|
|
.Fn sigqueue
|
|
|
|
system call returns immediately.
|
|
|
|
If the resources were
|
2005-11-11 03:13:25 +00:00
|
|
|
available to queue the signal, the signal will be queued and sent to
|
|
|
|
the receiving process.
|
|
|
|
.Pp
|
|
|
|
If the value of
|
|
|
|
.Fa pid
|
|
|
|
causes
|
|
|
|
.Fa signo
|
|
|
|
to be generated for the sending process, and if
|
|
|
|
.Fa signo
|
|
|
|
is not blocked for the calling thread and if no other thread has
|
|
|
|
.Fa signo
|
|
|
|
unblocked or is waiting in a
|
|
|
|
.Fn sigwait
|
2005-11-18 11:53:23 +00:00
|
|
|
system call for
|
2005-11-11 14:52:06 +00:00
|
|
|
.Fa signo ,
|
|
|
|
either
|
2005-11-11 03:13:25 +00:00
|
|
|
.Fa signo
|
|
|
|
or at least the pending, unblocked signal will be delivered to the
|
2005-11-18 11:53:23 +00:00
|
|
|
calling thread before
|
2005-11-11 03:13:25 +00:00
|
|
|
.Fn sigqueue
|
2005-11-18 11:53:23 +00:00
|
|
|
returns.
|
|
|
|
Should any multiple pending signals in the range
|
|
|
|
.Dv SIGRTMIN
|
|
|
|
to
|
|
|
|
.Dv SIGRTMAX
|
|
|
|
be selected for delivery, it is the lowest numbered
|
|
|
|
one.
|
|
|
|
The selection order between realtime and non-realtime signals, or
|
2005-11-11 03:13:25 +00:00
|
|
|
between multiple pending non-realtime signals, is unspecified.
|
|
|
|
.Sh RETURN VALUES
|
2005-11-18 11:53:23 +00:00
|
|
|
.Rv -std
|
2005-11-11 03:13:25 +00:00
|
|
|
.Sh ERRORS
|
|
|
|
The
|
|
|
|
.Fn sigqueue
|
2005-11-18 11:53:23 +00:00
|
|
|
system call
|
2005-11-11 03:13:25 +00:00
|
|
|
will fail if:
|
|
|
|
.Bl -tag -width Er
|
|
|
|
.It Bq Er EAGAIN
|
2005-11-18 11:53:23 +00:00
|
|
|
No resources are available to queue the signal.
|
|
|
|
The process has already
|
|
|
|
queued
|
|
|
|
.Brq Dv SIGQUEUE_MAX
|
|
|
|
signals that are still pending at the receiver(s),
|
2005-11-11 03:13:25 +00:00
|
|
|
or a system-wide resource limit has been exceeded.
|
|
|
|
.It Bq Er EINVAL
|
|
|
|
The value of the
|
|
|
|
.Fa signo
|
|
|
|
argument is an invalid or unsupported signal number.
|
|
|
|
.It Bq Er EEPERM
|
|
|
|
The process does not have the appropriate privilege to send the signal
|
|
|
|
to the receiving process.
|
|
|
|
.It Bq Er ESRCH
|
2005-11-18 11:53:23 +00:00
|
|
|
The process
|
|
|
|
.Fa pid
|
|
|
|
does not exist.
|
2005-11-11 03:13:25 +00:00
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr sigaction 2 ,
|
2005-12-13 03:05:58 +00:00
|
|
|
.Xr siginfo 3 ,
|
2005-11-11 03:13:25 +00:00
|
|
|
.Xr sigpending 2 ,
|
2005-11-18 11:53:23 +00:00
|
|
|
.Xr sigqueue 2 ,
|
2005-11-11 03:13:25 +00:00
|
|
|
.Xr sigsuspend 2 ,
|
2005-11-18 11:53:23 +00:00
|
|
|
.Xr sigtimedwait 2 ,
|
|
|
|
.Xr sigwait 2 ,
|
|
|
|
.Xr sigwaitinfo 2 ,
|
2005-11-11 03:13:25 +00:00
|
|
|
.Xr pause 3 ,
|
|
|
|
.Xr pthread_sigmask 3
|
|
|
|
.Sh STANDARDS
|
|
|
|
The
|
|
|
|
.Fn sigqueue
|
2005-11-18 11:53:23 +00:00
|
|
|
system call conforms to
|
2005-11-30 04:15:44 +00:00
|
|
|
.St -p1003.1-2004
|
|
|
|
.Sh HISTORY
|
|
|
|
Support for POSIX realtime signal queue first appeared in
|
|
|
|
.Fx 7.0 .
|