.\" and Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
.\" <mtk.manpages@gmail.com>
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
.\" Modified Sat Jul 24 17:34:08 1993 by Rik Faith (faith@cs.unc.edu)
.\" Modified Sun Jan 7 01:41:27 1996 by Andries Brouwer (aeb@cwi.nl)
.\" Added section on stop/cont signals interrupting syscalls.
.\" 2008-10-05, mtk: various additions
.\"
-.TH SIGNAL 7 2010-02-03 "Linux" "Linux Programmer's Manual"
+.TH SIGNAL 7 2013-07-30 "Linux" "Linux Programmer's Manual"
.SH NAME
signal \- overview of signals
.SH DESCRIPTION
Linux supports both POSIX reliable signals (hereinafter
"standard signals") and POSIX real-time signals.
-.SS "Signal Dispositions"
+.SS Signal dispositions
Each signal has a current
.IR disposition ,
which determines how the process behaves when it is delivered
.PP
A process can change the disposition of a signal using
.BR sigaction (2)
-or (less portably)
+or
.BR signal (2).
+(The latter is less portable when establishing a signal handler;
+see
+.BR signal (2)
+for details.)
Using these system calls, a process can elect one of the
following behaviors to occur on delivery of the signal:
perform the default action; ignore the signal;
.BR execve (2),
the dispositions of handled signals are reset to the default;
the dispositions of ignored signals are left unchanged.
-.SS Sending a Signal
+.SS Sending a signal
The following system calls and library functions allow
the caller to send a signal:
.TP 16
(This is the system call used to implement
.BR pthread_kill (3).)
.TP
-.BR sigqueue (2)
+.BR sigqueue (3)
Sends a real-time signal with accompanying data to a specified process.
-.SS Waiting for a Signal to be Caught
+.SS Waiting for a signal to be caught
The following system calls suspend execution of the calling process
or thread until a signal is caught
(or an unhandled signal terminates the process):
.BR sigsuspend (2)
Temporarily changes the signal mask (see below) and suspends
execution until one of the unmasked signals is caught.
-.SS Synchronously Accepting a Signal
+.SS Synchronously accepting a signal
Rather than asynchronously catching a signal via a signal handler,
it is possible to synchronously accept the signal, that is,
to block execution until the signal is delivered,
The buffer returned by
.BR read (2)
contains a structure describing the signal.
-.SS "Signal Mask and Pending Signals"
+.SS Signal mask and pending signals
A signal may be
.IR blocked ,
which means that it will not be delivered until it is later unblocked.
initially has an empty pending signal set;
the pending signal set is preserved across an
.BR execve (2).
-.SS "Standard Signals"
+.SS Standard signals
Linux supports the standard signals listed below.
Several signal numbers
are architecture-dependent, as indicated in the "Value" column.
(Where three values are given, the first one is usually valid for
alpha and sparc,
-the middle one for ix86, ia64, ppc, s390, arm and sh,
+the middle one for x86, arm, and most other architectures,
and the last one for mips.
-.\" parisc is a law unto itself
+(Values for parisc are
+.I not
+shown; see the Linux kernel source for signal numbering on that architecture.)
A \- denotes that a signal is absent on the corresponding architecture.)
First the signals described in the original POSIX.1-1990 standard.
SIGCHLD 20,17,18 Ign Child stopped or terminated
SIGCONT 19,18,25 Cont Continue if stopped
SIGSTOP 17,19,23 Stop Stop process
-SIGTSTP 18,20,24 Stop Stop typed at tty
-SIGTTIN 21,21,26 Stop tty input for background process
-SIGTTOU 22,22,27 Stop tty output for background process
+SIGTSTP 18,20,24 Stop Stop typed at terminal
+SIGTTIN 21,21,26 Stop Terminal input for background process
+SIGTTOU 22,22,27 Stop Terminal output for background process
.TE
The signals
and (on architectures other than SPARC and MIPS)
.B SIGBUS
was to terminate the process (without a core dump).
-(On some other Unix systems the default action for
+(On some other UNIX systems the default action for
.BR SIGXCPU " and " SIGXFSZ
is to terminate the process without a core dump.)
Linux 2.4 conforms to the POSIX.1-2001 requirements for these signals,
SIGCLD \-,\-,18 Ign A synonym for \fBSIGCHLD\fP
SIGPWR 29,30,19 Term Power failure (System V)
SIGINFO 29,\-,\- A synonym for \fBSIGPWR\fP
-SIGLOST \-,\-,\- Term File lock lost
+SIGLOST \-,\-,\- Term File lock lost (unused)
SIGWINCH 28,28,20 Ign Window resize signal (4.3BSD, Sun)
SIGUNUSED \-,31,\- Core Synonymous with \fBSIGSYS\fP
.TE
.B SIGEMT
is not specified in POSIX.1-2001, but nevertheless appears
-on most other Unix systems,
+on most other UNIX systems,
where its default action is typically to terminate
the process with a core dump.
.B SIGPWR
(which is not specified in POSIX.1-2001) is typically ignored
-by default on those other Unix systems where it appears.
+by default on those other UNIX systems where it appears.
.B SIGIO
(which is not specified in POSIX.1-2001) is ignored by default
-on several other Unix systems.
+on several other UNIX systems.
Where defined,
.B SIGUNUSED
.\" parisc is the only exception: SIGSYS is 12, SIGUNUSED is 31
.B SIGSYS
on most architectures.
-.SS "Real-time Signals"
+.SS Real-time signals
Linux supports real-time signals as originally defined in the POSIX.1b
real-time extensions (and now included in POSIX.1-2001).
The range of supported real-time signals is defined by the macros
Because the range of available real-time signals varies according
to the glibc threading implementation (and this variation can occur
at run time according to the available kernel and glibc),
-and indeed the range of real-time signals varies across Unix systems,
+and indeed the range of real-time signals varies across UNIX systems,
programs should
.IR "never refer to real-time signals using hard-coded numbers" ,
but instead should always refer to real-time signals using the notation
Unlike standard signals, real-time signals have no predefined meanings:
the entire set of real-time signals can be used for application-defined
purposes.
-(Note, however, that the LinuxThreads implementation uses the first
-three real-time signals.)
.PP
The default action for an unhandled real-time signal is to terminate the
receiving process.
while that signal is currently blocked, then only one instance is queued.
.IP 2. 4
If the signal is sent using
-.BR sigqueue (2),
+.BR sigqueue (3),
an accompanying value (either an integer or a pointer) can be sent
with the signal.
If the receiving process establishes a handler for this signal using the
.B SA_SIGINFO
flag to
-.BR sigaction (2)
+.BR sigaction (2),
then it can obtain this data via the
.I si_value
field of the
signals; see
.BR setrlimit (2)
for further details.
-.SS "Async-signal-safe functions"
+.SS Async-signal-safe functions
.PP
-A signal handling routine established by
-.BR sigaction (2)
-or
-.BR signal (2)
-must be very careful, since processing elsewhere may be interrupted
+A signal handler function must be very careful,
+since processing elsewhere may be interrupted
at some arbitrary point in the execution of the program.
POSIX has the concept of "safe function".
If a signal interrupts the execution of an unsafe function, and
utimes()
.fi
.in
-.SS Interruption of System Calls and Library Functions by Signal Handlers
+.SS Interruption of system calls and library functions by signal handlers
If a signal handler is invoked while a system call or library
function call is blocked, then either:
.IP * 2
.BR SA_RESTART
flag (see
.BR sigaction (2)).
-The details vary across Unix systems;
+The details vary across UNIX systems;
below, the details for Linux.
If a blocked call to one of the following interfaces is interrupted
.BR sleep (3)
function is also never restarted if interrupted by a handler,
but gives a success return: the number of seconds remaining to sleep.
-.SS Interruption of System Calls and Library Functions by Stop Signals
+.SS Interruption of system calls and library functions by stop signals
On Linux, even in the absence of signal handlers,
certain blocking interfaces can fail with the error
.BR EINTR
Linux 2.4 and earlier:
.BR nanosleep (2).
.RE
-.SH "CONFORMING TO"
+.SH CONFORMING TO
POSIX.1, except as noted.
-.SH BUGS
-.B SIGIO
-and
-.B SIGLOST
-have the same value.
-The latter is commented out in the kernel source, but
-the build process of some software still thinks that
-signal 29 is
-.BR SIGLOST .
-.SH "SEE ALSO"
+.\" It must be a *very* long time since this was true:
+.\" .SH BUGS
+.\" .B SIGIO
+.\" and
+.\" .B SIGLOST
+.\" have the same value.
+.\" The latter is commented out in the kernel source, but
+.\" the build process of some software still thinks that
+.\" signal 29 is
+.\" .BR SIGLOST .
+.SH SEE ALSO
.BR kill (1),
.BR getrlimit (2),
.BR kill (2),
.BR killpg (2),
+.BR restart_syscall (2),
+.BR rt_sigqueueinfo (2),
.BR setitimer (2),
.BR setrlimit (2),
.BR sgetmask (2),
.BR signalfd (2),
.BR sigpending (2),
.BR sigprocmask (2),
-.BR sigqueue (2),
.BR sigsuspend (2),
.BR sigwaitinfo (2),
.BR abort (3),
.BR bsd_signal (3),
.BR longjmp (3),
.BR raise (3),
+.BR pthread_sigqueue (3),
+.BR sigqueue (3),
.BR sigset (3),
.BR sigsetops (3),
.BR sigvec (3),
.BR sysv_signal (3),
.BR core (5),
.BR proc (5),
-.BR pthreads (7)
+.BR pthreads (7),
+.BR sigevent (7)
+.SH COLOPHON
+This page is part of release 3.65 of the Linux
+.I man-pages
+project.
+A description of the project,
+and information about reporting bugs,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.