sigprocmask - alter and return previous state of the set of blocked
int sigprocmask(int operation, sigset_t *set, sigset_t *oset);
sigprocmask manipulates the set of signals which are blocked from
delivery to the thread.
A non-NULL set specifies the set of signals to use in modifying the
currently-active set, and the incoming signals may be added to, deleted
from, or completely replace the active set, as specified by the operation
parameter, which may have the following values (as defined in
SIG_NOP Do not alter current signal mask
SIG_BLOCK Add specified signals to those in current mask
SIG_UNBLOCK Remove the specified signals from current mask
SIG_SETMASK Replace current mask with incoming one
If oset is not NULL, the current set of blocked signals (before
modification) is returned in the space to which it points. In this way,
with a NULL set and SIG_NOP operation the user can determine the current
Routines described in sigsetops(3) are used to create and examine the set
and oset signal masks.
It is not possible to block SIGKILL or SIGSTOP; this restriction is
silently imposed by the system.
POSIX specifies (contrary to BSD and System V) that a thread may block
SIGCONT. However, a) SIGCONT always restarts the receiving thread
(unless it is waiting for an event such as I/O), and b) if the receiving
process has installed a handler for SIGCONT and blocked the signal, the
thread will NOT enter its handler until it unblocks SIGCONT. (The signal
will remain pending.)
sigprocmask will fail if:
[EFAULT] set or oset point to memory that is not a part of the
process's valid address space.
[EINVAL] Operation is not a valid set-operation (as described
above: SIG_NOP, SIG_BLOCK, SIG_UNBLOCK, or SIG_SETMASK).
kill(2), sigaction(2), sigpending(2), sigsuspend(2), sigsetops(3).
A 0 value indicates that the call succeeded. A -1 return value indicates
that an error occurred and errno is set to indicate the reason.
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 ]