SIGHUP
SIGHUP is a symbolic signal name used on POSIX compliant platforms, originally designed to notify processes of a serial line drop. SIGHUP is a symbolic constant defined insignal.h.Acoustic_coupler_20041015_175456_1.jpg
| SIGHUP | |
| Description | Hangup. |
|---|---|
| Default Action | Abnormal termination of the process. |
| SA_SIGINFO Macros |
None. |
| Contents |
History
Access to computer systems for many years comprised of connecting a terminal to a mainframe system via a serial line and the RS232 protocol. For this reason, when a system of software interrupts, called signals, were being developed, a signal was designated for use on "Hangup".
SIGHUP would be sent to programs when the serial line was dropped, often because the connected user terminated the connection by hanging up their modem. The system would detect the line was dropped via the lost DCD "Carrier Detect" signal.
Signals have always been a convenient method of IPC, Inter-Process Communication, in early implementations there were no user definable signals (such as the later additions of SIGUSR1 and SIGUSR2) that programs could intercept and interpret for their own purposes. For this reason, applications that did not require a controlling terminal, such as daemons, would "recycle" SIGHUP as a signal to re-read configuration files, or reinitialise. This convention survives to this day in packages such as apache and sendmail.
Modern Usage
With the decline of access via serial line, the meaning of SIGHUP has changed somewhat on modern systems, often meaning a controlling pseudo or virtual terminal has been closed.
If the program receiving the SIGHUP is a UNIX shell, it will often intercept the signal and ensure all stopped programs are continued before sending the signal to child jobs.
The Single UNIX Specification describes a shell utility called nohup, which can be used as a wrapper to start a program immune to SIGHUP.
Different shells also have other methods of controlling and managing SIGHUP, such as the disown facility of GNU bash.
Details
Symbolic signal names are used as signal numbers can vary across platforms, however XSI conformant systems allow the use of the numeric constant 1 to be used to indicate a SIGHUP.
SIGHUP can be handled, that is, programmers can define the action they want to occur on receiving a SIGHUP, such as calling a function, ignoring it, or restoring the default action.
The default action on POSIX compliant sytems is an abnormal termination.
Etymology
SIG- is a common prefix for signal names, the word HUP is a contraction of "Hang up".
See also
| POSIX Signals |
| Reliable Signals |
| SIGABRT | SIGALRM | SIGFPE | SIGHUP | SIGILL | SIGINT | SIGKILL | SIGPIPE | SIGQUIT | SIGSEGV | SIGTERM | SIGUSR1 | SIGUSR2 | SIGCHLD | SIGCONT | SIGSTOP | SIGTSTP | SIGTTIN | SIGTTOU | SIGBUS | SIGPOLL | SIGPROF | SIGSYS | SIGTRAP | SIGURG | SIGVTALRM | SIGXCPU | SIGXFSZ |
| Realtime Signals † |
| SIGRTMIN | SIGRTMAX |
| † realtime signals are user definable, the symbolic realtime signals are simply markers for programmers, eg. SIGRTMIN+n. |
