1197 lines
44 KiB
HTML
1197 lines
44 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SIGNAL</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SIGNAL</H1>
|
|
Section: Linux Programmer's Manual (7)<BR>Updated: 2019-08-02<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
signal - overview of signals
|
|
<A NAME="lbAC"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
Linux supports both POSIX reliable signals (hereinafter
|
|
"standard signals") and POSIX real-time signals.
|
|
<A NAME="lbAD"> </A>
|
|
<H3>Signal dispositions</H3>
|
|
|
|
Each signal has a current
|
|
<I>disposition</I>,
|
|
|
|
which determines how the process behaves when it is delivered
|
|
the signal.
|
|
<P>
|
|
|
|
The entries in the "Action" column of the table below specify
|
|
the default disposition for each signal, as follows:
|
|
<DL COMPACT>
|
|
<DT id="1">Term<DD>
|
|
Default action is to terminate the process.
|
|
<DT id="2">Ign<DD>
|
|
Default action is to ignore the signal.
|
|
<DT id="3">Core<DD>
|
|
Default action is to terminate the process and dump core (see
|
|
<B><A HREF="/cgi-bin/man/man2html?5+core">core</A></B>(5)).
|
|
|
|
<DT id="4">Stop<DD>
|
|
Default action is to stop the process.
|
|
<DT id="5">Cont<DD>
|
|
Default action is to continue the process if it is currently stopped.
|
|
</DL>
|
|
<P>
|
|
|
|
A process can change the disposition of a signal using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2)
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?2+signal">signal</A></B>(2).
|
|
|
|
(The latter is less portable when establishing a signal handler;
|
|
see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+signal">signal</A></B>(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;
|
|
or catch the signal with a
|
|
<I>signal handler</I>,
|
|
|
|
a programmer-defined function that is automatically invoked
|
|
when the signal is delivered.
|
|
<P>
|
|
|
|
By default, a signal handler is invoked on the
|
|
normal process stack.
|
|
It is possible to arrange that the signal handler
|
|
uses an alternate stack; see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigaltstack">sigaltstack</A></B>(2)
|
|
|
|
for a discussion of how to do this and when it might be useful.
|
|
<P>
|
|
|
|
The signal disposition is a per-process attribute:
|
|
in a multithreaded application, the disposition of a
|
|
particular signal is the same for all threads.
|
|
<P>
|
|
|
|
A child created via
|
|
<B><A HREF="/cgi-bin/man/man2html?2+fork">fork</A></B>(2)
|
|
|
|
inherits a copy of its parent's signal dispositions.
|
|
During an
|
|
<B><A HREF="/cgi-bin/man/man2html?2+execve">execve</A></B>(2),
|
|
|
|
the dispositions of handled signals are reset to the default;
|
|
the dispositions of ignored signals are left unchanged.
|
|
<A NAME="lbAE"> </A>
|
|
<H3>Sending a signal</H3>
|
|
|
|
The following system calls and library functions allow
|
|
the caller to send a signal:
|
|
<DL COMPACT>
|
|
<DT id="6"><B><A HREF="/cgi-bin/man/man2html?3+raise">raise</A></B>(3)
|
|
|
|
<DD>
|
|
Sends a signal to the calling thread.
|
|
<DT id="7"><B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2)
|
|
|
|
<DD>
|
|
Sends a signal to a specified process,
|
|
to all members of a specified process group,
|
|
or to all processes on the system.
|
|
<DT id="8"><B><A HREF="/cgi-bin/man/man2html?3+killpg">killpg</A></B>(3)
|
|
|
|
<DD>
|
|
Sends a signal to all of the members of a specified process group.
|
|
<DT id="9"><B><A HREF="/cgi-bin/man/man2html?3+pthread_kill">pthread_kill</A></B>(3)
|
|
|
|
<DD>
|
|
Sends a signal to a specified POSIX thread in the same process as
|
|
the caller.
|
|
<DT id="10"><B><A HREF="/cgi-bin/man/man2html?2+tgkill">tgkill</A></B>(2)
|
|
|
|
<DD>
|
|
Sends a signal to a specified thread within a specific process.
|
|
(This is the system call used to implement
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_kill">pthread_kill</A></B>(3).)
|
|
|
|
<DT id="11"><B><A HREF="/cgi-bin/man/man2html?3+sigqueue">sigqueue</A></B>(3)
|
|
|
|
<DD>
|
|
Sends a real-time signal with accompanying data to a specified process.
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Waiting for a signal to be caught</H3>
|
|
|
|
The following system calls suspend execution of the calling
|
|
thread until a signal is caught
|
|
(or an unhandled signal terminates the process):
|
|
<DL COMPACT>
|
|
<DT id="12"><B><A HREF="/cgi-bin/man/man2html?2+pause">pause</A></B>(2)
|
|
|
|
<DD>
|
|
Suspends execution until any signal is caught.
|
|
<DT id="13"><B><A HREF="/cgi-bin/man/man2html?2+sigsuspend">sigsuspend</A></B>(2)
|
|
|
|
<DD>
|
|
Temporarily changes the signal mask (see below) and suspends
|
|
execution until one of the unmasked signals is caught.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Synchronously accepting a signal</H3>
|
|
|
|
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,
|
|
at which point the kernel returns information about the
|
|
signal to the caller.
|
|
There are two general ways to do this:
|
|
<DL COMPACT>
|
|
<DT id="14">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigwaitinfo">sigwaitinfo</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigtimedwait">sigtimedwait</A></B>(2),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigwait">sigwait</A></B>(3)
|
|
|
|
suspend execution until one of the signals in a specified
|
|
set is delivered.
|
|
Each of these calls returns information about the delivered signal.
|
|
<DT id="15">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+signalfd">signalfd</A></B>(2)
|
|
|
|
returns a file descriptor that can be used to read information
|
|
about signals that are delivered to the caller.
|
|
Each
|
|
<B><A HREF="/cgi-bin/man/man2html?2+read">read</A></B>(2)
|
|
|
|
from this file descriptor blocks until one of the signals
|
|
in the set specified in the
|
|
<B><A HREF="/cgi-bin/man/man2html?2+signalfd">signalfd</A></B>(2)
|
|
|
|
call is delivered to the caller.
|
|
The buffer returned by
|
|
<B><A HREF="/cgi-bin/man/man2html?2+read">read</A></B>(2)
|
|
|
|
contains a structure describing the signal.
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Signal mask and pending signals</H3>
|
|
|
|
A signal may be
|
|
<I>blocked</I>,
|
|
|
|
which means that it will not be delivered until it is later unblocked.
|
|
Between the time when it is generated and when it is delivered
|
|
a signal is said to be
|
|
<I>pending</I>.
|
|
|
|
<P>
|
|
|
|
Each thread in a process has an independent
|
|
<I>signal mask</I>,
|
|
|
|
which indicates the set of signals that the thread is currently blocking.
|
|
A thread can manipulate its signal mask using
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_sigmask">pthread_sigmask</A></B>(3).
|
|
|
|
In a traditional single-threaded application,
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigprocmask">sigprocmask</A></B>(2)
|
|
|
|
can be used to manipulate the signal mask.
|
|
<P>
|
|
|
|
A child created via
|
|
<B><A HREF="/cgi-bin/man/man2html?2+fork">fork</A></B>(2)
|
|
|
|
inherits a copy of its parent's signal mask;
|
|
the signal mask is preserved across
|
|
<B><A HREF="/cgi-bin/man/man2html?2+execve">execve</A></B>(2).
|
|
|
|
<P>
|
|
|
|
A signal may be process-directed or thread-directed.
|
|
A process-directed signal is one that is targeted at (and thus pending for)
|
|
the process as a whole.
|
|
A signal may be process-directed
|
|
because it was generated by the kernel for reasons
|
|
other than a hardware exception, or because it was sent using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2)
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigqueue">sigqueue</A></B>(3).
|
|
|
|
A thread-directed signal is one that is targeted at a specific thread.
|
|
A signal may be thread-directed because it was generated as a consequence
|
|
of executing a specific machine-language instruction
|
|
that triggered a hardware exception (e.g.,
|
|
<B>SIGSEGV</B>
|
|
|
|
for an invalid memory access, or
|
|
<B>SIGFPE</B>
|
|
|
|
for a math error), or because it was it was
|
|
targeted at a specific thread using
|
|
interfaces such as
|
|
<B><A HREF="/cgi-bin/man/man2html?2+tgkill">tgkill</A></B>(2)
|
|
|
|
or
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_kill">pthread_kill</A></B>(3).
|
|
|
|
<P>
|
|
|
|
A process-directed signal may be delivered to any one of the
|
|
threads that does not currently have the signal blocked.
|
|
If more than one of the threads has the signal unblocked, then the
|
|
kernel chooses an arbitrary thread to which to deliver the signal.
|
|
<P>
|
|
|
|
A thread can obtain the set of signals that it currently has pending
|
|
using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigpending">sigpending</A></B>(2).
|
|
|
|
This set will consist of the union of the set of pending
|
|
process-directed signals and the set of signals pending for
|
|
the calling thread.
|
|
<P>
|
|
|
|
A child created via
|
|
<B><A HREF="/cgi-bin/man/man2html?2+fork">fork</A></B>(2)
|
|
|
|
initially has an empty pending signal set;
|
|
the pending signal set is preserved across an
|
|
<B><A HREF="/cgi-bin/man/man2html?2+execve">execve</A></B>(2).
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H3>Standard signals</H3>
|
|
|
|
Linux supports the standard signals listed below.
|
|
The second column of the table indicates which standard (if any)
|
|
specified the signal: "P1990" indicates that the signal is described
|
|
in the original POSIX.1-1990 standard;
|
|
"P2001" indicates that the signal was added in SUSv2 and POSIX.1-2001.
|
|
<TABLE>
|
|
<TR VALIGN=top><TD>Signal</TD><TD ALIGN=center>Standard</TD><TD ALIGN=center>Action</TD><TD>Comment<BR></TD></TR>
|
|
<TR VALIGN=top><TD><HR></TD><TD><HR></TD><TD><HR></TD><TD><HR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGALRM</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Term</TD><TD>Timer signal from <B><A HREF="/cgi-bin/man/man2html?2+alarm">alarm</A></B>(2)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGBUS</B></TD><TD ALIGN=center>P2001</TD><TD ALIGN=center>Core</TD><TD>Bus error (bad memory access)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGCHLD</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Ign</TD><TD>Child stopped or terminated<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGCLD</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center>Ign</TD><TD>A synonym for <B>SIGCHLD</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGCONT</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Cont</TD><TD>Continue if stopped<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGEMT</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center>Term</TD><TD>Emulator trap<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGFPE</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Core</TD><TD>Floating-point exception<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGHUP</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Term</TD><TD>Hangup detected on controlling terminal<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B></B></TD><TD ALIGN=center></TD><TD ALIGN=center></TD><TD>or death of controlling process<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGILL</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Core</TD><TD>Illegal Instruction<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGINFO</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center></TD><TD>A synonym for <B>SIGPWR</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGINT</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Term</TD><TD>Interrupt from keyboard<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGIO</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center>Term</TD><TD>I/O now possible (4.2BSD)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGIOT</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center>Core</TD><TD>IOT trap. A synonym for <B>SIGABRT</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGKILL</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Term</TD><TD>Kill signal<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGLOST</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center>Term</TD><TD>File lock lost (unused)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGPIPE</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Term</TD><TD>Broken pipe: write to pipe with no<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B></B></TD><TD ALIGN=center></TD><TD ALIGN=center></TD><TD>readers; see <B><A HREF="/cgi-bin/man/man2html?7+pipe">pipe</A></B>(7)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGPOLL</B></TD><TD ALIGN=center>P2001</TD><TD ALIGN=center>Term</TD><TD>Pollable event (Sys V).<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B></B></TD><TD ALIGN=center></TD><TD ALIGN=center></TD><TD>Synonym for <B>SIGIO</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGPROF</B></TD><TD ALIGN=center>P2001</TD><TD ALIGN=center>Term</TD><TD>Profiling timer expired<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGPWR</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center>Term</TD><TD>Power failure (System V)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGQUIT</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Core</TD><TD>Quit from keyboard<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGSEGV</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Core</TD><TD>Invalid memory reference<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGSTKFLT</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center>Term</TD><TD>Stack fault on coprocessor (unused)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGSTOP</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Stop</TD><TD>Stop process<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGTSTP</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Stop</TD><TD>Stop typed at terminal<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGSYS</B></TD><TD ALIGN=center>P2001</TD><TD ALIGN=center>Core</TD><TD>Bad system call (SVr4);<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B></B></TD><TD ALIGN=center></TD><TD ALIGN=center></TD><TD>see also <B><A HREF="/cgi-bin/man/man2html?2+seccomp">seccomp</A></B>(2)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGTERM</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Term</TD><TD>Termination signal<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGTRAP</B></TD><TD ALIGN=center>P2001</TD><TD ALIGN=center>Core</TD><TD>Trace/breakpoint trap<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGTTIN</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Stop</TD><TD>Terminal input for background process<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGTTOU</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Stop</TD><TD>Terminal output for background process<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGUNUSED</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center>Core</TD><TD>Synonymous with <B>SIGSYS</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGURG</B></TD><TD ALIGN=center>P2001</TD><TD ALIGN=center>Ign</TD><TD>Urgent condition on socket (4.2BSD)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGUSR1</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Term</TD><TD>User-defined signal 1<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGUSR2</B></TD><TD ALIGN=center>P1990</TD><TD ALIGN=center>Term</TD><TD>User-defined signal 2<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGVTALRM</B></TD><TD ALIGN=center>P2001</TD><TD ALIGN=center>Term</TD><TD>Virtual alarm clock (4.2BSD)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGXCPU</B></TD><TD ALIGN=center>P2001</TD><TD ALIGN=center>Core</TD><TD>CPU time limit exceeded (4.2BSD);<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B></B></TD><TD ALIGN=center></TD><TD ALIGN=center></TD><TD>see <B><A HREF="/cgi-bin/man/man2html?2+setrlimit">setrlimit</A></B>(2)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGXFSZ</B></TD><TD ALIGN=center>P2001</TD><TD ALIGN=center>Core</TD><TD>File size limit exceeded (4.2BSD);<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B></B></TD><TD ALIGN=center></TD><TD ALIGN=center></TD><TD>see <B><A HREF="/cgi-bin/man/man2html?2+setrlimit">setrlimit</A></B>(2)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGWINCH</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center>Ign</TD><TD>Window resize signal (4.3BSD, Sun)<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
|
|
The signals
|
|
<B>SIGKILL</B>
|
|
|
|
and
|
|
<B>SIGSTOP</B>
|
|
|
|
cannot be caught, blocked, or ignored.
|
|
<P>
|
|
|
|
Up to and including Linux 2.2, the default behavior for
|
|
<B>SIGSYS</B>, <B>SIGXCPU</B>, <B>SIGXFSZ</B>,
|
|
|
|
and (on architectures other than SPARC and MIPS)
|
|
<B>SIGBUS</B>
|
|
|
|
was to terminate the process (without a core dump).
|
|
(On some other UNIX systems the default action for
|
|
<B>SIGXCPU</B> and <B>SIGXFSZ</B>
|
|
|
|
is to terminate the process without a core dump.)
|
|
Linux 2.4 conforms to the POSIX.1-2001 requirements for these signals,
|
|
terminating the process with a core dump.
|
|
<P>
|
|
|
|
<P>
|
|
|
|
<B>SIGEMT</B>
|
|
|
|
is not specified in POSIX.1-2001, but nevertheless appears
|
|
on most other UNIX systems,
|
|
where its default action is typically to terminate
|
|
the process with a core dump.
|
|
<P>
|
|
|
|
<B>SIGPWR</B>
|
|
|
|
(which is not specified in POSIX.1-2001) is typically ignored
|
|
by default on those other UNIX systems where it appears.
|
|
<P>
|
|
|
|
<B>SIGIO</B>
|
|
|
|
(which is not specified in POSIX.1-2001) is ignored by default
|
|
on several other UNIX systems.
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H3>Queueing and delivery semantics for standard signals</H3>
|
|
|
|
If multiple standard signals are pending for a process,
|
|
the order in which the signals are delivered is unspecified.
|
|
<P>
|
|
|
|
Standard signals do not queue.
|
|
If multiple instances of a standard signal are generated while
|
|
that signal is blocked,
|
|
then only one instance of the signal is marked as pending
|
|
(and the signal will be delivered just once when it is unblocked).
|
|
In the case where a standard signal is already pending, the
|
|
<I>siginfo_t</I>
|
|
|
|
structure (see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2))
|
|
|
|
associated with that signal is not overwritten
|
|
on arrival of subsequent instances of the same signal.
|
|
Thus, the process will receive the information
|
|
associated with the first instance of the signal.
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H3>Signal numbering for standard signals</H3>
|
|
|
|
The numeric value for each signal is given in the table below.
|
|
As shown in the table, many signals have different numeric values
|
|
on different architectures.
|
|
The first numeric value in each table row shows the signal number
|
|
on x86, ARM, and most other architectures;
|
|
the second value is for Alpha and SPARC; the third is for MIPS;
|
|
and the last is for PARISC.
|
|
A dash (-) denotes that a signal is absent on the corresponding architecture.
|
|
<TABLE>
|
|
<TR VALIGN=top><TD>Signal</TD><TD ALIGN=center>x86/ARM</TD><TD ALIGN=center>Alpha/</TD><TD ALIGN=center>MIPS</TD><TD ALIGN=center>PARISC</TD><TD>Notes<BR></TD></TR>
|
|
<TR VALIGN=top><TD></TD><TD ALIGN=center>most others</TD><TD ALIGN=center>SPARC</TD><TD ALIGN=center></TD><TD ALIGN=center></TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><HR></TD><TD><HR></TD><TD><HR></TD><TD><HR></TD><TD><HR></TD><TD><HR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGINT</B></TD><TD ALIGN=center> 2</TD><TD ALIGN=center> 2</TD><TD ALIGN=center> 2</TD><TD ALIGN=center> 2</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGQUIT</B></TD><TD ALIGN=center> 3</TD><TD ALIGN=center> 3</TD><TD ALIGN=center> 3</TD><TD ALIGN=center> 3</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGILL</B></TD><TD ALIGN=center> 4</TD><TD ALIGN=center> 4</TD><TD ALIGN=center> 4</TD><TD ALIGN=center> 4</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGTRAP</B></TD><TD ALIGN=center> 5</TD><TD ALIGN=center> 5</TD><TD ALIGN=center> 5</TD><TD ALIGN=center> 5</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGABRT</B></TD><TD ALIGN=center> 6</TD><TD ALIGN=center> 6</TD><TD ALIGN=center> 6</TD><TD ALIGN=center> 6</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGIOT</B></TD><TD ALIGN=center> 6</TD><TD ALIGN=center> 6</TD><TD ALIGN=center> 6</TD><TD ALIGN=center> 6</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGBUS</B></TD><TD ALIGN=center> 7</TD><TD ALIGN=center>10</TD><TD ALIGN=center>10</TD><TD ALIGN=center>10</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGEMT</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center> 7</TD><TD ALIGN=center> 7</TD><TD ALIGN=center>-</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGFPE</B></TD><TD ALIGN=center> 8</TD><TD ALIGN=center> 8</TD><TD ALIGN=center> 8</TD><TD ALIGN=center> 8</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGKILL</B></TD><TD ALIGN=center> 9</TD><TD ALIGN=center> 9</TD><TD ALIGN=center> 9</TD><TD ALIGN=center> 9</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGUSR1</B></TD><TD ALIGN=center>10</TD><TD ALIGN=center>30</TD><TD ALIGN=center>16</TD><TD ALIGN=center>16</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGSEGV</B></TD><TD ALIGN=center>11</TD><TD ALIGN=center>11</TD><TD ALIGN=center>11</TD><TD ALIGN=center>11</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGUSR2</B></TD><TD ALIGN=center>12</TD><TD ALIGN=center>31</TD><TD ALIGN=center>17</TD><TD ALIGN=center>17</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGPIPE</B></TD><TD ALIGN=center>13</TD><TD ALIGN=center>13</TD><TD ALIGN=center>13</TD><TD ALIGN=center>13</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGALRM</B></TD><TD ALIGN=center>14</TD><TD ALIGN=center>14</TD><TD ALIGN=center>14</TD><TD ALIGN=center>14</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGTERM</B></TD><TD ALIGN=center>15</TD><TD ALIGN=center>15</TD><TD ALIGN=center>15</TD><TD ALIGN=center>15</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGSTKFLT</B></TD><TD ALIGN=center>16</TD><TD ALIGN=center>-</TD><TD ALIGN=center>-</TD><TD ALIGN=center> 7</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGCHLD</B></TD><TD ALIGN=center>17</TD><TD ALIGN=center>20</TD><TD ALIGN=center>18</TD><TD ALIGN=center>18</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGCLD</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center>-</TD><TD ALIGN=center>18</TD><TD ALIGN=center>-</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGCONT</B></TD><TD ALIGN=center>18</TD><TD ALIGN=center>19</TD><TD ALIGN=center>25</TD><TD ALIGN=center>26</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGSTOP</B></TD><TD ALIGN=center>19</TD><TD ALIGN=center>17</TD><TD ALIGN=center>23</TD><TD ALIGN=center>24</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGTSTP</B></TD><TD ALIGN=center>20</TD><TD ALIGN=center>18</TD><TD ALIGN=center>24</TD><TD ALIGN=center>25</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGTTIN</B></TD><TD ALIGN=center>21</TD><TD ALIGN=center>21</TD><TD ALIGN=center>26</TD><TD ALIGN=center>27</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGTTOU</B></TD><TD ALIGN=center>22</TD><TD ALIGN=center>22</TD><TD ALIGN=center>27</TD><TD ALIGN=center>28</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGURG</B></TD><TD ALIGN=center>23</TD><TD ALIGN=center>16</TD><TD ALIGN=center>21</TD><TD ALIGN=center>29</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGXCPU</B></TD><TD ALIGN=center>24</TD><TD ALIGN=center>24</TD><TD ALIGN=center>30</TD><TD ALIGN=center>12</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGXFSZ</B></TD><TD ALIGN=center>25</TD><TD ALIGN=center>25</TD><TD ALIGN=center>31</TD><TD ALIGN=center>30</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGVTALRM</B></TD><TD ALIGN=center>26</TD><TD ALIGN=center>26</TD><TD ALIGN=center>28</TD><TD ALIGN=center>20</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGPROF</B></TD><TD ALIGN=center>27</TD><TD ALIGN=center>27</TD><TD ALIGN=center>29</TD><TD ALIGN=center>21</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGWINCH</B></TD><TD ALIGN=center>28</TD><TD ALIGN=center>28</TD><TD ALIGN=center>20</TD><TD ALIGN=center>23</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGIO</B></TD><TD ALIGN=center>29</TD><TD ALIGN=center>23</TD><TD ALIGN=center>22</TD><TD ALIGN=center>22</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGPOLL</B></TD><TD ALIGN=center></TD><TD ALIGN=center></TD><TD ALIGN=center></TD><TD ALIGN=center></TD><TD>Same as SIGIO<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGPWR</B></TD><TD ALIGN=center>30</TD><TD ALIGN=center>29/-</TD><TD ALIGN=center>19</TD><TD ALIGN=center>19</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGINFO</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center>29/-</TD><TD ALIGN=center>-</TD><TD ALIGN=center>-</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGLOST</B></TD><TD ALIGN=center>-</TD><TD ALIGN=center>-/29</TD><TD ALIGN=center>-</TD><TD ALIGN=center>-</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGSYS</B></TD><TD ALIGN=center>31</TD><TD ALIGN=center>12</TD><TD ALIGN=center>12</TD><TD ALIGN=center>31</TD><TD><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B>SIGUNUSED</B></TD><TD ALIGN=center>31</TD><TD ALIGN=center>-</TD><TD ALIGN=center>-</TD><TD ALIGN=center>31</TD><TD><BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
|
|
Note the following:
|
|
<DL COMPACT>
|
|
<DT id="16">*<DD>
|
|
Where defined,
|
|
<B>SIGUNUSED</B>
|
|
|
|
is synonymous with
|
|
<B>SIGSYS</B>.
|
|
|
|
Since glibc 2.26,
|
|
<B>SIGUNUSED</B>
|
|
|
|
is no longer defined on any architecture.
|
|
<DT id="17">*<DD>
|
|
Signal 29 is
|
|
<B>SIGINFO</B>/<B>SIGPWR</B>
|
|
|
|
(synonyms for the same value) on Alpha but
|
|
<B>SIGLOST</B>
|
|
|
|
on SPARC.
|
|
|
|
</DL>
|
|
<A NAME="lbAL"> </A>
|
|
<H3>Real-time signals</H3>
|
|
|
|
Starting with version 2.2,
|
|
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
|
|
<B>SIGRTMIN</B>
|
|
|
|
and
|
|
<B>SIGRTMAX</B>.
|
|
|
|
POSIX.1-2001 requires that an implementation support at least
|
|
<B>_POSIX_RTSIG_MAX</B>
|
|
|
|
(8) real-time signals.
|
|
<P>
|
|
|
|
The Linux kernel supports a range of 33 different real-time
|
|
signals, numbered 32 to 64.
|
|
However, the glibc POSIX threads implementation internally uses
|
|
two (for NPTL) or three (for LinuxThreads) real-time signals
|
|
(see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+pthreads">pthreads</A></B>(7)),
|
|
|
|
and adjusts the value of
|
|
<B>SIGRTMIN</B>
|
|
|
|
suitably (to 34 or 35).
|
|
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,
|
|
programs should
|
|
<I>never refer to real-time signals using hard-coded numbers</I>,
|
|
|
|
but instead should always refer to real-time signals using the notation
|
|
<B>SIGRTMIN</B>+n,
|
|
|
|
and include suitable (run-time) checks that
|
|
<B>SIGRTMIN</B>+n
|
|
|
|
does not exceed
|
|
<B>SIGRTMAX</B>.
|
|
|
|
<P>
|
|
|
|
Unlike standard signals, real-time signals have no predefined meanings:
|
|
the entire set of real-time signals can be used for application-defined
|
|
purposes.
|
|
<P>
|
|
|
|
The default action for an unhandled real-time signal is to terminate the
|
|
receiving process.
|
|
<P>
|
|
|
|
Real-time signals are distinguished by the following:
|
|
<DL COMPACT>
|
|
<DT id="18">1.<DD>
|
|
Multiple instances of real-time signals can be queued.
|
|
By contrast, if multiple instances of a standard signal are delivered
|
|
while that signal is currently blocked, then only one instance is queued.
|
|
<DT id="19">2.<DD>
|
|
If the signal is sent using
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigqueue">sigqueue</A></B>(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</B>
|
|
|
|
flag to
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2),
|
|
|
|
then it can obtain this data via the
|
|
<I>si_value</I>
|
|
|
|
field of the
|
|
<I>siginfo_t</I>
|
|
|
|
structure passed as the second argument to the handler.
|
|
Furthermore, the
|
|
<I>si_pid</I>
|
|
|
|
and
|
|
<I>si_uid</I>
|
|
|
|
fields of this structure can be used to obtain the PID
|
|
and real user ID of the process sending the signal.
|
|
<DT id="20">3.<DD>
|
|
Real-time signals are delivered in a guaranteed order.
|
|
Multiple real-time signals of the same type are delivered in the order
|
|
they were sent.
|
|
If different real-time signals are sent to a process, they are delivered
|
|
starting with the lowest-numbered signal.
|
|
(I.e., low-numbered signals have highest priority.)
|
|
By contrast, if multiple standard signals are pending for a process,
|
|
the order in which they are delivered is unspecified.
|
|
</DL>
|
|
<P>
|
|
|
|
If both standard and real-time signals are pending for a process,
|
|
POSIX leaves it unspecified which is delivered first.
|
|
Linux, like many other implementations, gives priority
|
|
to standard signals in this case.
|
|
<P>
|
|
|
|
According to POSIX, an implementation should permit at least
|
|
<B>_POSIX_SIGQUEUE_MAX</B>
|
|
|
|
(32) real-time signals to be queued to
|
|
a process.
|
|
However, Linux does things differently.
|
|
In kernels up to and including 2.6.7, Linux imposes
|
|
a system-wide limit on the number of queued real-time signals
|
|
for all processes.
|
|
This limit can be viewed and (with privilege) changed via the
|
|
<I>/proc/sys/kernel/rtsig-max</I>
|
|
|
|
file.
|
|
A related file,
|
|
<I>/proc/sys/kernel/rtsig-nr</I>,
|
|
|
|
can be used to find out how many real-time signals are currently queued.
|
|
In Linux 2.6.8, these
|
|
<I>/proc</I>
|
|
|
|
interfaces were replaced by the
|
|
<B>RLIMIT_SIGPENDING</B>
|
|
|
|
resource limit, which specifies a per-user limit for queued
|
|
signals; see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setrlimit">setrlimit</A></B>(2)
|
|
|
|
for further details.
|
|
<P>
|
|
|
|
The addition of real-time signals required the widening
|
|
of the signal set structure
|
|
(<I>sigset_t</I>)
|
|
|
|
from 32 to 64 bits.
|
|
Consequently, various system calls were superseded by new system calls
|
|
that supported the larger signal sets.
|
|
The old and new system calls are as follows:
|
|
<TABLE>
|
|
<TR VALIGN=top><TD><B>Linux 2.0 and earlier</B></TD><TD><B>Linux 2.2 and later</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD><B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2)</TD><TD><B><A HREF="/cgi-bin/man/man2html?2+rt_sigaction">rt_sigaction</A></B>(2)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B><A HREF="/cgi-bin/man/man2html?2+sigpending">sigpending</A></B>(2)</TD><TD><B><A HREF="/cgi-bin/man/man2html?2+rt_sigpending">rt_sigpending</A></B>(2)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B><A HREF="/cgi-bin/man/man2html?2+sigprocmask">sigprocmask</A></B>(2)</TD><TD><B><A HREF="/cgi-bin/man/man2html?2+rt_sigprocmask">rt_sigprocmask</A></B>(2)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B><A HREF="/cgi-bin/man/man2html?2+sigreturn">sigreturn</A></B>(2)</TD><TD><B><A HREF="/cgi-bin/man/man2html?2+rt_sigreturn">rt_sigreturn</A></B>(2)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B><A HREF="/cgi-bin/man/man2html?2+sigsuspend">sigsuspend</A></B>(2)</TD><TD><B><A HREF="/cgi-bin/man/man2html?2+rt_sigsuspend">rt_sigsuspend</A></B>(2)<BR></TD></TR>
|
|
<TR VALIGN=top><TD><B><A HREF="/cgi-bin/man/man2html?2+sigtimedwait">sigtimedwait</A></B>(2)</TD><TD><B><A HREF="/cgi-bin/man/man2html?2+rt_sigtimedwait">rt_sigtimedwait</A></B>(2)<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
|
|
<A NAME="lbAM"> </A>
|
|
<H3>Interruption of system calls and library functions by signal handlers</H3>
|
|
|
|
If a signal handler is invoked while a system call or library
|
|
function call is blocked, then either:
|
|
<DL COMPACT>
|
|
<DT id="21">*<DD>
|
|
the call is automatically restarted after the signal handler returns; or
|
|
<DT id="22">*<DD>
|
|
the call fails with the error
|
|
<B>EINTR</B>.
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
Which of these two behaviors occurs depends on the interface and
|
|
whether or not the signal handler was established using the
|
|
<B>SA_RESTART</B>
|
|
|
|
flag (see
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2)).
|
|
|
|
The details vary across UNIX systems;
|
|
below, the details for Linux.
|
|
<P>
|
|
|
|
If a blocked call to one of the following interfaces is interrupted
|
|
by a signal handler, then the call is automatically restarted
|
|
after the signal handler returns if the
|
|
<B>SA_RESTART</B>
|
|
|
|
flag was used; otherwise the call fails with the error
|
|
<B>EINTR</B>:
|
|
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="23">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+read">read</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+readv">readv</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+write">write</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+writev">writev</A></B>(2),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+ioctl">ioctl</A></B>(2)
|
|
|
|
calls on "slow" devices.
|
|
A "slow" device is one where the I/O call may block for an
|
|
indefinite time, for example, a terminal, pipe, or socket.
|
|
If an I/O call on a slow device has already transferred some
|
|
data by the time it is interrupted by a signal handler,
|
|
then the call will return a success status
|
|
(normally, the number of bytes transferred).
|
|
Note that a (local) disk is not a slow device according to this definition;
|
|
I/O operations on disk devices are not interrupted by signals.
|
|
<DT id="24">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2),
|
|
|
|
if it can block (e.g., when opening a FIFO; see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+fifo">fifo</A></B>(7)).
|
|
|
|
<DT id="25">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+wait">wait</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+wait3">wait3</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+wait4">wait4</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+waitid">waitid</A></B>(2),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+waitpid">waitpid</A></B>(2).
|
|
|
|
<DT id="26">*<DD>
|
|
Socket interfaces:
|
|
|
|
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+accept">accept</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+connect">connect</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+recv">recv</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+recvfrom">recvfrom</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+recvmmsg">recvmmsg</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+recvmsg">recvmsg</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+send">send</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sendto">sendto</A></B>(2),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sendmsg">sendmsg</A></B>(2),
|
|
|
|
|
|
unless a timeout has been set on the socket (see below).
|
|
<DT id="27">*<DD>
|
|
File locking interfaces:
|
|
<B><A HREF="/cgi-bin/man/man2html?2+flock">flock</A></B>(2)
|
|
|
|
and
|
|
the
|
|
<B>F_SETLKW</B>
|
|
|
|
and
|
|
<B>F_OFD_SETLKW</B>
|
|
|
|
operations of
|
|
<B><A HREF="/cgi-bin/man/man2html?2+fcntl">fcntl</A></B>(2)
|
|
|
|
<DT id="28">*<DD>
|
|
POSIX message queue interfaces:
|
|
<B><A HREF="/cgi-bin/man/man2html?3+mq_receive">mq_receive</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+mq_timedreceive">mq_timedreceive</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+mq_send">mq_send</A></B>(3),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?3+mq_timedsend">mq_timedsend</A></B>(3).
|
|
|
|
<DT id="29">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+futex">futex</A></B>(2)
|
|
|
|
<B>FUTEX_WAIT</B>
|
|
|
|
(since Linux 2.6.22;
|
|
|
|
beforehand, always failed with
|
|
<B>EINTR</B>).
|
|
|
|
<DT id="30">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+getrandom">getrandom</A></B>(2).
|
|
|
|
<DT id="31">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_mutex_lock">pthread_mutex_lock</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_cond_wait">pthread_cond_wait</A></B>(3),
|
|
|
|
and related APIs.
|
|
<DT id="32">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+futex">futex</A></B>(2)
|
|
|
|
<B>FUTEX_WAIT_BITSET</B>.
|
|
|
|
<DT id="33">*<DD>
|
|
POSIX semaphore interfaces:
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sem_wait">sem_wait</A></B>(3)
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sem_timedwait">sem_timedwait</A></B>(3)
|
|
|
|
(since Linux 2.6.22;
|
|
|
|
beforehand, always failed with
|
|
<B>EINTR</B>).
|
|
|
|
<DT id="34">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+read">read</A></B>(2)
|
|
|
|
from an
|
|
<B><A HREF="/cgi-bin/man/man2html?7+inotify">inotify</A></B>(7)
|
|
|
|
file descriptor
|
|
(since Linux 3.8;
|
|
|
|
beforehand, always failed with
|
|
<B>EINTR</B>).
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
The following interfaces are never restarted after
|
|
being interrupted by a signal handler,
|
|
regardless of the use of
|
|
<B>SA_RESTART</B>;
|
|
|
|
they always fail with the error
|
|
<B>EINTR</B>
|
|
|
|
when interrupted by a signal handler:
|
|
|
|
|
|
<DL COMPACT>
|
|
<DT id="35">*<DD>
|
|
"Input" socket interfaces, when a timeout
|
|
(<B>SO_RCVTIMEO</B>)
|
|
|
|
has been set on the socket using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setsockopt">setsockopt</A></B>(2):
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+accept">accept</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+recv">recv</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+recvfrom">recvfrom</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+recvmmsg">recvmmsg</A></B>(2)
|
|
|
|
(also with a non-NULL
|
|
<I>timeout</I>
|
|
|
|
argument),
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+recvmsg">recvmsg</A></B>(2).
|
|
|
|
<DT id="36">*<DD>
|
|
"Output" socket interfaces, when a timeout
|
|
(<B>SO_RCVTIMEO</B>)
|
|
|
|
has been set on the socket using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setsockopt">setsockopt</A></B>(2):
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+connect">connect</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+send">send</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sendto">sendto</A></B>(2),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sendmsg">sendmsg</A></B>(2).
|
|
|
|
|
|
<DT id="37">*<DD>
|
|
Interfaces used to wait for signals:
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pause">pause</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigsuspend">sigsuspend</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigtimedwait">sigtimedwait</A></B>(2),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigwaitinfo">sigwaitinfo</A></B>(2).
|
|
|
|
<DT id="38">*<DD>
|
|
File descriptor multiplexing interfaces:
|
|
<B><A HREF="/cgi-bin/man/man2html?2+epoll_wait">epoll_wait</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+epoll_pwait">epoll_pwait</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+poll">poll</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+ppoll">ppoll</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+select">select</A></B>(2),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pselect">pselect</A></B>(2).
|
|
|
|
<DT id="39">*<DD>
|
|
System V IPC interfaces:
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+msgrcv">msgrcv</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+msgsnd">msgsnd</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+semop">semop</A></B>(2),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+semtimedop">semtimedop</A></B>(2).
|
|
|
|
<DT id="40">*<DD>
|
|
Sleep interfaces:
|
|
<B><A HREF="/cgi-bin/man/man2html?2+clock_nanosleep">clock_nanosleep</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+nanosleep">nanosleep</A></B>(2),
|
|
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?3+usleep">usleep</A></B>(3).
|
|
|
|
<DT id="41">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+io_getevents">io_getevents</A></B>(2).
|
|
|
|
</DL>
|
|
<P>
|
|
|
|
The
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sleep">sleep</A></B>(3)
|
|
|
|
function is also never restarted if interrupted by a handler,
|
|
but gives a success return: the number of seconds remaining to sleep.
|
|
<A NAME="lbAN"> </A>
|
|
<H3>Interruption of system calls and library functions by stop signals</H3>
|
|
|
|
On Linux, even in the absence of signal handlers,
|
|
certain blocking interfaces can fail with the error
|
|
<B>EINTR</B>
|
|
|
|
after the process is stopped by one of the stop signals
|
|
and then resumed via
|
|
<B>SIGCONT</B>.
|
|
|
|
This behavior is not sanctioned by POSIX.1, and doesn't occur
|
|
on other systems.
|
|
<P>
|
|
|
|
The Linux interfaces that display this behavior are:
|
|
<DL COMPACT>
|
|
<DT id="42">*<DD>
|
|
"Input" socket interfaces, when a timeout
|
|
(<B>SO_RCVTIMEO</B>)
|
|
|
|
has been set on the socket using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setsockopt">setsockopt</A></B>(2):
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+accept">accept</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+recv">recv</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+recvfrom">recvfrom</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+recvmmsg">recvmmsg</A></B>(2)
|
|
|
|
(also with a non-NULL
|
|
<I>timeout</I>
|
|
|
|
argument),
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+recvmsg">recvmsg</A></B>(2).
|
|
|
|
<DT id="43">*<DD>
|
|
"Output" socket interfaces, when a timeout
|
|
(<B>SO_RCVTIMEO</B>)
|
|
|
|
has been set on the socket using
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setsockopt">setsockopt</A></B>(2):
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+connect">connect</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+send">send</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sendto">sendto</A></B>(2),
|
|
|
|
and
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sendmsg">sendmsg</A></B>(2),
|
|
|
|
if a send timeout
|
|
(<B>SO_SNDTIMEO</B>)
|
|
|
|
has been set.
|
|
<DT id="44">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+epoll_wait">epoll_wait</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+epoll_pwait">epoll_pwait</A></B>(2).
|
|
|
|
<DT id="45">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+semop">semop</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+semtimedop">semtimedop</A></B>(2).
|
|
|
|
<DT id="46">*<DD>
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigtimedwait">sigtimedwait</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigwaitinfo">sigwaitinfo</A></B>(2).
|
|
|
|
<DT id="47">*<DD>
|
|
Linux 3.7 and earlier:
|
|
<B><A HREF="/cgi-bin/man/man2html?2+read">read</A></B>(2)
|
|
|
|
from an
|
|
<B><A HREF="/cgi-bin/man/man2html?7+inotify">inotify</A></B>(7)
|
|
|
|
file descriptor
|
|
|
|
<DT id="48">*<DD>
|
|
Linux 2.6.21 and earlier:
|
|
<B><A HREF="/cgi-bin/man/man2html?2+futex">futex</A></B>(2)
|
|
|
|
<B>FUTEX_WAIT</B>,
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sem_timedwait">sem_timedwait</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sem_wait">sem_wait</A></B>(3).
|
|
|
|
<DT id="49">*<DD>
|
|
Linux 2.6.8 and earlier:
|
|
<B><A HREF="/cgi-bin/man/man2html?2+msgrcv">msgrcv</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+msgsnd">msgsnd</A></B>(2).
|
|
|
|
<DT id="50">*<DD>
|
|
Linux 2.4 and earlier:
|
|
<B><A HREF="/cgi-bin/man/man2html?2+nanosleep">nanosleep</A></B>(2).
|
|
|
|
</DL>
|
|
<A NAME="lbAO"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
POSIX.1, except as noted.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAP"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
For a discussion of async-signal-safe functions, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+signal-safety">signal-safety</A></B>(7).
|
|
|
|
<P>
|
|
|
|
The
|
|
<I>/proc/[pid]/task/[tid]/status</I>
|
|
|
|
file contains various fields that show the signals
|
|
that a thread is blocking
|
|
(<I>SigBlk</I>),
|
|
|
|
catching
|
|
(<I>SigCgt</I>),
|
|
|
|
or ignoring
|
|
(<I>SigIgn</I>).
|
|
|
|
(The set of signals that are caught or ignored will be the same
|
|
across all threads in a process.)
|
|
Other fields show the set of pending signals that are directed to the thread
|
|
(<I>SigPnd</I>)
|
|
|
|
as well as the set of pending signals that are directed
|
|
to the process as a whole
|
|
(<I>ShdPnd</I>).
|
|
|
|
The corresponding fields in
|
|
<I>/proc/[pid]/status</I>
|
|
|
|
show the information for the main thread.
|
|
See
|
|
<B><A HREF="/cgi-bin/man/man2html?5+proc">proc</A></B>(5)
|
|
|
|
for further details.
|
|
<A NAME="lbAQ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?1+kill">kill</A></B>(1),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+clone">clone</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+getrlimit">getrlimit</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+restart_syscall">restart_syscall</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+rt_sigqueueinfo">rt_sigqueueinfo</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pidfd_send_signal">pidfd_send_signal</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setitimer">setitimer</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setrlimit">setrlimit</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sgetmask">sgetmask</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigaltstack">sigaltstack</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+signal">signal</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+signalfd">signalfd</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigpending">sigpending</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigprocmask">sigprocmask</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigreturn">sigreturn</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigsuspend">sigsuspend</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigwaitinfo">sigwaitinfo</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+abort">abort</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+bsd_signal">bsd_signal</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+killpg">killpg</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+longjmp">longjmp</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+pthread_sigqueue">pthread_sigqueue</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+raise">raise</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigqueue">sigqueue</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigset">sigset</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigsetops">sigsetops</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigvec">sigvec</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigwait">sigwait</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+strsignal">strsignal</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sysv_signal">sysv_signal</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+core">core</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+proc">proc</A></B>(5),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+nptl">nptl</A></B>(7),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+pthreads">pthreads</A></B>(7),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+sigevent">sigevent</A></B>(7)
|
|
|
|
<A NAME="lbAR"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="51"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="52"><A HREF="#lbAC">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="53"><A HREF="#lbAD">Signal dispositions</A><DD>
|
|
<DT id="54"><A HREF="#lbAE">Sending a signal</A><DD>
|
|
<DT id="55"><A HREF="#lbAF">Waiting for a signal to be caught</A><DD>
|
|
<DT id="56"><A HREF="#lbAG">Synchronously accepting a signal</A><DD>
|
|
<DT id="57"><A HREF="#lbAH">Signal mask and pending signals</A><DD>
|
|
<DT id="58"><A HREF="#lbAI">Standard signals</A><DD>
|
|
<DT id="59"><A HREF="#lbAJ">Queueing and delivery semantics for standard signals</A><DD>
|
|
<DT id="60"><A HREF="#lbAK">Signal numbering for standard signals</A><DD>
|
|
<DT id="61"><A HREF="#lbAL">Real-time signals</A><DD>
|
|
<DT id="62"><A HREF="#lbAM">Interruption of system calls and library functions by signal handlers</A><DD>
|
|
<DT id="63"><A HREF="#lbAN">Interruption of system calls and library functions by stop signals</A><DD>
|
|
</DL>
|
|
<DT id="64"><A HREF="#lbAO">CONFORMING TO</A><DD>
|
|
<DT id="65"><A HREF="#lbAP">NOTES</A><DD>
|
|
<DT id="66"><A HREF="#lbAQ">SEE ALSO</A><DD>
|
|
<DT id="67"><A HREF="#lbAR">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:09 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|