header
<csignal> (signal.h)
C library to handle signals
Some running environments use signals to inform running processes of certain events. These events may be related to errors performed by the program code, like a wrong arithmetical operation or to exceptional situations, such as a request to interrupt the program.
Signals generally represent situations where the program has either been requested to terminate or an unrecoverable error has happened, therefore handling a signal allows for either perform pre-termination cleanup operations or try to recover from the error in some way.
Not all running environments are required to generate automatic signals in the cases for which they are designed in the standard C library, and some other environments not only generate these but also many more specific signals. But in any case, all signals generated explicitly with a call to function raise are delivered to its corresponding signal handler.
Functions
- signal
- Set function to handle signal (function)
- raise
- Generates a signal (function)
Macro constants
type | macro | signal |
int
(signals) | SIGABRT | (Signal Abort) Abnormal termination, such as is initiated by the abort function. |
SIGFPE | (Signal Floating-Point Exception) Erroneous arithmetic operation, such as zero divide or an operation resulting in overflow (not necessarily with a floating-point operation). |
SIGILL | (Signal Illegal Instruction) Invalid function image, such as an illegal instruction. This is generally due to a corruption in the code or to an attempt to execute data. |
SIGINT | (Signal Interrupt) Interactive attention signal. Generally generated by the application user. |
SIGSEGV | (Signal Segmentation Violation) Invalid access to storage: When a program tries to read or write outside the memory it has allocated. |
SIGTERM | (Signal Terminate) Termination request sent to program. |
functions
(handlers) | SIG_DFL | Default handling: The signal is handled by the default action for that particular signal. |
SIG_IGN | Ignore Signal: The signal is ignored. |
SIG_ERR | Special return value indicating failure. |
See function signal for more information.