Enhance the signal facility and provide signal management.
Standard C Library (libc.a)
#include <signal.h> void (*sigset(Signal, Function))() int Signal; void (*Function)(); int sighold (Signal) int Signal; int sigrelse (Signal) int Signal; int sigignore (Signal) int Signal;
The sigset, sighold, sigrelse, and sigignore subroutines enhance the signal facility and provide signal management for application processes.
The sigset subroutine specifies the system signal action to be taken upon receiving a Signal parameter.
The sighld and sigrelse subroutines establish critical regions of code. A call to the sighold subroutine is analogous to raising the priority level and deferring or holding a signal until the priority is lowered by sigrelse. The sigrelse subroutine restores the system signal action to the action that was previously specified by the sigset structure.
The sigignore subroutine sets the action for the Signal parameter to SIG_IGN.
The other signal management routine, signal, should not be used in conjunction with these routines for a particular signal type.
|Signal|| Specifies the signal. The Signal parameter can be assigned any
one of the following signals:
For portability, application programs should use or catch only the signals listed above. Other signals are hardware-dependant and implementation-dependant and may have very different meanings or results across systems. For example, the System V signals (SIGEMT, SIGBUS, SIGSEGV, and SIGIOT) are implementation-dependent and are not listed above. Specific implementations may have other implementation-dependent signals.
|Function|| Specifies the choice. The Function parameter is declared as a
type pointer to a function returning void. The Function parameter is
assigned one of four values: SIG_DFL, SIG_IGN, SIG_HOLD, or
an address of a signal-catching function. Definitions of the actions
taken by each of the values are:
|address|| 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 is passed as the only argument to the signal-catching function. Before entering the signal-catching function, the value of the Function parameter for the caught signal is set to SIG_HOLD. During normal return from the signal-catching handler, the system signal action is restored to the Function parameter and any held signal of this type is released. If a nonlocal goto (see the setjmp subroutine) is taken, the sigrelse subroutine 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 in which this may not be true.
When a signal to be caught occurs during a nonatomic operation such as a call to the read, write, open, or ioctl subroutine on a slow device (such as a terminal); during a pause subroutine; during a wait subroutine that does not return immediately, the signal-catching function is executed. The interrupted routine then returns a value of -1 to the calling process with the errno global variable set to EINTR.
Upon successful completion, the sigset subroutine returns the previous value of the system signal action for the specified Signal. Otherwise, it returns SIG_ERR and the errno global variable is set to indicate the error.
For the sighold, sigrelse, and sigignore subroutines, a value of 0 is returned upon success. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.
The sigset, sighold, sigrelse, or sigignore subroutine is unsuccessful if the following is true:
|EINVAL||The Signal value is either an illegal signal number, or the default handling of Signal cannot be changed.|
These subroutines are part of Base Operating System (BOS) Runtime.
The exit subroutine, kill subroutine, setjmp subroutine, signal subroutine, wait subroutine.