p When a signal is .Em posted
q Dq sent to a process, in general any of several things can happen. If the process has elected to .Em ignore the signal, it is discarded and nothing happens. (Some signals may not be ignored, however.) If the process has elected to .Em block the signal temporarily, delivery is postponed until the process later unblocks that signal. Otherwise, the signal is .Em delivered , meaning that whatever the process is doing is interrupted in order to react to the signal. (Note that processes that are waiting in the kernel must unwind what they are doing for signals to be delivered. This can sometimes be expensive. See .Xr sigaction 2 for further information.)
p If the process has elected to .Em catch the signal, which means that the process has installed a handler to react to the signal in some process-specific way, the kernel arranges for the process's handler logic to be invoked. This is always done in a way that allows the process to resume if desired. (Note, however, that some signals may not be caught.) Otherwise, the default action for the signal is taken. For most signals the default action is to terminate the process and generate a core dump. See the table below. Note that the term .Em delivery is also used for the specific process of arranging for a signal handler to be invoked.
p In general, signals are delivered as soon as they are posted. (Some delays may occur due to scheduling.) However, in some cases a process that has been sleeping in the kernel may need to do slow things as part of unwinding its state; this can sometimes lead to human-perceptible delays.
p Also, some sleep states within the kernel are .Em uninterruptible meaning that signals posted will have no effect until the state clears. These states are supposed to be short-term only, but sometimes kernel bugs make this not the case and one can end up with unkillable processes. Such processes appear in state "D" in .Xr ps 1 . In general the only way to get rid of them is to reboot. (However, when the "wchan" reported is "tstile", it means the process is waiting for some other process to release resources; sometimes if one can find and kill that process the situation is recoverable.) .Ss Signal list The following signals are defined in .Nx :
p
l -column ".Sy SIGVTALRM" 3n "Profiling timer expired blablabla" -compact .It Sy "Symbol" Ta No Ta Sy "Descriptive name"
t Dv SIGHUP Ta 1 Ta "Hangup" t Dv SIGINT Ta 2 Ta "Interrupt" t Dv SIGQUIT Ta 3 Ta "Quit" t Dv SIGILL Ta 4 Ta "Illegal instruction" t Dv SIGTRAP Ta 5 Ta "Trace/BPT trap" t Dv SIGABRT Ta 6 Ta "Abort trap" t Dv SIGEMT Ta 7 Ta "EMT trap" t Dv SIGFPE Ta 8 Ta "Floating point exception" t Dv SIGKILL Ta 9 Ta "Killed" t Dv SIGBUS Ta 10 Ta "Bus error" t Dv SIGSEGV Ta 11 Ta "Segmentation fault" t Dv SIGSYS Ta 12 Ta "Bad system call" t Dv SIGPIPE Ta 13 Ta "Broken pipe" t Dv SIGALRM Ta 14 Ta "Alarm clock" t Dv SIGTERM Ta 15 Ta "Terminated" t Dv SIGURG Ta 16 Ta "Urgent I/O condition" t Dv SIGSTOP Ta 17 Ta "Suspended (signal)" t Dv SIGTSTP Ta 18 Ta "Suspended" t Dv SIGCONT Ta 19 Ta "Continued" t Dv SIGCHLD Ta 20 Ta "Child exited, stopped or continued" t Dv SIGTTIN Ta 21 Ta "Stopped (tty input)" t Dv SIGTTOU Ta 22 Ta "Stopped (tty output)" t Dv SIGIO Ta 23 Ta "I/O possible" t Dv SIGXCPU Ta 24 Ta "CPU time limit exceeded" t Dv SIGXFSZ Ta 25 Ta "File size limit exceeded" t Dv SIGVTALRM Ta 26 Ta "Virtual timer expired" t Dv SIGPROF Ta 27 Ta "Profiling timer expired" t Dv SIGWINCH Ta 28 Ta "Window size changed" t Dv SIGINFO Ta 29 Ta "Information request" t Dv SIGUSR1 Ta 30 Ta "User defined signal 1" t Dv SIGUSR2 Ta 31 Ta "User defined signal 2" t Dv SIGPWR Ta 32 Ta "Power fail/restart" .El
p These are numbered 1 to 32. (There is no signal 0; 0 is a reserved value that can be used as a no-op with some signal operations.)
p
Detailed descriptions of these signals follow.
l -tag -width "aaa" ************
t Dv SIGHUP No (Hangup) This signal is generated by the
.Xr tty 4
driver
to indicate a hangup condition on a process's controlling terminal:
the user has disconnected.
Accordingly, the default action is to terminate the process.
This signal is also used by many daemons,
such as
.Xr inetd 8 ,
as a cue to reload configuration.
The number for
.Dv SIGHUP
is\~1, which is quite well known.
************
t Dv SIGINT No (Interrupt) This signal is generated by the
.Xr tty 4
driver
when the user presses the interrupt character, normally control-C.
The default action is to terminate the process.
The number for
.Dv SIGINT
is\~2.
************
t Dv SIGQUIT No (Quit) This signal is generated by the
.Xr tty 4
driver
when the user presses the quit character, normally control-backspace.
The default action is to terminate the process and dump core.
The number for
.Dv SIGQUIT
is\~3.
************
t Dv SIGILL No (Illegal instruction) This signal is generated synchronously by the kernel when the process
executes an invalid instruction.
The default action is to terminate the process and dump core.
Note: the results of executing an illegal instruction when
.Dv SIGILL
is blocked or ignored are formally unspecified.
The number for
.Dv SIGILL
is\~4.
************
t Dv SIGTRAP No (Trace/BPT trap) This signal is used when a process is being traced
(see
.Xr ptrace 2 )
to indicate that the process has stopped at a breakpoint or after
single-stepping.
It is normally intercepted by the debugger and not exposed to the
debuggee.
The default action is to terminate the process and dump core.
The number for
.Dv SIGTRAP
is\~5.
************
t Dv SIGABRT No (Abort trap) This signal is generated when the
.Xr abort 3
standard library function is called.
The default action is to terminate the process and dump core.
The number for
.Dv SIGABRT
is\~6.
This number was also formerly used for
.Dv SIGIOT ,
which is no longer defined,
as it was specific to the PDP-11 instruction
.Dv iot .
************
t Dv SIGEMT No (EMT trap) In theory this signal is generated when an instruction needs to be
emulated.
XXX expand this -- I don't know, grep isn't helping much and
information seems pretty thin on the ground on the net.
The default action is to terminate the process and dump core.
The number for
.Dv SIGEMT
is\~7.
************
t Dv SIGFPE No (Floating point exception) This signal is generated when an invalid floating point operation is
detected by hardware or by a soft-float library.
The default action is to terminate the process and dump core.
The number for
.Dv SIGFPE
is\~8.
************
t Dv SIGKILL No (Killed) This signal cannot be caught or ignored.
The (unconditional) action is to terminate the process.
It is most often sent by system administrators, but is also generated
by the kernel in response to running completely out of memory and
swap space.
Note that because many processes need to perform cleanup before
exiting, it is usually best (as a user or administrator) to not deploy
.Dv SIGKILL
until a process has failed to respond to other signals.
The number for
.Dv SIGKILL
is\~9, which is extremely well known.
************
t Dv SIGBUS No (Bus error) This signal is generated synchronously by the kernel when the process
performs certain kinds of invalid memory accesses.
The most common cause of
.Dv SIGBUS
is an unaligned memory access; however, on some architectures it may
cover other memory conditions, such as attempts to access memory
belonging to the kernel.
The default action is to terminate the process and dump core.
Note: the results of performing such invalid accesses when
.Dv SIGBUS
is blocked or ignored are formally unspecified.
The number for
.Dv SIGBUS
is\~10.
************
t Dv SIGSEGV No (Segmentation fault) This signal is generated synchronously by the kernel when the process
attempts to access unmapped memory, or access memory in a manner that
the protection settings for that memory region do not permit.
On some architectures other assorted permission or protection errors
also yield
.Dv SIGSEGV .
On
.Nx ,
passing invalid pointers to system calls will yield failure with
.Er EFAULT
but not also
.Dv SIGSEGV .
The default action is to terminate the process and dump core.
Note: the results of an invalid memory access when
.Dv SIGSEGV
is blocked or ignored are formally unspecified.
The number for
.Dv SIGSEGV
is\~11, which is very well known.
************
t Dv SIGSYS No (Bad system call) This signal is generated by the kernel, in addition to failing with
.Er ENOSYS ,
when a system call is made using an invalid system call number.
(This facility was intended to facilitate emulation of system calls.)
The default action is to terminate the process and dump core.
The number for
.Dv SIGSYS
is\~12.
************
t Dv SIGPIPE No (Broken pipe) This signal is generated by the kernel, in addition to failing with
.Er EPIPE ,
when a
.Xr write 2
call or similar is made on a pipe or socket that has been closed and
has no readers.
The default action is to terminate the process.
The number for
.Dv SIGPIPE
is\~13.
************
t Dv SIGALRM No (Alarm clock) This signal is generated by the kernel when a real-time timer expires.
See
.Xr alarm 3 ,
.Xr setitimer 2 ,
and
.Xr timer_settime 2 .
The default action is to terminate the process.
The number for
.Dv SIGALRM
is\~14.
************
t Dv SIGTERM No (Terminated) This signal is the default signal sent by
.Xr kill 1
and represents a user or administrator request that a program shut
down.
It is sent to all processes as part of the
.Xr shutdown 8
procedure.
The default action is to terminate the process.
The number for
.Dv SIGTERM
is\~15.
************
t Dv SIGURG No (Urgent I/O condition) This signal is generated when an ``urgent condition'' exists on a
socket.
In practice this means when
.Xr tcp 4
out-of-band data has arrived.
The default action is to do nothing.
The number for
.Dv SIGU setitimer 2
and
.Xr timer_settime 2 .
The default action is to terminate the process.
The number for
.Dv SIGPROF
is\~27.
************
t Dv SIGWINCH No (Window size changed) This signal is generated by the
.Xr tty 4
driver
when the stored window size of the process's controlling terminal has
changed.
The default action is to do nothing.
The number for
.Dv SIGWINCH
is\~28.
************
t Dv SIGINFO No (Information request) This signal is generated by the
.Xr tty 4
driver
when the user presses the status request character, normally
control-T.
The default action is to do nothing.
The number for
.Dv SIGINFO
is\~29.
************
t Dv SIGUSR1 No (User defined signal 1) This signal is not generated by the system and is made available for
applications to use for their own purposes.
Many daemons use it for restart or reload requests of various types.
The default action is to terminate the process.
The number for
.Dv SIGUSR1
is\~30.
************
t Dv SIGUSR2 No (User defined signal 2) This signal is not generated by the system and is made available for
applications to use for their own purposes.
The default action is to terminate the process.
The number for
.Dv SIGUSR2
is\~31.
************
t Dv SIGPWR No (Power fail/restart) This signal is notionally sent by the kernel or by a privileged
monitor process when an external power failure is detected, and again
when power has been restored.
Currently
.Nx
does not in fact send
.Dv SIGPWR ,
although it is possible to prepare a custom configuration for
.Xr powerd 8
that does so.
The default action is to do nothing.
The number for
.Dv SIGPWR
is\~32.
************
.El
.Ss Shell Interface
Signals may be sent with the
.Xr kill 1
utility, either by number or the symbolic name without the ``SIG'' part.
This utility is built into many shells to allow addressing job control
jobs.
.Ss Program Interface
In C code signals may be sent using
.Xr raise 3 ,
.Xr kill 2 ,
.Xr pthread_kill 3 ,
and some other related functions.
p Signals may be caught or ignored using .Xr sigaction 2 or the simpler .Xr signal 3 , and blocked using .Xr sigprocmask 2 . .Sh STANDARDS The .Dv SIGTRAP , .Dv SIGEMT , .Dv SIGBUS , .Dv SIGSYS , .Dv SIGURG , .Dv SIGIO , .Dv SIGXCPU , .Dv SIGXFSZ , .Dv SIGVTALRM , .Dv SIGPROF , .Dv SIGWINCH , and .Dv SIGINFO signals are long-existing Berkeley extensions, available on most x Ns -derived systems. The .Dv SIGPWR signal comes from System V.
p The remaining signals conform to .St -p1003.1-90 . .Sh HISTORY .Dv SIGPWR was introduced in .Nx 1.4 .