A signal is an event that interrupts the normal flow of control in your program. Your operating environment normally defines the full set of signals available (see `sys/signal.h'), as well as the default means of dealing with them--typically, either printing an error message and aborting your program, or ignoring the signal.
All systems support at least the following signals:
SIGABRT
SIGFPE
SIGILL
SIGINT
SIGSEGV
SIGTERM
Two functions are available for dealing with asynchronous signals--one to allow your program to send signals to itself (this is called raising a signal), and one to specify subroutines (called handlers to handle particular signals that you anticipate may occur--whether raised by your own program or the operating environment.
To support these functions, `signal.h' defines three macros:
SIG_DFL
signal
function in place of a pointer to a
handler subroutine, to select the operating environment's default
handling of a signal.
SIG_IGN
signal
function in place of a pointer to a
handler, to ignore a particular signal.
SIG_ERR
signal
function in place of a pointer to a
handler, to indicate that your request to set up a handler could not
be honored for some reason.
`signal.h' also defines an integral type, sig_atomic_t
.
This type is not used in any function declarations; it exists only to
allow your signal handlers to declare a static storage location where
they may store a signal value. (Static storage is not otherwise
reliable from signal handlers.)