| SIGACTION(2) | AerieBSD 1.0 Refernce Manual | SIGACTION(2) |
struct sigaction {
union { /* signal handler */
void (*__sa_handler)(int);
void (*__sa_sigaction)(int, siginfo_t *, void *);
} __sigaction_u;
sigset_t sa_mask; /* signal mask to apply */
int sa_flags; /* see signal options below */
};
#define sa_handler __sigaction_u.__sa_handler
| NAME NAME NAME | Default Action | Description |
| SIGHUP | terminate process | terminal line hangup |
| SIGINT | terminate process | interrupt program |
| SIGQUIT | create core image | quit program |
| SIGILL | create core image | illegal instruction |
| SIGTRAP | create core image | trace trap |
| SIGABRT | create core image | abort(3) call (formerly SIGIOT) |
| SIGEMT | create core image | emulate instruction executed |
| SIGFPE | create core image | floating-point exception |
| SIGKILL | terminate process | kill program (cannot be caught or ignored) |
| SIGBUS | create core image | bus error |
| SIGSEGV | create core image | segmentation violation |
| SIGSYS | create core image | system call given invalid argument |
| SIGPIPE | terminate process | write on a pipe with no reader |
| SIGALRM | terminate process | real-time timer expired |
| SIGTERM | terminate process | software termination signal |
| SIGURG | discard signal | urgent condition present on socket |
| SIGSTOP | stop process | stop (cannot be caught or ignored) |
| SIGTSTP | stop process | stop signal generated from keyboard |
| SIGCONT | discard signal | continue after stop |
| SIGCHLD | discard signal | child status has changed |
| SIGTTIN | stop process | background read attempted from control terminal |
| SIGTTOU | stop process | background write attempted to control terminal |
| SIGIO | discard signal | I/O |
| SIGXCPU | terminate process | CPU time limit exceeded (see |
| SIGXFSZ | terminate process | file size limit exceeded (see |
| SIGVTALRM | terminate process | virtual time alarm (see |
| SIGPROF | terminate process | profiling timer alarm (see |
| SIGWINCH | discard signal | window size change |
| SIGINFO | discard signal | status request from keyboard |
| SIGUSR1 | terminate process | user defined signal 1 |
| SIGUSR2 | terminate process | user defined signal 2 |
void handler(int sig)
If the SA_SIGINFO option is enabled, the canonical way to declare it is:
void handler(int sig, siginfo_t *sip, struct sigcontext *scp)
Here sig is the signal number, into which the hardware faults and traps are mapped. If the SA_SIGINFO option is set, sip is a pointer to a siginfo_t as described in sys/siginfo.h. If SA_SIGINFO is not set, this pointer will be NULL instead. The function specified in sa_sigaction will be called instead of the function specified by sa_handler (Note that in some implementations these are in fact the same). scp is a pointer to the sigcontext structure (defined in signal.h), used to restore the context from before the signal.
void
handler(int sig)
{
int save_errno = errno;
...
errno = save_errno;
}
The functions below are async-signal-safe in OpenBSD except when used with floating-point arguments or directives, but are probably unsafe on other systems:
| AerieBSD 1.0 Reference Manual | May 14 2010 | SIGACTION(2) |