Node:Termination Signals, Next:Alarm Signals, Previous:Program Error Signals, Up:Standard Signals
These signals are all used to tell a process to terminate, in one way or another. They have different names because they're used for slightly different purposes, and programs might want to handle them differently.
The reason for handling these signals is usually so your program can tidy up as appropriate before actually terminating. For example, you might want to save state information, delete temporary files, or restore the previous terminal modes. Such a handler should end by specifying the default action for the signal that happened and then reraising it; this will cause the program to terminate with that signal, as if it had not had a handler. (See Termination in Handler.)
The (obvious) default action for all of these signals is to cause the process to terminate.
int SIGTERM | Macro |
The SIGTERM signal is a generic signal used to cause program
termination. Unlike SIGKILL , this signal can be blocked,
handled, and ignored. It is the normal way to politely ask a program to
terminate.
The shell command |
int SIGINT | Macro |
The SIGINT ("program interrupt") signal is sent when the user
types the INTR character (normally C-c). See Special Characters, for information about terminal driver support for
C-c.
|
int SIGQUIT | Macro |
The SIGQUIT signal is similar to SIGINT , except that it's
controlled by a different key--the QUIT character, usually
C-\--and produces a core dump when it terminates the process,
just like a program error signal. You can think of this as a
program error condition "detected" by the user.
See Program Error Signals, for information about core dumps. See Special Characters, for information about terminal driver support. Certain kinds of cleanups are best omitted in handling |
int SIGKILL | Macro |
The SIGKILL signal is used to cause immediate program termination.
It cannot be handled or ignored, and is therefore always fatal. It is
also not possible to block this signal.
This signal is usually generated only by explicit request. Since it
cannot be handled, you should generate it only as a last resort, after
first trying a less drastic method such as C-c or In fact, if The system will generate |
int SIGHUP | Macro |
The SIGHUP ("hang-up") signal is used to report that the user's
terminal is disconnected, perhaps because a network or telephone
connection was broken. For more information about this, see Control Modes.
This signal is also used to report the termination of the controlling process on a terminal to jobs associated with that session; this termination effectively disconnects all processes in the session from the controlling terminal. For more information, see Termination Internals. |