关于SIGHUP

1. SIGHUP, http://en.wikipedia.org/wiki/SIGHUP

Signals have always been a convenient method of inter-process communication (IPC), but in early implementations there were no user-definable signals (such as the later additions of SIGUSR1 and SIGUSR1) 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 re-purpose SIGHUP as a signal to re-read configuration files, or reinitialize. This convention survives to this day in packages such as Apache and Sendmail.


2. SIGHUP信号有什么作用,http://bbs.chinaunix.net/thread-774709-1-1.html

一般的作用:比如重写了 apache 配置文件,想不重起 apache 就让配置生效,可以往 apache 进程发一个 HUP 信号

killall -HUP httpd


3. APUE-2e 中对SIGHUP的描述

This signal is commonly used to notify daemon processes (Chapter 13) to reread their configuration files. The reason SIGHUP is chosen for this is that a daemon should not have a controlling terminal and would normally never receive this signal.


从以上描述中笔者推测是因为以前的系统没有提供用户自定义信号 SIGUSR1 和 SIGUSR1 ,而对于一个没有终端的守护进程来说是不可能收到 SIGHUP 信号的,所以就把 SIGHUP 当用户自定义信号使用。


其它参考资料:

搜索"nohup"

你可能感兴趣的:(Linux,Programming)