Copyright 1989 AT&T. Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
#include <signal.h> int sigprocmask(int how, const sigset_t *restrict set, sigset_t *restrict oset);
The sigprocmask() function is used to examine and/or change the caller's signal mask. If the value is SIG_BLOCK, the set pointed to by the set argument is added to the current signal mask. If the value is SIG_UNBLOCK, the set pointed by the set argument is removed from the current signal mask. If the value is SIG_SETMASK, the current signal mask is replaced by the set pointed to by the set argument. If the oset argument is not NULL, the previous mask is stored in the space pointed to by oset. If the value of the set argument is NULL, the value how is not significant and the caller's signal mask is unchanged; thus, the call can be used to inquire about currently blocked signals. If the set or oset argument points to an invalid address, the behavior is undefined and errno may be set to EFAULT.
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 signals that cannot be caught or ignored (see sigaction(2)). It is also not possible to block or unblock SIGCANCEL, as SIGCANCEL is reserved for the implementation of POSIX thread cancellation (see pthread_cancel(3C) and cancellation(5)). This restriction is silently enforced by the standard C library.
If sigprocmask() fails, the caller's signal mask is not changed.
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
The sigprocmask() function will fail if:
EINVAL
The value of the how argument is not equal to one of the defined values.
The sigprocmask() function may fail if:
EFAULT
The set or oset argument points to an illegal address.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Interface Stability | Standard |
MT-Level | Async-Signal-Safe |
sigaction(2), pthread_cancel(3C), pthread_sigmask(3C), signal(3C), signal.h(3HEAD), sigsetops(3C), attributes(5), cancellation(5)
The call to sigprocmask() affects only the calling thread's signal mask. It is identical to a call to pthread_sigmask(3C).
Signals that are generated synchronously should not be masked. If such a signal is blocked and delivered, the receiving process is killed.