Creates and manipulates signal masks.
#include <signal.h>
int sigemptyset (Set) sigset_t *Set;
int sigfillset (Set) sigset_t *Set;
int sigaddset (Set, SignalNumber) sigset_t *Set; int SignalNumber;
int sigdelset (Set, SignalNumber) sigset_t *Set; int SignalNumber;
int sigismember (Set, SignalNumber) sigset_t *Set; int SignalNumber;
The sigemptyset, sigfillset, sigaddset, sigdelset, and sigismember subroutines manipulate sets of signals. These functions operate on data objects addressable by the application, not on any set of signals known to the system, such as the set blocked from delivery to a process or the set pending for a process.
The sigemptyset subroutine initializes the signal set pointed to by the Set parameter such that all signals are excluded. The sigfillset subroutine initializes the signal set pointed to by the Set parameter such that all signals are included. A call to either the sigfillset or sigemptyset subroutine must be made at least once for each object of the sigset_t type prior to any other use of that object.
The sigaddset and sigdelset subroutines respectively add and delete the individual signal specified by the SignalNumber parameter from the signal set specified by the Set parameter. The sigismember subroutine tests whether the SignalNumber parameter is a member of the signal set pointed to by the Set parameter.
Set | Specifies the signal set. |
SignalNumber | Specifies the individual signal. |
To generate and use a signal mask that blocks 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); sigaddset(newset, SIGINT); return_value = sigprocmask (SIG_SETMASK, newset_p, NULL);
Upon successful completion, the sigismember subroutine returns a value of 1 if the specified signal is a member of the specified set, or the value of 0 if not. Upon successful completion, the other subroutines return a value of 0. For all the preceding subroutines, if an error is detected, a value of -1 is returned and the errno global variable is set to indicate the error.
The sigfillset, sigdelset, sigismember, and sigaddset subroutines are unsuccessful if the following is true:
EINVAL | The value of the SignalNumber parameter is not a valid signal number. |
These subroutines are part of Base Operating System (BOS) Runtime.
The sigaction, sigvec, or signal subroutine, sigprocmask subroutine, sigsuspend subroutine.