C signal handling

In the C Standard Library, signal processing defines how a program handles various signals while it executes. A signal can report some exceptional behavior within the program ("such as division by zero"), or a signal can report some asynchronous event outside the program ("such as someone striking an interactive attention key on a keyboard").
Standard signals.
The C standard defines only 6 signals. They are all defined in codice_1 header (codice_2 header in C++):
Additional signals may be specified in the codice_1 header by the implementation. For example, Unix and Unix-like operating systems (such as Linux) define more than 15 additional signals; see Unix signal.
Handling.
A signal can be generated by calling codice_11 or codice_12 system calls. codice_11 sends a signal to the current process, codice_12 sends a signal to a specific process.
A signal handler is a function which is called by the target environment when the corresponding signal occurs. The target environment suspends execution of the program until the signal handler returns or calls codice_15.
Signal handlers can be set be with codice_16 or codice_17. The behavior of codice_16 has been changed multiple times across history and is now considered deprecated. It is only portable when used to set a signal's disposition to SIG_DFL or SIG_IGN. Signal handlers can be specified for all but two signals (SIGKILL and SIGSTOP cannot be caught, blocked or ignored).
If the signal reports an error within the program (and the signal is not asynchronous), the signal handler can terminate by calling codice_19, codice_20, or codice_15.
Example usage.
static void catch_function(int signo) {
 puts("Interactive attention signal caught.");
int main(void) {
 // Set above function as signal handler for the SIGINT signal:
 if (signal(SIGINT, catch_function) == SIG_ERR) {
 fputs("An error occurred while setting a signal handler.\n", stderr);
 return EXIT_FAILURE;
 puts("Raising the interactive attention signal.");
 if (raise(SIGINT) != 0) {
 fputs("Error raising the signal.\n", stderr);
 return EXIT_FAILURE;
 puts("Exiting.");
 return EXIT_SUCCESS;
 // exiting after raising signal