The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


sigprocmask, pthread_sigmask - examine and change blocked signals


#include <signal.h>

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


In a single-threaded process, the sigprocmask() function allows the calling process to examine or change (or both) the signal mask of the calling thread.

If the argument set is not a null pointer, it points to a set of signals to be used to change the currently blocked set.

The argument how indicates the way in which the set is changed, and consists of one of the following values:

The resulting set will be the union of the current set and the signal set pointed to by set.
The resulting set will be the signal set pointed to by set.
The resulting set will be the intersection of the current set and the complement of the signal set pointed to by set.

If the argument oset is not a null pointer, the previous mask is stored in the location pointed to by oset. If set is a null pointer, the value of the argument how is not significant and the process' signal mask is unchanged; thus the call can be used to enquire about currently blocked signals.

If there are any pending unblocked signals after the call to sigprocmask(), at least one of those signals will be delivered before the call to sigprocmask() returns.

It is not possible to block those signals which cannot be ignored. This is enforced by the system without causing an error to be indicated.

If any of the SIGFPE, SIGILL, SIGSEGV or SIGBUS signals are generated while they are blocked, the result is undefined, unless the signal was generated by a function capable of sending a signal to a specific process or thread.

If sigprocmask() fails, the thread's signal mask is not changed.

The use of the sigprocmask() function is unspecified in a multi-threaded process.

The pthread_sigmask() function is used to examine or change (or both) the calling thread's signal mask, regardless of the number of threads in the process. The effect is the same as described for sigprocmask(), without the restriction that the call be made in a single-threaded process.


Upon successful completion, sigprocmask() returns 0. Otherwise -1 is returned, errno is set to indicate the error and the process' signal mask will be unchanged.

Upon successful completion pthread_sigmask() returns 0; otherwise it returns the corresponding error number.


The sigprocmask() and pthread_sigmask() functions will fail if:
The value of the how argument is not equal to one of the defined values.

The pthread_sigmask() function will not return an error code of [EINTR].








sigaction(), sigaddset(), sigdelset(), sigemptyset(), sigfillset(), sigismember(), sigpending(), sigqueue(), sigsuspend(), <signal.h>.


Derived from the POSIX.1-1988 standard.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]