[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 2

sigset, sighold, sigrelse, or sigignore Subroutine


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:
SIGHUP Hang up
SIGINT Interrupt
SIGILL Illegal instruction (not reset when caught)*
SIGTRAP Trace trap (not reset when caught)*
SIGFPE Floating point exception*, or arithmetic exception, integer divide by 0
SIGSYS Bad argument to routine*
SIGPIPE Write on a pipe with no one to read it
SIGALRM Alarm clock
SIGTERM Software termination signal
SIGUSR1 User-defined signal 1
SIGUSR2 User-defined signal 2.

* The default action for these signals is an abnormal termination.

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:
SIG_DFL Terminate process upon receipt of a signal.

Upon receipt of the signal specified by the Signal parameter, the receiving process is to be terminated with all of the consequences outlined in the _exit subroutine. In addition, if Signal is one of the signals marked with an asterisk above, implementation-dependent abnormal process termination routines, such as a core dump, can be invoked.

SIG_IGN Ignore 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_HOLD Hold 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 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.

Return Values

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.

Error Codes

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.

Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

Related Information

The exit subroutine, kill subroutine, setjmp subroutine, signal subroutine, wait subroutine.

[ Previous | Next | Contents | Glossary | Home | Search ]