sigaction(3-thr) sigaction(3-thr)
NAME
sigaction - examines and changes synchronous signal actions (POSIX
software signal facilities)
SYNOPSIS
#include <signal.h>
struct sigaction {
void (*sahandler)();
sigsett samask;
int saflags;
};
int sigaction(int sig; const struct sigaction *act;
struct sigaction *oact);
PARAMETERS
sig Synchronous signal to examine or change.
act Points to a sigaction structure that describes the action to
be taken upon receipt of the signal indicated by the value
of the act parameter.
oact Points to a sigaction structure in which the signal action
data in effect at the time of the sigaction() function call
is returned.
DESCRIPTION
The sigaction POSIX service allows for per-thread handlers to be
installed for catching synchronous signals. It is called in a mul-
tithreaded process to establish thread specific actions for such sig-
nals. This call is the POSIX equivalent of the sigaction() system call
with the following exceptions or modifications:
- The sigaction() routine only modifies behavior for individual
threads.
- The sigaction() routine only works for synchronous signals.
Attempting to set a signal action for an asynchronous signal is an
error. This is true even in a single-threaded process.
Any multithreaded application using DCE Threads will need to use
the sigwait() function for dealing with asynchronous signals. The
sigwait() function can be used to synchronously wait for delivery
of asynchronously generated signals.
- The SARESTART flag is always set by the underlying system in POSIX
mode so that interrupted system calls will fail with return value
of -1 and the EINTR error in errno instead of getting restarted.
Page 1 Reliant UNIX 5.44 Printed 11/98
sigaction(3-thr) sigaction(3-thr)
The system's SARESTART flag has the opposite meaning of the
SARESTART flag in the saflags field and is always set in the
underlying system call resulting from sigaction() regardless of
whether SARESTART was indicated in saflags.
- The signal mask is manipulated using the POSIX sigsetops(3C) func-
tions. They are sigemptyset(3C), sigfillset(3C), sigaddset(3C),
sigdelset(3C), and sigismember(3C).
The sigaction() function can be used to inquire about the current han-
dling of a given signal by specifying a null pointer for act, since
the action is unchanged unless this parameter is not a null pointer.
In order for the signal action in effect at the time of the
sigaction() call to be returned, the oact parameter must not be a null
pointer.
RETURN VALUES
Possible return values are as follows:
EFAULT Either act or oact points to memory which is not a valid
part of the process address space. A new signal handler is
not installed.
EINVAL The value specified by sig is invalid. A new signal handler
is not installed.
EINVAL An attempt is made to ignore or supply a handler for SIGKILL
or SIGSTOP. A new signal handler is not installed.
SEE ALSO
sigsuspend(2), sigvec(2), siginterrupt(3), sigpending(3-thr),
sigprocmask(3-thr), setjmp(3C), sigsetops(3C), signal(5), tty(7).
Page 2 Reliant UNIX 5.44 Printed 11/98