up | Inhaltsverzeichniss | Kommentar

Manual page for SIGACTION(2P)

sigaction - (POSIX only) examine or specify the action to be associated with a specific signal.

SYNOPSIS

#include <signal.h>

int sigaction(int sig, const struct sigaction *act, struct sigaction *oact)

DESCRIPTION

The information in this specification applies only to POSIX applications.

The sigaction function allows the calling process to examine or specify (or both) the action to be associated with a specific signal. The argument sig specifies the signal.

If the argument act is not NULL, it points to a structure specifying the action to be associated with the specified signal. If the argument oact is not NULL, the action previously associated with the signal is stored in the location pointed to by the argument oact. If the argument act is NULL, signal handling is unchanged by this function call.

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 signals that shall be added to the signal mask of the process before the signal-catching function is invoked. Ths SIGKILL and SIGSTOP signals shall not be added to the signal mask using this mechanism.

The SA_NOCLDSTOP bit of the sa_flags field may be used to modify the behavior of the specified signal. If sig is SIGCHLD and the SA_NOCLDSTOP flag is not set in sa_flags, a SIGCHLD signal shall be generated for the calling process whenever any of its child processes stop.

When a signal is caught by a signal-catching function installed by the sigaction function, a new signal mask is calculated and installed for the duration of the signal-catching function (or until a call to either the sigprocmask(2P) or sigsuspend(2P) function is made). This mask is formed by taking the union of the current signal mask and the value of the sa_mask for the signal being delivered and then including the signal being delivered. If and when the signal handler returns normally, the original signal mask is restored.

Once an action is installed for a specific signal, it remains installed until another action is explicitly requested (by another call to the sigaction function) or until one of the exec(2) functions is called.

RETURNS

Upon successful completion, a value of zero is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.

ERRORS

[EINVAL]
The value of the sig argument is invalid.
[EINVAL]
An attempt was made to catch, ignore, or set SIG_DFL for SIGKILL or SIGSTOP.

SEE ALSO

kill(2), sigprocmask(2P), sigsetops(2P), sigsuspend(2P)


index | Inhaltsverzeichniss | Kommentar

Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97