sigaction.2 (2010 09)

s
sigaction(2) sigaction(2)
The selection order between realtime and nonrealtime signals, or between multiple pending nonrealtime
signals, is unspecified.
Signals generated by
kill() or other events that cause signals to occur, such as detection of hardware
faults, alarm() timer expiration, or terminal activity, and for which the implementation does not sup-
port queueing, will have no effect on signals already queued for the same signal number.
If, when a pending signal is delivered, there are additional signals to be queued to that signal number,
the signal will remain pending. Otherwise, the pending indication will be reset.
An implementation will document any condition not specified by this document under which the imple-
mentation generates signals.
Signal Actions
There are three types of action that can be associated with a signal:
SIG_DFL, SIG_IGN or a pointer to
a function. Initially, all signals will be set to
SIG_DFL or SIG_IGN prior to entry of the main() rou-
tine (see the
exec functions). The actions prescribed by these values are as follows:
SIG_DFL - signal-specific default action
The default actions for the signals defined in this document are specified under signal (5).
If the default action is to stop the process, the execution of that process is temporarily suspended.
When a process stops, a
SIGCHLD signal will be generated for its parent process, unless the
parent process has set the SA_NOCLDSTOP flag. While a process is stopped, any additional sig-
nals that are sent to the process will not be delivered until the process is continued, except
SIG-
KILL which always terminates the receiving process. A process that is a member of an
orphaned process group will not be allowed to stop in response to the SIGTSTP, SIGTTIN
,or
SIGTTOU signals. In cases where delivery of one of these signals would stop such a process, the
signal will be discarded.
Setting a signal action to
SIG_DFL for a signal that is pending, and whose default action is to
ignore the signal (for example, SIGCHLD), will cause the pending signal to be discarded,
whether or not it is blocked. Any queued values pending will be discarded, and the system
resources used to queue them will be released and made available to queue other signals.
SIG_IGN - ignore signal
Delivery of the signal will have no effect on the process. The behavior of a process is undefined
after it ignores a
SIGFPE, SIGILL,orSIGSEGV signal that was not generated by
kill(),
sigqueue()or raise().
The system will not allow the action for the signals
SIGKILL or SIGSTOP to be set to
SIG_IGN.
Setting a signal action to
SIG_IGN for a signal that is pending will cause the pending signal to
be discarded, whether or not it is blocked. Any queued values pending will be discarded, and the
system resources used to queue them will be released and made available to queue other signals.
If a process sets the action for the
SIGCHLD signal to SIG_IGN, the behavior is unspecified,
except as specified below.
If the action for the
SIGCHLD signal is set to SIG_IGN, child processes of the calling processes
will not be transformed into zombie processes when they terminate. If the calling process subse-
quently waits for its children, and the process has no unwaited for children that were
transformed into zombie processes, it will block until all of its children terminate, and wait(),
wait3(), waitid(), and waitpid() will fail and set errno to [ECHILD].
Pointer to a function - catch signal
On delivery of the signal, the receiving process is to execute the signal-catching function at the
specified address. After returning from the signal-catching function, the receiving process will
resume execution at the point at which it was interrupted.
If SA_SIGINFO is cleared, the signal-catching function will be entered as:
void func(int signo);
where func is the specified signal-catching function and signo is the signal number of the signal
being delivered.
4 Hewlett-Packard Company 4 HP-UX 11i Version 3: September 2010