sigaction(3)
NAME
sigaction - Examine and change synchronous signal actions (POSIX software signal facilities)
SYNOPSIS
#include <signal.h> struct sigaction {
void (*sa_handler) ();
sigset_t sa_mask;
int sa_flags; }; int sigaction(sig, act, oact) int sig; const struct sigaction *act; struct sigaction *oact;
PARAMETERS
sigSynchronous Signal to examine or change; acceptable values are defined in Appendix D.
actPoints to a sigaction structure that describes the action to be taken upon receipt of the signal indicated by the value of the act parameter.
oactPoints 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 multi-threaded process to establish thread specific actions for such signals. 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 multi-threaded 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 SA_RESTART 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. The system’s SA_RESTART flag has the opposite meaning of the SA_RESTART flag in the sa_flags field and is always set in the underlying system call resulting from sigaction() regardless of whether SA_RESTART was indicated in sa_flags.
•The signal mask is manipulated using the POSIX § 3.3.3 sigsetops() functions. They are sigemptyset(), sigfillset(), sigaddset(), sigdelset(), and sigismember().
The sigaction() function can be used to inquire about the current handling 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:
| Return | Error | Description |
| 0 | Successful completion. | |
| \-1 | [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. | ||
| \-1 | [EINVAL] | The value specified by sig is invalid. |
| A new signal handler is not installed. | ||
| \-1 | [EINVAL] | An attempt is made to ignore or supply a handler for |
| SIGKILL or SIGSTOP. | ||
| A new signal handler is not installed. |
RELATED INFORMATION
Functions: sigvec(2), sigsetops(3), sigprocmask(3), sigsuspend(3), sigpending(3), setjmp(3), siginterrupt(3), tty(4).
Hewlett-Packard Company — OSF DCE 1.1/HP DCE 1.5