Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sigsetmask(3) [netbsd man page]

SIGSETMASK(3)						   BSD Library Functions Manual 					     SIGSETMASK(3)

NAME
sigsetmask -- set current signal mask LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <signal.h> int sigsetmask(int mask); sigmask(signum); DESCRIPTION
This interface is made obsolete by: sigprocmask(2). sigsetmask() sets the current signal mask Signals are blocked from delivery if the corresponding bit in mask is a 1; the macro sigmask() is provided to construct the mask for a given signum. The system quietly disallows SIGKILL or SIGSTOP to be blocked. RETURN VALUES
The previous set of masked signals is returned. EXAMPLES
The following example using sigsetmask(): int omask; omask = sigblock(sigmask(SIGINT) | sigmask(SIGHUP)); ... sigsetmask(omask & ~(sigmask(SIGINT) | sigmask(SIGHUP))); Could be converted literally to: sigset_t set, oset; sigemptyset(&set); sigaddset(&set, SIGINT); sigaddset(&set, SIGHUP); sigprocmask(SIG_BLOCK, &set, &oset); ... sigdelset(&oset, SIGINT); sigdelset(&oset, SIGHUP); sigprocmask(SIG_SETMASK, &oset, NULL); Another, clearer, alternative is: sigset_t set; sigemptyset(&set); sigaddset(&set, SIGINT); sigaddset(&set, SIGHUP); sigprocmask(SIG_BLOCK, &set, NULL); ... sigprocmask(SIG_UNBLOCK, &set, NULL); To completely clear the signal mask using sigsetmask() one can do: (void) sigsetmask(0); Which can be expressed via sigprocmask(2) as: sigset_t eset; sigemptyset(&eset); (void) sigprocmask(SIG_SETMASK, &eset, NULL); SEE ALSO
kill(2), sigaction(2), sigprocmask(2), sigsuspend(2), sigblock(3), sigsetops(3), sigvec(3) HISTORY
The sigsetmask() function call appeared in 4.2BSD and has been deprecated. BSD
August 10, 2002 BSD

Check Out this Related Man Page

sigblock(3UCB)					     SunOS/BSD Compatibility Library Functions					    sigblock(3UCB)

NAME
sigblock, sigmask, sigpause, sigsetmask - block signals SYNOPSIS
/usr/ucb/cc [ flag ... ] file ... #include <signal.h> int sigblock(mask) int mask; int sigmask(signum) int signum; int sigpause(mask) int mask; int sigsetmask(mask) int mask; DESCRIPTION
sigblock() adds the signals specified in mask to the set of signals currently being blocked from delivery. Signals are blocked if the appropriate bit in mask is a 1; the macro sigmask is provided to construct the mask for a given signum. sigblock() returns the previous mask. The previous mask may be restored using sigsetmask(). sigpause() assigns mask to the set of masked signals and then waits for a signal to arrive; on return the set of masked signals is restored. mask is usually 0 to indicate that no signals are now to be blocked. sigpause() always terminates by being interrupted, returning -1 and setting errno to EINTR. sigsetmask() sets the current signal mask (those signals that are blocked from delivery). Signals are blocked if the corresponding bit in mask is a 1; the macro sigmask is provided to construct the mask for a given signum. In normal usage, a signal is blocked using sigblock(). To begin a critical section, variables modified on the occurrence of the signal are examined to determine that there is no work to be done, and the process pauses awaiting work by using sigpause() with the mask returned by sigblock(). It is not possible to block SIGKILL, SIGSTOP, or SIGCONT, this restriction is silently imposed by the system. RETURN VALUES
sigblock() and sigsetmask() return the previous set of masked signals. sigpause() returns -1 and sets errno to EINTR. SEE ALSO
cc(1B), kill(2), sigaction(2), signal(3UCB), sigvec(3UCB) NOTES
Use of these interfaces should be restricted to only applications written on BSD platforms. Use of these interfaces with any of the system libraries or in multi-thread applications is unsupported. SunOS 5.11 30 Oct 2007 sigblock(3UCB)
Man Page