Skip to content

Csignal

C 의 신호 처리와 관련된 내용은 C signal handling 항목 참조.

표준 라이브러리에서 시그널 처리(signal processing)는 프로그램이 실행 중에 다양한 시그널들을 어떻게 처리하는지를 정의한다. 시그널은 프로그램 내에서 몇몇 예외적인 행위(0으로 나누기 같은)를 보고하거나, 프로그램 외부의 비동기적 이벤트(키보드 키를 누르기 같은)를 보고할 수 있다.

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

C signal handling#SIGKILL vs SIGTERM 항목 참조.

See also

Favorite site

References


  1. Naver_blog_-bitnang-C_System_Programming-_Signal.pdf 

  2. C_cpp_signal_handling.pdf