signal.rst
changeset 1905 fba288d59662
child 1912 8b81a8f0f692
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/signal.rst	Mon Feb 22 12:46:36 2016 +0200
@@ -0,0 +1,324 @@
+.. -*- coding: utf-8; -*-
+.. include:: HEADER.rst
+
+================
+ Process signal
+================
+.. contents::
+   :local:
+
+Send signal to process
+======================
+
+  $ kill -s NAME PID
+
+Under C you can use kill(2) system call which will send the specified signal
+to the process, if permissions allow, or raise(3) library function, which
+sends the specified signal to the current process.
+
+List of signals
+===============
+
+  $ kill --list
+  $ kill -l      # short variant
+
+See
+
+  http://en.wikipedia.org/wiki/Unix_signals
+
+Signal descriptions
+===================
+
+SIGHUP 1
+--------
+
+Hangup. Type: notification, can be handled.
+
+Sent when assigned to process terminal closed.
+
+nohup(1) utility used as a wrapper to start a program and make it immune to
+SIGHUP.
+
+The default action on POSIX-compliant systems is an abnormal termination.
+
+Demon used this signal as commant to reread config file.
+
+SIGINT
+------
+
+Interrupt. Ctrl-C. Type: control, can be handled.
+
+Signal sent to a process by its controlling terminal when a user wishes to
+interrupt the process.
+
+By default, this causes the process to terminate.
+
+SIGQUIT 3
+---------
+
+Quit. Ctrl-\. Type: control.
+
+Signal sent to a process by its controlling terminal when the user requests
+that the process dump core.
+
+By default, this causes the process to terminate and produce a memory core dump.
+
+Java dump thread traces to stdout.
+
+SIGILL 4
+--------
+
+Illegal instruction. Type: exception, can not be handled.
+
+Signal sent to a process when it attempts to execute a malformed, unknown, or
+privileged instruction.
+
+SIGTRAP 5
+---------
+
+Trace trap. Type: debug, can be handled.
+
+Signal sent to a process when a condition arises that a debugger has requested
+to be informed of.
+
+By default this causes abnormal termination of the process.
+
+SIGABRT 6
+---------
+
+Type: control, can be handled.
+
+Signal sent to a computer program to tell it to abort, ie terminate.
+
+SIGABRT is sent by the process to itself when it calls the abort libc
+function. It is used when an assertion fails.
+
+By default this causes abnormal termination of the process.
+
+SIGEMT 7
+--------
+
+Emt instruction.
+
+SIGFPE 8
+--------
+
+Floating point exception. Type: exception, can be handled.
+
+Signal sent to a process when it performs an erroneous arithmetic operation
+(like division by zero).
+
+By default cause a core dump and a program exit.
+
+SIGKILL 9
+---------
+
+Kill. Type: control, can not be handled.
+
+Signal sent to a process to cause it to terminate immediately.
+
+Zombie processes cannot be killed since they are already dead and waiting for
+their parent processes to reap them.
+
+Processes that are in the blocked state will not die until they wake up again.
+
+SIGBUS 10
+---------
+
+Bus error. Type: exception, can not be handled.
+
+Signal sent to a process when it causes a bus error.
+
+By default this causes abnormal termination of the process.
+
+SIGSEGV 11
+----------
+
+Segmentation violation. Type: exception.
+
+Signal sent to a process when it makes an invalid memory reference, or
+segmentation fault.
+
+By default cause a core dump and a program exit.
+
+SIGSYS 12
+---------
+
+Bad argument to system call. Type: exception.
+
+By default this causes abnormal termination of the process.
+
+SIGPIPE 13
+----------
+
+Write on a pipe with no one to read it. Type: notification.
+
+Signal sent to a process when it attempts to write to a pipe without a process
+connected to the other end.
+
+This causes the process to terminate, which is convenient when constructing
+shell pipelines.
+
+SIGALRM 14
+----------
+
+Alarm clock. Type: notification.
+
+Signal sent to a process when a time limit has elapsed.
+
+By default this causes abnormal termination of the process.
+
+SIGTERM 15
+----------
+
+Software termination signal. Type: control.
+
+Signal sent to a process to request its termination.
+
+It causes the termination of a process, but unlike the SIGKILL signal, it can
+be caught and interpreted (or ignored) by the process.
+
+SIGTERM is akin to asking a process to terminate nicely, allowing cleanup and
+closure of files. For this reason, on many Unix systems during shutdown, init
+issues SIGTERM to all processes that are not essential to powering off, waits
+a few seconds, and then issues SIGKILL to forcibly terminate any such
+processes that remain.
+
+By default kill(1) send to process SIGTERM signal.
+
+SIGURG 16
+---------
+
+Urgent condition on IO channel. Type: notification.
+
+By default this signal ignored.
+
+SIGSTOP 17
+----------
+
+Signal sent to a process to stop it for later resumption. Type: control.
+
+SIGSTOP cannot be caught or ignored.
+
+Usually SIGSTOP and SIGCONT are used for job control in the Unix shell.
+
+SIGTSTP 18
+----------
+
+Stop signal from tty. Ctrl-Z. Type: control.
+
+By default, this causes the process to suspend execution.
+
+SIGCONT 19
+----------
+
+Continue a stopped process. Type: control.
+
+Signal sent to restart a process previously paused by the SIGSTOP or SIGTSTP
+signal.
+
+SIGCHLD 20
+----------
+
+To parent on child stop or exit. Type: notification.
+
+By default the signal is simply ignored. In C:
+
+  signal(SIGCHLD, SIG_IGN);
+
+Parent can invoke wait(1) otherwise children stay zombie.
+
+SIGTTIN 21
+----------
+
+Signal sent to a process when it attempts to read from the tty while in the
+background.
+
+Daemons do not have controlling terminals and should never receive this
+signal.
+
+By default this causes suspends of the process.
+
+SIGTTOU 22
+----------
+
+Signal sent to a process when it attempts to write to the tty while in the
+background.
+
+Daemons do not have controlling terminals and should never receive this
+signal.
+
+By default this causes suspends of the process.
+
+SIGPOLL 23
+----------
+
+System V name for SIGIO. Type: notification.
+
+Signal sent to a process when an asynchronous I/O event occurs.
+
+By default this causes abnormal termination of the process.
+
+SIGXCPU 24
+----------
+
+Exceeded CPU time limit. Type: notification.
+
+By default this causes abnormal termination of the process.
+
+SIGXFSZ 25
+----------
+
+Exceeded file size limit as determined by the ulimit system call and shell
+builtin. Type: notification.
+
+By default this causes abnormal termination of the process.
+
+SIGVTALRM 26
+------------
+
+Virtual time alarm. Type: notification.
+
+Signal sent to a process when a time limit has elapsed.
+
+By default this causes abnormal termination of the process.
+
+SIGPROF 27
+----------
+
+Profiling time alarm. Type: debug.
+
+Signal sent to a process when the profiling timer expires.
+
+By default this causes abnormal termination of the process.
+
+SIGWINCH 28
+-----------
+
+Window changed. Type: notification.
+
+Signal sent to a process when its controlling terminal changes size.
+
+By default this signal ignored.
+
+SIGLOST 29
+----------
+
+Signal sent to process when a file lock is lost. This may occur, for example,
+when an NFS server reboots and forgets about a file lock.
+
+By default this causes abnormal termination of the process.
+
+SIGUSR1 30
+----------
+
+User defined signal 1. Type: user defined.
+
+By default this causes abnormal termination of the process.
+
+SIGUSR2 31
+----------
+
+User defined signal 2. Type: user defined.
+
+By default this causes abnormal termination of the process.