Node:Flags for Sigaction, Next:Initial Signal Actions, Previous:Sigaction Function Example, Up:Signal Actions
sigaction
The sa_flags
member of the sigaction
structure is a
catch-all for special features. Most of the time, SA_RESTART
is
a good value to use for this field.
The value of sa_flags
is interpreted as a bit mask. Thus, you
should choose the flags you want to set, OR those flags together,
and store the result in the sa_flags
member of your
sigaction
structure.
Each signal number has its own set of flags. Each call to
sigaction
affects one particular signal number, and the flags
that you specify apply only to that particular signal.
In the GNU C library, establishing a handler with signal
sets all
the flags to zero except for SA_RESTART
, whose value depends on
the settings you have made with siginterrupt
. See Interrupted Primitives, to see what this is about.
These macros are defined in the header file signal.h
.
int SA_NOCLDSTOP | Macro |
This flag is meaningful only for the SIGCHLD signal. When the
flag is set, the system delivers the signal for a terminated child
process but not for one that is stopped. By default, SIGCHLD is
delivered for both terminated children and stopped children.
Setting this flag for a signal other than |
int SA_ONSTACK | Macro |
If this flag is set for a particular signal number, the system uses the
signal stack when delivering that kind of signal. See Signal Stack.
If a signal with this flag arrives and you have not set a signal stack,
the system terminates the program with SIGILL .
|
int SA_RESTART | Macro |
This flag controls what happens when a signal is delivered during
certain primitives (such as open , read or write ),
and the signal handler returns normally. There are two alternatives:
the library function can resume, or it can return failure with error
code EINTR .
The choice is controlled by the |