xref: /illumos-gate/usr/src/man/man2/sigsuspend.2 (revision 6446bd46ed1b4e9f69da153665f82181ccaedad5)
te
Copyright 1989 AT&T Copyright (c) 2002, 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]
SIGSUSPEND 2 "Jun 24, 2001"
NAME
sigsuspend - install a signal mask and suspend caller until signal
SYNOPSIS

#include <signal.h>

int sigsuspend(const sigset_t *set);
DESCRIPTION

The sigsuspend() function replaces the caller's signal mask with the set of signals pointed to by the set argument and suspends the caller until delivery of a signal whose action is either to execute a signal catching function or to terminate the process. If the set argument points to an invalid address, the behavior is undefined and errno may be set to EFAULT.

If the action is to terminate the process, sigsuspend() does not return. If the action is to execute a signal catching function, sigsuspend() returns after the signal catching function returns. On return, the signal mask is restored to the set that existed before the call to sigsuspend().

It is not possible to block signals that cannot be ignored (see signal.h(3HEAD)). This restriction is silently imposed by the system.

RETURN VALUES

Since sigsuspend() suspends the caller's execution indefinitely, there is no successful completion return value. On failure, it returns -1 and sets errno to indicate the error.

ERRORS

The sigsuspend() function will fail if: EINTR

A signal was caught by the caller and control was returned from the signal catching function.

The sigsuspend() function may fail if: EFAULT

The set argument points to an illegal address.

ATTRIBUTES

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Standard
MT-Level Async-Signal-Safe
SEE ALSO

sigaction (2), sigprocmask (2), sigwait (2), signal (3C), sigsetops (3C), signal.h (3HEAD), attributes (7)

NOTES

If the caller specifies more than one unblocked signal in the mask to sigsuspend(), more than one signal might be processed before the call to sigsuspend() returns.

While the caller is executing the signal handler that interrupted its call to sigsuspend(), its signal mask is the one passed to sigsuspend(), modified as usual by the signal mask specification in the signal's sigaction(2) parameters. The caller's signal mask is not restored to its previous value until the caller returns from all the signal handlers that interrupted sigsuspend().