DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

sigprocmask(S)


sigprocmask -- change and/or examine blocked signals.

Syntax

cc . . . -lc

#include  <signal.h>

int sigprocmask (how, set, oset) int how; sigset_t *set, *oset;

Description

The routine sigprocmask changes and/or examines the calling process' signal mask. A process' signal mask lists the signals that are blocked; that is, if a signal in the signal mask is generated, it is not delivered to the process until the signal is unblocked by being removed from the mask.

The signal mask of a process is initialized to that of its parent by fork(S). The mask is changed by the sigprocmask, sigaction(S), and sigsuspend(S) routines. The contents of a mask are manipulated by the sigset(S) routines.

The argument, how, dictates how the current signal mask is changed. As defined in the header file, <signal.h>, the following options are allowable:

Name Description
SIG_BLOCK The resulting set is the union of the current set and the set to which the argument set points (signals in set are added to the existing set).
SIG_UNBLOCK The resulting set is the intersection of the current set and the complement of the set to which the argument set points (signals in set are removed from the existing set).
SIG_SETMASK The resulting set is the set to which the argument set points.

 Name           Description
 SIG_BLOCK      The resulting set is the union of
                the current set and the set to
                which the argument set points
                (signals in set are added to the
                existing set).
 SIG_UNBLOCK    The resulting set is the
                intersection of the current set and
                the complement of the set to which
                the argument set points (signals in
                set are removed from the existing
                set).
 SIG_SETMASK    The resulting set is the set to
                which the argument set points.

If the argument set is not NULL, it points to the signal set that will be used to change the current signal mask, depending on the value of the argument how. If the argument set is NULL, the value of how is immaterial and the process's signal mask remains unchanged by the routine. In this latter case, the routine can be used to enquire about currently blocked signals.

If the argument oset is not NULL, the previous mask is stored in the object to which the argument oset points.

If any pending unblocked signals exist after the call to this routine, at least one of those signals is delivered before the sigprocmask routine returns.

Generation of the SIGFPE, SIGILL, or SIGSEGV signals while they are blocked yields an undefined result unless the signal was generated by a call to the raise(S) or kill(S) routines.

Un-ignorable signals, described on the signal(M) manual page cannot be blocked. The system automatically enforces this restriction without indicating an error.

Return value

Upon successful completion, a value of zero is returned. If sigprocmask fails, a value of -1 is returned and errno is set to indicate the error. In the latter case, the process's signal mask is not changed.

Diagnostics

If the following condition occurs, the sigprocmask function returns -1 and sets errno to the corresponding value:

[EINVAL]
The value of the how argument is not equal to one of the defined values.

See also

sigaction(S), signal(M), signal(S), sigpending(S), sigset(S), sigsetjmp(S) sigsetv(S), sigsuspend(S),

Standards conformance

sigprocmask conforms with:

IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) ;
X/Open Portability Guide, Issue 3, 1989 ;
and NIST FIPS 151-1 .


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003