Node:Process Signal Mask, Next:Testing for Delivery, Previous:Signal Sets, Up:Blocking Signals
The collection of signals that are currently blocked is called the
signal mask. Each process has its own signal mask. When you
create a new process (see Creating a Process), it inherits its
parent's mask. You can block or unblock signals with total flexibility
by modifying the signal mask.
The prototype for the sigprocmask
function is in signal.h
.
int sigprocmask (int how, const sigset_t *restrict set, sigset_t *restrict oldset) | Function |
The sigprocmask function is used to examine or change the calling
process's signal mask. The how argument determines how the signal
mask is changed, and must be one of the following values:
fork and exec calls, you
can't predict what its contents are when your program starts running.)
If invoking sigprocmask causes any pending signals to be
unblocked, at least one of those signals is delivered to the process
before sigprocmask returns. The order in which pending signals
are delivered is not specified, but you can control the order explicitly
by making multiple sigprocmask calls to unblock various signals
one at a time.
The sigprocmask function returns 0 if successful, and -1
to indicate an error. The following errno error conditions are
defined for this function:
SIGKILL and SIGSTOP signals, but
if the signal set includes these, sigprocmask just ignores
them instead of returning an error status.
Remember, too, that blocking program error signals such as SIGFPE
leads to undesirable results for signals generated by an actual program
error (as opposed to signals sent with raise or kill ).
This is because your program may be too broken to be able to continue
executing to a point where the signal is unblocked again.
See Program Error Signals.
|