Open System Services System Calls Reference Manual (G06.25+, H06.03+)

System Functions (s and S) sigaction(2)
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 specied 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 elds returned in the structure pointed to by o_action are
unspecied 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_ags;
};
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 eld 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 dened in the signal.h header le.
SIG_DEBUG Requests that the debugger be entered when the signal is delivered. This value is |
dened in the signal.h header le.
SIG_DFL Requests default action to be taken when the signal is delivered; this value is
dened in the signal.h header le.
SIG_IGN Rquests that the signal have no effect on the receiving process; this value is
dened in the signal.h header le.
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 eld in the sigaction structure species 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 eld, 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
threads), or sigsuspend( ) function. If and when the signal-catching function returns normally, the
original signal mask is restored, regardless of any modications made by the sigprocmask() or
pthread_sigmask() function since the signal-catching function was invoked.
527186-003 Hewlett-Packard Company 761