sigset(3) — Subroutines
NAME
sigset, sighold, sigrelse, sigignore − Compatibility interfaces for signal management
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include<signal.h> void (∗sigset(
int signal,
void (∗function) ( int ) ) ) ( int ) int sighold(
int signal ); int sigrelse(
int signal ); int sigignore(
int signal );
PARAMETERS
signalSpecifies the signal. The signal parameter can be assigned any of the signals defined in the signal.h header file.
functionSpecifies one of four values: SIG_DFL, SIG_IGN, SIG_HOLD, or an address of a signal-catching function. The function parameter is declared as type pointer to a function returning void. The following actions are prescribed by these values:
SIG_DFLSystem default handling of the signal.
SIG_IGNIgnore signal.
Any pending signal specified by the signal parameter is discarded. A pending signal is a signal that has occurred but for which no action has been taken. The system signal action is set to ignore future occurrences of this signal type.
SIG_HOLDHold signal.
The signal specified by the signal parameter is to be held. Any pending signal of this type remains held. Only one signal of each type is held.
(Address of signal-catching function.)
Catch signal.
Upon receipt of the signal specified by the signal parameter, the receiving process is to execute the signal catching function pointed to by the function parameter. Any pending signal of this type is released. This address is retained across calls to the other signal management functions, sighold() and sigrelse(). The signal number signal will be passed as the only argument to the signal-catching function.
Before entering the signal-catching function, the value of function for the caught signal will be set to SIG_HOLD. During normal return from the signal-catching handler, the system signal action is restored to function and any held signal of this type is released. If a nonlocal goto (see the setjmp() function) is taken, the sigrelse() function must be invoked to restore the system signal action and to release any held signal of this type.
Upon return from the signal-catching function, the receiving process will resume execution at the point at which it was interrupted, except for implementation-defined signals where this may not be true.
The signal-catching function will be executed and then the interrupted routine may return a value of -1 to the calling process with errno set to [EINTR] under the following conditions:
•A signal to be caught occurs during a nonatomic operation such as a call to the read(), write(), open(), or ioctl() function on a slow device (such as a terminal).
•A signal to be caught occurs during a pause() or sigsuspend() function.
•A signal to be caught occurs during a wait function that does not return immediately.
DESCRIPTION
The sigset(), sighold(), sigrelse(), and sigignore() functions enhance the signal facility and provide signal management for application processes.
The sigset() function specifies the system signal action to be taken upon receipt of signal.
The sighold() and sigrelse() functions establish critical regions of code. A call to the sighold() function has the effect of deferring or holding a signal until a subsequent call to the sigrelse() function. The sigrelse() function restores the system signal action to the action that was previously specified by sigset().
The sigignore() function sets the action for signal to SIG_IGN.
The signal() routine should not be used in conjunction with these routines for a particular signal type.
NOTES
These interfaces are provided for compatibility only. New programs should use sigaction() and sigprocmask() to control the disposition of signals.
RETURN VALUES
Upon successful completion, the sigset() function returns the previous value of the system signal action for the specified signal. Otherwise, it returns SIG_ERR and errno is set to indicate the error.
For the sighold(), sigrelse(), and sigignore() functions, a value of 0 (zero) is returned upon success. Otherwise, a value of -1 is returned and errno is set to indicate the error.
ERRORS
If the sigset(), sighold(), sigrelse(), or sigignore() function fails, errno is set to the following value:
[EINVAL]The signal parameter is either an illegal signal number or SIGKILL, or the default handling of signal cannot be changed.
RELATED INFORMATION
Functions: kill(2), setjmp(3), sigaction(2), sigprocmask(2), wait(2)
Files: signal(4)