signal.rst
changeset 1894 2e3bc2435d68
parent 1893 da0024f4f068
child 1895 91e537a35a34
equal deleted inserted replaced
1893:da0024f4f068 1894:2e3bc2435d68
     1 -*- mode: outline; coding: utf-8 -*-
       
     2 
       
     3 * Send signal to process.
       
     4 
       
     5   $ kill -s NAME PID
       
     6 
       
     7 Under C you can use kill(2) system call which will send the specified signal
       
     8 to the process, if permissions allow, or raise(3) library function, which
       
     9 sends the specified signal to the current process.
       
    10 
       
    11 * List of signals.
       
    12 
       
    13   $ kill --list
       
    14   $ kill -l      # short variant
       
    15 
       
    16 See
       
    17 
       
    18   http://en.wikipedia.org/wiki/Unix_signals
       
    19 
       
    20 ** SIGHUP 1.
       
    21 
       
    22 Hangup. Type: notification, can be handled.
       
    23 
       
    24 Sent when assigned to process terminal closed.
       
    25 
       
    26 nohup(1) utility used as a wrapper to start a program and make it immune to
       
    27 SIGHUP.
       
    28 
       
    29 The default action on POSIX-compliant systems is an abnormal termination.
       
    30 
       
    31 Demon used this signal as commant to reread config file.
       
    32 
       
    33 ** SIGINT 2
       
    34 
       
    35 Interrupt. Ctrl-C. Type: control, can be handled.
       
    36 
       
    37 Signal sent to a process by its controlling terminal when a user wishes to
       
    38 interrupt the process.
       
    39 
       
    40 By default, this causes the process to terminate.
       
    41 
       
    42 ** SIGQUIT 3.
       
    43 
       
    44 Quit. Ctrl-\. Type: control.
       
    45 
       
    46 Signal sent to a process by its controlling terminal when the user requests
       
    47 that the process dump core.
       
    48 
       
    49 By default, this causes the process to terminate and produce a memory core dump.
       
    50 
       
    51 Java dump thread traces to stdout.
       
    52 
       
    53 ** SIGILL 4.
       
    54 
       
    55 Illegal instruction. Type: exception, can not be handled.
       
    56 
       
    57 Signal sent to a process when it attempts to execute a malformed, unknown, or
       
    58 privileged instruction.
       
    59 
       
    60 ** SIGTRAP 5.
       
    61 
       
    62 Trace trap. Type: debug, can be handled.
       
    63 
       
    64 Signal sent to a process when a condition arises that a debugger has requested
       
    65 to be informed of.
       
    66 
       
    67 By default this causes abnormal termination of the process.
       
    68 
       
    69 ** SIGABRT 6.
       
    70 
       
    71 Type: control, can be handled.
       
    72 
       
    73 Signal sent to a computer program to tell it to abort, ie terminate.
       
    74 
       
    75 SIGABRT is sent by the process to itself when it calls the abort libc
       
    76 function. It is used when an assertion fails.
       
    77 
       
    78 By default this causes abnormal termination of the process.
       
    79 
       
    80 ** SIGEMT 7.
       
    81 
       
    82 Emt instruction.
       
    83 
       
    84 ** SIGFPE 8.
       
    85 
       
    86 Floating point exception. Type: exception, can be handled.
       
    87 
       
    88 Signal sent to a process when it performs an erroneous arithmetic operation
       
    89 (like division by zero).
       
    90 
       
    91 By default cause a core dump and a program exit.
       
    92 
       
    93 ** SIGKILL 9.
       
    94 
       
    95 Kill. Type: control, can not be handled.
       
    96 
       
    97 Signal sent to a process to cause it to terminate immediately.
       
    98 
       
    99 Zombie processes cannot be killed since they are already dead and waiting for
       
   100 their parent processes to reap them.
       
   101 
       
   102 Processes that are in the blocked state will not die until they wake up again.
       
   103 
       
   104 ** SIGBUS 10.
       
   105 
       
   106 Bus error. Type: exception, can not be handled.
       
   107 
       
   108 Signal sent to a process when it causes a bus error.
       
   109 
       
   110 By default this causes abnormal termination of the process.
       
   111 
       
   112 ** SIGSEGV 11.
       
   113 
       
   114 Segmentation violation. Type: exception.
       
   115 
       
   116 Signal sent to a process when it makes an invalid memory reference, or
       
   117 segmentation fault.
       
   118 
       
   119 By default cause a core dump and a program exit.
       
   120 
       
   121 ** SIGSYS 12.
       
   122 
       
   123 Bad argument to system call. Type: exception.
       
   124 
       
   125 By default this causes abnormal termination of the process.
       
   126 
       
   127 ** SIGPIPE 13.
       
   128 
       
   129 Write on a pipe with no one to read it. Type: notification.
       
   130 
       
   131 Signal sent to a process when it attempts to write to a pipe without a process
       
   132 connected to the other end.
       
   133 
       
   134 This causes the process to terminate, which is convenient when constructing
       
   135 shell pipelines.
       
   136 
       
   137 ** SIGALRM 14.
       
   138 
       
   139 Alarm clock. Type: notification.
       
   140 
       
   141 Signal sent to a process when a time limit has elapsed.
       
   142 
       
   143 By default this causes abnormal termination of the process.
       
   144 
       
   145 ** SIGTERM 15.
       
   146 
       
   147 Software termination signal. Type: control.
       
   148 
       
   149 Signal sent to a process to request its termination.
       
   150 
       
   151 It causes the termination of a process, but unlike the SIGKILL signal, it can
       
   152 be caught and interpreted (or ignored) by the process.
       
   153 
       
   154 SIGTERM is akin to asking a process to terminate nicely, allowing cleanup and
       
   155 closure of files. For this reason, on many Unix systems during shutdown, init
       
   156 issues SIGTERM to all processes that are not essential to powering off, waits
       
   157 a few seconds, and then issues SIGKILL to forcibly terminate any such
       
   158 processes that remain.
       
   159 
       
   160 By default kill(1) send to process SIGTERM signal.
       
   161 
       
   162 ** SIGURG 16.
       
   163 
       
   164 Urgent condition on IO channel. Type: notification.
       
   165 
       
   166 By default this signal ignored.
       
   167 
       
   168 ** SIGSTOP 17.
       
   169 
       
   170 Signal sent to a process to stop it for later resumption. Type: control.
       
   171 
       
   172 SIGSTOP cannot be caught or ignored.
       
   173 
       
   174 Usually SIGSTOP and SIGCONT are used for job control in the Unix shell.
       
   175 
       
   176 ** SIGTSTP 18.
       
   177 
       
   178 Stop signal from tty. Ctrl-Z. Type: control.
       
   179 
       
   180 By default, this causes the process to suspend execution.
       
   181 
       
   182 ** SIGCONT 19.
       
   183 
       
   184 Continue a stopped process. Type: control.
       
   185 
       
   186 Signal sent to restart a process previously paused by the SIGSTOP or SIGTSTP
       
   187 signal.
       
   188 
       
   189 ** SIGCHLD 20.
       
   190 
       
   191 To parent on child stop or exit. Type: notification.
       
   192 
       
   193 By default the signal is simply ignored. In C:
       
   194 
       
   195   signal(SIGCHLD, SIG_IGN);
       
   196 
       
   197 Parent can invoke wait(1) otherwise children stay zombie.
       
   198 
       
   199 ** SIGTTIN 21.
       
   200 
       
   201 Signal sent to a process when it attempts to read from the tty while in the
       
   202 background.
       
   203 
       
   204 Daemons do not have controlling terminals and should never receive this
       
   205 signal.
       
   206 
       
   207 By default this causes suspends of the process.
       
   208 
       
   209 ** SIGTTOU 22.
       
   210 
       
   211 Signal sent to a process when it attempts to write to the tty while in the
       
   212 background.
       
   213 
       
   214 Daemons do not have controlling terminals and should never receive this
       
   215 signal.
       
   216 
       
   217 By default this causes suspends of the process.
       
   218 
       
   219 ** SIGPOLL 23.
       
   220 
       
   221 System V name for SIGIO. Type: notification.
       
   222 
       
   223 Signal sent to a process when an asynchronous I/O event occurs.
       
   224 
       
   225 By default this causes abnormal termination of the process.
       
   226 
       
   227 ** SIGXCPU 24.
       
   228 
       
   229 Exceeded CPU time limit. Type: notification.
       
   230 
       
   231 By default this causes abnormal termination of the process.
       
   232 
       
   233 ** SIGXFSZ 25.
       
   234 
       
   235 Exceeded file size limit as determined by the ulimit system call and shell
       
   236 builtin. Type: notification.
       
   237 
       
   238 By default this causes abnormal termination of the process.
       
   239 
       
   240 ** SIGVTALRM 26.
       
   241 
       
   242 Virtual time alarm. Type: notification.
       
   243 
       
   244 Signal sent to a process when a time limit has elapsed.
       
   245 
       
   246 By default this causes abnormal termination of the process.
       
   247 
       
   248 ** SIGPROF 27.
       
   249 
       
   250 Profiling time alarm. Type: debug.
       
   251 
       
   252 Signal sent to a process when the profiling timer expires.
       
   253 
       
   254 By default this causes abnormal termination of the process.
       
   255 
       
   256 ** SIGWINCH 28.
       
   257 
       
   258 Window changed. Type: notification.
       
   259 
       
   260 Signal sent to a process when its controlling terminal changes size.
       
   261 
       
   262 By default this signal ignored.
       
   263 
       
   264 ** SIGLOST 29.
       
   265 
       
   266 Signal sent to process when a file lock is lost. This may occur, for example,
       
   267 when an NFS server reboots and forgets about a file lock.
       
   268 
       
   269 By default this causes abnormal termination of the process.
       
   270 
       
   271 ** SIGUSR1 30.
       
   272 
       
   273 User defined signal 1. Type: user defined.
       
   274 
       
   275 By default this causes abnormal termination of the process.
       
   276 
       
   277 ** SIGUSR2 31.
       
   278 
       
   279 User defined signal 2. Type: user defined.
       
   280 
       
   281 By default this causes abnormal termination of the process.