SIGSETOPS(3) BSD SIGSETOPS(3)
NAME
sigemptyset, sigfillset, sigaddset, sigdelset, sigismember - Create and
manipulate signal sets
SYNOPSIS
#include <signal.h>
int sigemptyset (set)
sigset_t *set;
int sigfillset (set)
sigset_t *set;
int sigaddset (set, sig_number)
sigset_t *set;
int sig_number;
int sigdelset (set, sig_number)
sigset_t *set;
int sig_number;
int sigismember (set, sig_number)
const sigset_t *set;
int sig_number;
DESCRIPTION
The sigemptyset, sigfillset, sigaddset, sigdelset, and sigismember
functions manipulate sets of signals. These functions operate on data
objects that can be addressed 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 set argument specifies the signal set and sig_number specifies the
individual signal.
The sigemptyset function initializes the signal set pointed to by the set
argument such that all signals are excluded. The sigfillset function
initializes the signal set pointed to by the set argument such that all
signals are included. A call to either the sigfillset or sigemptyset
function must be made at least once for each object of the type sigset_t
prior to any other use of that object.
If such an object is not initialized in this way, but is supplied as an
argument to sigaddset, sigdelset, sigismember, sigpending, sigprocmask,
sigsuspend, or sigaction, the results are undefined.
The sigaddset and sigdelset functions respectively add and delete the
individual signal specified by the sig_number argument to or from the
signal set specified by the set argument.
The sigismember function tests whether the sig_number argument is a
member of the signal set pointed to by the set parameter.
EXAMPLE
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);
DIAGNOSTICS
Upon successful completion, the sigismember function returns a value of 1
if the specified signal is a member of the specified set, or a value of 0
(zero) if it is not. Otherwise, sigismember returns a value of -1.
Upon successful completion, sigemptyset, sigfillset, sigaddset, sigdelset
return a value of 0; if an error is detected, a value of -1 is returned.
ERRORS
If the sigdelset, sigismember, or sigaddset function fails, errno will be
set to the following value:
[EINVAL] The value of the sig_number argument is not a valid signal
number.
SEE ALSO
sigaction(2), sigprocmask(2), sigsuspend(2), sigpending(2)