235 lines
5.2 KiB
HTML
235 lines
5.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of SIGSUSPEND</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>SIGSUSPEND</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2019-03-06<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>
|
|
|
|
sigsuspend, rt_sigsuspend - wait for a signal
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/signal.h">signal.h</A>></B>
|
|
|
|
<P>
|
|
|
|
<B>int sigsuspend(const sigset_t *</B><I>mask</I><B>);</B>
|
|
|
|
<P>
|
|
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
|
|
|
|
|
|
<P>
|
|
|
|
|
|
<B>sigsuspend</B>():
|
|
|
|
_POSIX_C_SOURCE
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<B>sigsuspend</B>()
|
|
|
|
temporarily replaces the signal mask of the calling thread with the
|
|
mask given by
|
|
<I>mask</I>
|
|
|
|
and then suspends the thread until delivery of a signal whose
|
|
action is to invoke a signal handler or to terminate a process.
|
|
<P>
|
|
|
|
If the signal terminates the process, then
|
|
<B>sigsuspend</B>()
|
|
|
|
does not return.
|
|
If the signal is caught, then
|
|
<B>sigsuspend</B>()
|
|
|
|
returns after the signal handler returns,
|
|
and the signal mask is restored to the state before the call to
|
|
<B>sigsuspend</B>().
|
|
|
|
<P>
|
|
|
|
It is not possible to block
|
|
<B>SIGKILL</B>
|
|
|
|
or
|
|
<B>SIGSTOP</B>;
|
|
|
|
specifying these signals in
|
|
<I>mask</I>,
|
|
|
|
has no effect on the thread's signal mask.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
<B>sigsuspend</B>()
|
|
|
|
always returns -1, with
|
|
<I>errno</I>
|
|
|
|
set to indicate the error (normally,
|
|
<B>EINTR</B>).
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="1"><B>EFAULT</B>
|
|
|
|
<DD>
|
|
<I>mask</I>
|
|
|
|
points to memory which is not a valid part of the process address space.
|
|
<DT id="2"><B>EINTR</B>
|
|
|
|
<DD>
|
|
The call was interrupted by a signal;
|
|
<B><A HREF="/cgi-bin/man/man2html?7+signal">signal</A></B>(7).
|
|
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
POSIX.1-2001, POSIX.1-2008.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
<P>
|
|
|
|
Normally,
|
|
<B>sigsuspend</B>()
|
|
|
|
is used in conjunction with
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigprocmask">sigprocmask</A></B>(2)
|
|
|
|
in order to prevent delivery of a signal during the execution of a
|
|
critical code section.
|
|
The caller first blocks the signals with
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigprocmask">sigprocmask</A></B>(2).
|
|
|
|
When the critical code has completed, the caller then waits for the
|
|
signals by calling
|
|
<B>sigsuspend</B>()
|
|
|
|
with the signal mask that was returned by
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigprocmask">sigprocmask</A></B>(2)
|
|
|
|
(in the
|
|
<I>oldset</I>
|
|
|
|
argument).
|
|
<P>
|
|
|
|
See
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigsetops">sigsetops</A></B>(3)
|
|
|
|
for details on manipulating signal sets.
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H3>C library/kernel differences</H3>
|
|
|
|
The original Linux system call was named
|
|
<B>sigsuspend</B>().
|
|
|
|
However, with the addition of real-time signals in Linux 2.2,
|
|
the fixed-size, 32-bit
|
|
<I>sigset_t</I>
|
|
|
|
type supported by that system call was no longer fit for purpose.
|
|
Consequently, a new system call,
|
|
<B>rt_sigsuspend</B>(),
|
|
|
|
was added to support an enlarged
|
|
<I>sigset_t</I>
|
|
|
|
type.
|
|
The new system call takes a second argument,
|
|
<I>size_t sigsetsize</I>,
|
|
|
|
which specifies the size in bytes of the signal set in
|
|
<I>mask</I>.
|
|
|
|
This argument is currently required to have the value
|
|
<I>sizeof(sigset_t)</I>
|
|
|
|
(or the error
|
|
<B>EINVAL</B>
|
|
|
|
results).
|
|
The glibc
|
|
<B>sigsuspend</B>()
|
|
|
|
wrapper function hides these details from us, transparently calling
|
|
<B>rt_sigsuspend</B>()
|
|
|
|
when the kernel provides it.
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+kill">kill</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+pause">pause</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+signal">signal</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigprocmask">sigprocmask</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigwaitinfo">sigwaitinfo</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigsetops">sigsetops</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+sigwait">sigwait</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+signal">signal</A></B>(7)
|
|
|
|
<A NAME="lbAK"> </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="3"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="4"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="5"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="6"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="7"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="8"><A HREF="#lbAG">CONFORMING TO</A><DD>
|
|
<DT id="9"><A HREF="#lbAH">NOTES</A><DD>
|
|
<DL>
|
|
<DT id="10"><A HREF="#lbAI">C library/kernel differences</A><DD>
|
|
</DL>
|
|
<DT id="11"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="12"><A HREF="#lbAK">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:05:34 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|