Skip to content
Search

Csignal

lastmod 2022-11-01created 2015-09-3021 edits

For signal handling in C, see C signal handling.

In the standard library, signal processing defines how a program handles various signals while it is running. A signal can report some exceptional behavior within the program (such as division by zero), or an asynchronous event outside the program (such as a key press on the keyboard).

Define

// Defined in header <csignal>
#define SIGINT      2   /* Interactive attention */
#define SIGILL      4   /* Illegal instruction */
#define SIGFPE      8   /* Floating point error */
#define SIGSEGV     11  /* Segmentation violation */
#define SIGTERM     15  /* Termination request */
#define SIGBREAK    21  /* Control-break */
#define SIGABRT     22  /* Abnormal termination (abort) */

Each of the above macro constants expands to an integer constant expression with distinct values, which represent different signals sent to the program.

Constant

Explanation

SIGTERM

termination request, sent to the program

SIGSEGV

invalid memory access (segmentation fault)

SIGINT

external interrupt, usually initiated by the user

SIGILL

invalid program image, such as invalid instruction

SIGABRT

abnormal termination condition, as is e.g. initiated by std::abort()

SIGFPE

erroneous arithmetic operation such as divide by zero

SIGKILL vs SIGTERM

See C signal handling#SIGKILL vs SIGTERM for details.

See also

Favorite site

References


  1. Naver_blog_-bitnang-C_System_Programming-_Signal.pdf ↩

  2. C_cpp_signal_handling.pdf ↩

author Zer0 sitemap