Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

System Functions (s and S) sigaction(2)
Specifying the Signal
The signal parameter specifies the signal. All values defined for signals in the signal.h header file
are valid if the corresponding action is to restore the default action. All signals can be caught or
ignored except the SIGKILL, SIGSTOP, and SIGABEND signals; these signals can neither be
caught nor ignored.
Specifying the Action
If the action parameter is not a null pointer, it points to a sigaction structure that describes the
action to be taken on receipt of the signal specified in the signal parameter.
If the o_action parameter is not a null pointer, it points to a sigaction structure in which the sig-
nal action data in effect at the time of the sigaction() call is returned.
If the action parameter is a null pointer, signal handling is unchanged; thus, the call can be used
to inquire about the current handling of a given signal.
If the previous action for signal was established by the signal() function (see the signal(3) refer-
ence page), the values of the fields returned in the structure pointed to by o_action are
unspecified and should not be depended upon. In particular, o_action->sa_handler is not neces-
sarily the same value passed to the signal() function. However, if a pointer to the same structure
is passed to a subsequent call to the sigaction() function using the action parameter, the signal is
handled in the same way as if the original call to signal() were repeated.
The sigaction structure is as follows:
struct sigaction {
sigset_t sa_mask;
void (*sa_handler)(int);
int sa_flags;
};
The action is ignored when action is set to the SIG_DFL value for a signal that cannot be caught
or ignored.
Specifying the Handler
The sa_handler field in the sigaction structure can have one of the following values, or it can
point to a function:
SIG_ABORT Requests that the process terminate abnormally when the signal is delivered.
This value is defined in the signal.h header file.
SIG_DEBUG Requests that the debugger be entered when the signal is delivered. This value is
defined in the signal.h header file.
SIG_DFL Requests default action to be taken when the signal is delivered; this value is
defined in the signal.h header file.
SIG_IGN Rquests that the signal have no effect on the receiving process; this value is
defined in the signal.h header file.
A pointer to a function requests that the signal be caught; that is, the signal causes the signal-
catching function to be called.
These actions are described in detail in the signal(4) reference page.
Blocking Signals
The sa_mask field in the sigaction structure specifies additional signals to be blocked from
delivery while the signal-catching function is executing. The system creates a new signal mask
from the existing process signal mask, the sa_mask field, and the delivered signal itself. All the
signals in the new signal mask are blocked from delivery while the signal-catching function is
executing or until a call is made to the sigprocmask(), pthread_sigmask( ) (for standard POSIX
527186-023 Hewlett-Packard Company 793