SIGQUEUE(3) SIGQUEUE(3)
sigqueue - queue a signal to a process (POSIX)
#include <signal.h>
int sigqueue(pid_t pid, int signo, const union sigval value);
The function sigqueue() causes the signal specified by signo to be sent
with the value specified by value to the process specified by pid. If
signo is zero (the null signal), error checking is performed, but no
signal is actually sent. The null signal can be used to check the
validity of pid.
The conditions required for a process to have permission to queue a
signal to another process are the same as for the kill(2) function.
If the signal specified in signo is currently blocked for the receiving
process, sigqueue() shall return immediately and, if SA_SIGINFO is set
for signo and if the resources were available to queue the signal, the
signal shall be left queued and pending. Furthermore, when the signal
handler for signo is delivered, the field si_code of the passed in
siginfo structure will be set to SI_QUEUE (see sigaction(2), signal(5)).
If SA_SIGINFO is not set for signo, then signo, but not necessarily
value, shall be sent at least once to the receiving process.
If the value of pid causes signo to be generated for the sending process,
and if signo is not blocked for the calling thread and if no other thread
has signo unblocked or is waiting in a sigwait function for signo, at
least one pending unblocked signal shall be delivered to the calling
thread before the sigqueue() function returns.
kill(2), sigaction(2), sigwait(3), signal(5).
Upon successful completion, the sigqueue() function returns a value of 0
indicating that the specified signal has been queued. Otherwise a value
of -1 is returned and errno is set to indicate the error. If any of the
conditions below occur, the sigqueue() function shall return -1 and set
errno to the corresponding value:
[EAGAIN] No resources available to queue the signal. The process
has already queued SIGQUEUE_MAX signals that are still
pending at the receivers, or a system wide resource limit
has been exceeded.
[EINVAL] The value of the sig argument is an invalid or unsupported
signal number.
Page 1
SIGQUEUE(3) SIGQUEUE(3)
[EPERM] The process does not have the appropriate privilege to
send the signal to the receiving process.
[ESRCH] The process pid does not exist.
The POSIX and System V signal facilities have different semantics. Using
both facilities in the same program is strongly discouraged and will
result in unpredictable behavior.
PPPPaaaaggggeeee 2222 [ Back ]
|