HP-UX Reference (11i v1 00/12) - 2 System Calls (vol 5)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man2/!!!intro.2
________________________________________________________________
___ ___
s
sigaction(2) sigaction(2)
NAME
sigaction - examine and change signal action
SYNOPSIS
#include <signal.h>
int sigaction (
int sig,
const struct sigaction *act,
struct sigaction *oact
);
DESCRIPTION
The sigaction() function allows the calling process to examine and/or specify the action to be associ-
ated with a specific signal. The argument sig specifies the signal; acceptable values are defined in
<signal.h>.
The structure sigaction, used to describe an action to be taken, is defined in the header <signal.h> to
include at least the following members:
Member Type Member Name Description
SIG_DFL, SIG_IGN or pointer to a
function.void(*)(int) sa_handler
Additional set of signals to be blocked
during execution of signal-catching
function.sigset_t sa_mask
Special flags to affect behavior of sig-
nal.int sa_flags
signal-catching function.void(*)(int, siginfo_t*,void *) sa_sigaction
If the argument act is not a null pointer, it points to a structure specifying the action to be associated with
the specified signal. If the argument oact is not a null pointer, the action previously associated with the
signal is stored in the location pointed to by the argument oact. If the argument act is a null pointer, signal
handling is unchanged; thus, the call can be used to enquire about the current handling of a given signal.
The sa_handler field of the
sigaction structure identifies the action to be associated with the specified
signal. If the sa_handler field specifies a signal-catching function, the sa_mask field identifies a set of sig-
nals that will be added to the process’ signal mask before the signal-catching function is invoked. The
SIG-
KILL
and SIGSTOP signals will not be added to the signal mask using this mechanism; this restriction
will be enforced by the system without causing an error to be indicated.
The sa_flags field can be used to modify the behavior of the specified signal. The following flags, defined in
the header <signal.h> , can be set in sa_flags:
SA_NOCLDSTOP Do not generate SIGCHLD when children stop.
SA_ONSTACK If set and an alternate signal stack has been declared with
sigaltstack() or sigstack() , the signal will be delivered to the cal-
ling process on that stack. Otherwise, the signal will be delivered on the
current stack.
SA_RESETHAND If set, the disposition of the signal will be reset to SIG_DFL and the
SA_SIGINFO flag will be cleared on entry to the signal handler (Note:
SIGILL, SIGTRAP, and SIGPWR cannot be automatically reset when
delivered; the system silently enforces this restriction). Otherwise, the dispo-
sition of the signal will not be modified on entry to the signal handler. In
addition, if this flag is set, sigaction() behaves as if the SA_NODEFER
flag were also set.
SA_RESTART This flag affects the behaviour of interruptible functions; that is, those
specified to fail with errno set to EINTR. If set, and a function specified as
interruptible is interrupted by this signal, the function will restart and will
not fail with EINTR unless otherwise specified. If the flag is not set,
HP-UX Release 11i: December 2000 1 Section 2333
___
___