[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions , Volume 2


sigemptyset, sigfillset, sigaddset, sigdelset, or sigismember Subroutine

Purpose

Creates and manipulates signal masks.

Library

Standard C Library (libc.a)

Syntax

#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;

Description

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.

Parameters


Set Specifies the signal set.
SignalNumber Specifies the individual signal.

Examples

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);

Return Values

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.

Error Codes

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.

Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

Related Information

The sigaction, sigvec, or signal (sigaction, sigvec, or signal Subroutine) subroutine, sigprocmask (sigprocmask, sigsetmask, or sigblock Subroutine) subroutine, sigsuspend (sigsuspend or sigpause Subroutine) subroutine.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]