C - Library - Signal
C - Library - Signal
h>
C Library - <signal.h>
Advertisements
The signal.h header defines a variable type sig_atomic_t, two function calls, and several macros to handle different signals reported during a program's
execution.
Library Variables
Following is the variable type defined in the header signal.h −
sig_atomic_t
1 This is of int type and is used as a variable in a signal handler. This is an integral type of an object that can be accessed as an atomic
entity, even in the presence of asynchronous signals.
Library Macros
Following are the macros defined in the header signal.h and these macros will be used in two functions listed below. The SIG_ macros are used with the
signal function to define signal functions.
SIG_DFL
1
Default signal handler.
SIG_ERR
2
Represents a signal error.
SIG_IGN
3
Signal ignore.
The SIG macros are used to represent a signal number in the following conditions −
SIGABRT
1
Abnormal program termination.
SIGFPE
2
Floating-point error like division by zero.
SIGILL
3
Illegal operation.
SIGINT
4
Interrupt signal such as ctrl-C.
SIGSEGV
5
Invalid access to storage like segment violation.
6 SIGTERM
https://www.tutorialspoint.com/c_standard_library/signal_h.htm 1/2
1/30/2018 C Library <signal.h>
Termination request.
Library Functions
Following are the functions defined in the header signal.h −
Advertisements
YouTube 38B
https://www.tutorialspoint.com/c_standard_library/signal_h.htm 2/2