SIGPROCMASK(2) SysV SIGPROCMASK(2)
NAME
sigprocmask - Set the current signal mask
SYNOPSIS
#include <signal.h>
int sigprocmask (how, set, o_set)
int how;
const sigset_t *set;
sigset_t *o_set;
DESCRIPTION
The sigprocmask function is used to examine or change the signal mask of
the calling process. The arguments are defined as follows:
how Indicates the manner in which the set of masked signals is changed;
it has one of the following values:
SIG_BLOCK
The resulting set is the union of the current set and the
signal set pointed to by the set argument.
SIG_UNBLOCK
The resulting set is the intersection of the current set and
the complement of the signal set pointed to by the set
argument.
SIG_SETMASK
The resulting set is the signal set pointed to by the set
argument.
set Specifies the signal set. If the value of the set argument is not
null, it points to a set of signals to be used to change the
currently blocked set. If the value of the set argument is null, the
value of the how argument is not significant and the process signal
mask is unchanged; thus, the call can be used to inquire about
currently blocked signals.
o_set
If the o_set argument is not the null value, the signal mask in
effect at the time of the call is stored in the spaced pointed to by
the o_set argument.
If there are any pending unblocked signals after the call to sigprocmask,
at least one of those signals will be delivered before the call to
sigprocmask returns.
It is not possible to block those signals which cannot be ignored. That
is enforced by the system without causing an error to be indicated.
If any of the SIGFPE, SIGILL or SIGSEGV signals are generated while they
are blocked, the result is undefined, unless the signal was generated by
a call to the kill(2) function.
If the sigprocmask function fails, the process' signal mask is not
changed.
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 sigprocmask function, the
results are undefined.
EXAMPLE
To set the signal mask to block only the SIGINT signal from delivery,
enter:
#include <signal.h>
int return_value;
sigset_t newset;
sigset_t *newset_p;
. . .
newset_p = &newset;
sigemptyset(newset_p);
sigaddset(newset_p, SIGINT);
return_value = sigprocmask (SIG_SETMASK, newset_p, NULL);
DIAGNOSTICS
Upon successful completion, the sigprocmask function returns a value of 0
(zero). Otherwise, a value of -1 is returned.
ERRORS
If the sigprocmask() function fails, errno will be set to one of the
following values:
[EINVAL] The value of the how argument is not equal to one of the
defined values.
SEE ALSO
kill(2), sigaction(2), sigpause(2), sigsuspend(2), sigsetops(3),