Signals
The
operating system can send processes a
signal when an exceptional situation occurs. This may happen in the
event of a severe fault, such as a memory addressing error for
example, or when a hardware interrupt occurs. Signals can also be
triggered by the user at the console, however, or by the program
itself, using the function
raise()
. Functions and macros for dealing with
signals are declared in the header file
signal.h
.
Each type of signal is assigned a constant signal number and identified by a macro name. These include the signals listed in Table 1-41.
|
Signal number |
Meaning |
SIGABRT |
Abort: abnormal program termination, as caused
by the |
SIGFPE |
Floating point exception: caused by an overflow, division by 0, or other FPU or emulation errors |
SIGILL |
Illegal instruction: an invalid instruction was encountered in the machine code |
SIGINT |
Interrupt: the break key (e. g., Ctrl-C) was pressed |
SIGSEGV |
Segmentation violation: illegal memory access |
SIGTERM |
Terminate: a request to terminate the program
(in Unix, the standard signal sent by the |
Other signals may be defined depending on the operating system.
-
intraise( intsig); Sends the signal
sigto the program which called the function.-
void ( *signal( intsig, void ( *func)( int )) )( int ); Specifies how the program responds to a signal with the number
sig. The second argument,func, identifies the signal handler. This ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access