Examples of Signals
SIGABRT - terminate w/core
當 process 要自殺會呼叫 abort(),然後 OS 就會傳 SIGABRT 給該 process
SIGALRM - terminate
我們可以用特定 system call 設定鬧鐘,時間到了 OS 就會傳 SIGALRM
SIGCHLD - ignore
當 child process 死了就會傳 SIGCHLD 給 parent process
SIGCONT - continue/ignore
當 stopped process 收到就會繼續執行
SIGFPE - terminate w/core
- divided by 0
- floating point overflow
- etc.
SIGHUP - terminate
我們沒法像 foreground process 一樣直接用 terminal 和 background process,所以我們可以送 SIGHUP 給這些 background process 告訴他:「我 configuration file 改了,你 reload 一下」
e.g. nginx -s reload
SIGINT - terminate
CTRL-C
SIGIO - terminate/ignore
select 和 poll 就是透過 SIGIO 進行 asynchronous I/O 的
SIGKILL - terminate
殺你,而且不能 ignore 或 catch
SIGPIPE - terminate
當我們寫入 pipe 但 pipe 沒有 reader,那麼 kernel 就會傳 SIGPIPE 給 writer
SIGQUIT - terminate w/core
用 CTRL-\ 觸發,會傳送給所有 foreground process
SIGSEGV - terminate w/core
- invalid memory access
- segmentation fault
SIGTSTP - stop process
當我們在 terminal 按 CTRL-Z 就會傳送 SIGTSTP 給所有 foreground process
SIGSTOP - stop process
SIGTSTP 但不能被 catch 或 ignore
SIGTERM - terminate
SIGKILL 但可以被 catch 及 ignore
SIGURG - ignore
跟 network connection 有關係,好像是很重要的封包傳過來要先處理?
SIGUSR1 - terminate
user-defined
SIGUSR2 - terminate
user-defined