signal(3C) — 4 BSD
NAME
signal − simplified software signal facilities
SYNOPSIS
#include <signal.h>
(∗signal(sig, func))()
int sig;
void (∗func)();
DESCRIPTION
signal is a simplified interface to the more general sigvec(2) facility. See signal(5) for an explanation of general signal concepts.
signal is used to modify signal dispositions using the signal semantics of the BSD sigvec system call. sig specifies the signal, which may be any signal except SIGKILL and SIGSTOP. func specifies the signal’s disposition, which may be SIG_DFL, SIG_IGN, or the address of a signal handler.
If func is SIG_DFL, the default action for signal sig is reinstated; this default is usually termination [see signal(5)]. If func is SIG_IGN the signal is subsequently ignored and pending instances of the signal are discarded. Otherwise, when the signal occurs further occurences of the signal are automatically blocked and func is called. For information on the signal handler interface, see signal(5).
A return from the function unblocks the handled signal and continues the process at the point it was interrupted. Unlike the signal(2) facilities, the handler func remains installed after a signal has been delivered.
If a caught signal occurs during certain system calls, causing the call to terminate prematurely, the call is automatically restarted. In particular this can occur during a read or write(2) on a slow device (such as a terminal; but not a file) and during a wait(2).
The value of signal is the previous (or initial) value of func for the particular signal.
RETURN VALUE
The previous action is returned on a successful call. Otherwise, −1 is returned and errno is set to indicate the error.
ERRORS
signal will fail and no action will take place if one of the following occur:
[EINVAL] sig is not a valid signal number.
[EINVAL] An attempt is made to ignore or supply a handler for SIGKILL or SIGSTOP.
SEE ALSO
kill(1), signal(2), sigaction(2), ptrace(2), kill(2), sigvec(2), sigblock(2), sigsetmask(2), sigpause(2), sigstack(2), setjmp(3C), signal(5), sgtty(7).
CX/UX Programmer’s Reference Manual