SIGSUSPEND(2) SysV SIGSUSPEND(2)
NAME
sigsuspend - wait for a signal and atomically change a set of blocked
signals
SYNOPSIS
#include <signal.h>
int sigsuspend (signal_mask)
const sigset_t *signal_mask;
DESCRIPTION
The sigsuspend function replaces the signal mask of the process with the
set of signals pointed to by the signal_mask argument, and then suspends
execution of the process until delivery of a signal whose action is
either to execute a signal handler or to terminate the process.
If delivery of a signal causes the process to terminate, the sigsuspend
function does not return. If delivery of a signal causes a signal-
catching function to execute, the sigsuspend function returns after the
signal-catching function returns, with the signal mask restored to the
set that existed prior to the call to the sigsuspend function.
It is not possible to block signals which cannot be ignored. That is
enforced by the system without causing an error to be indicated.
Applications should call either sigemptyset(3) or sigfillset(3) at least
once for each object of type sigset_t prior to any other use of that
object. If such an object is not initialized in this way, but is
nonetheless supplied as an argument to the sigsuspend function, the
results are undefined.
NOTES
Domain/OS also supplies the sigpause(2) function; sigpause(2) provides a
subset of the sigsuspend functionality.
The sigsuspend function sets the signal mask and waits for an unblocked
signal as one atomic operation. This means that signals cannot occur
between the operations of setting the mask and waiting for a signal. If
a program invokes sigprocmask(SIG_SETMASK) and sigpause(2) separately, a
signal that occurs between these functions might not be noticed by
sigpause(2).
DIAGNOSTICS
Since sigsuspend suspends process execution indefinitely, there is no
successful completion return value. If a return occurs, a value of -1 is
returned and errno is set to indicate the error.
ERRORS
sigsuspend fails if:
[EINTR] A signal is caught by the calling process and control is
returned from the signal handler.
SEE ALSO
pause(2), sigaction(2), sigpending(2), sigprocmask(2), sigpause(2),
sigsetops(3)