207 lines
4.9 KiB
HTML
207 lines
4.9 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of RESTART_SYSCALL</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>RESTART_SYSCALL</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2017-09-15<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>
|
|
|
|
restart_syscall - restart a system call after interruption by a stop signal
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>int restart_syscall(void);</B>
|
|
|
|
<P>
|
|
|
|
<I>Note</I>:
|
|
|
|
There is no glibc wrapper for this system call; see NOTES.
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The
|
|
<B>restart_syscall</B>()
|
|
|
|
system call is used to restart certain system calls
|
|
after a process that was stopped by a signal (e.g.,
|
|
<B>SIGSTOP</B>
|
|
|
|
or
|
|
<B>SIGTSTP</B>)
|
|
|
|
is later resumed after receiving a
|
|
<B>SIGCONT</B>
|
|
|
|
signal.
|
|
This system call is designed only for internal use by the kernel.
|
|
<P>
|
|
|
|
<B>restart_syscall</B>()
|
|
|
|
is used for restarting only those system calls that,
|
|
when restarted, should adjust their time-related parameters---namely
|
|
<B><A HREF="/cgi-bin/man/man2html?2+poll">poll</A></B>(2)
|
|
|
|
(since Linux 2.6.24),
|
|
<B><A HREF="/cgi-bin/man/man2html?2+nanosleep">nanosleep</A></B>(2)
|
|
|
|
(since Linux 2.6),
|
|
<B><A HREF="/cgi-bin/man/man2html?2+clock_nanosleep">clock_nanosleep</A></B>(2)
|
|
|
|
(since Linux 2.6),
|
|
and
|
|
<B><A HREF="/cgi-bin/man/man2html?2+futex">futex</A></B>(2),
|
|
|
|
when employed with the
|
|
<B>FUTEX_WAIT</B>
|
|
|
|
(since Linux 2.6.22)
|
|
and
|
|
<B>FUTEX_WAIT_BITSET</B>
|
|
|
|
(since Linux 2.6.31)
|
|
operations.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<B>restart_syscall</B>()
|
|
|
|
restarts the interrupted system call with a
|
|
time argument that is suitably adjusted to account for the
|
|
time that has already elapsed (including the time where the process
|
|
was stopped by a signal).
|
|
Without the
|
|
<B>restart_syscall</B>()
|
|
|
|
mechanism, restarting these system calls would not correctly deduct the
|
|
already elapsed time when the process continued execution.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
The return value of
|
|
<B>restart_syscall</B>()
|
|
|
|
is the return value of whatever system call is being restarted.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<I>errno</I>
|
|
|
|
is set as per the errors for whatever system call is being restarted by
|
|
<B>restart_syscall</B>().
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
The
|
|
<B>restart_syscall</B>()
|
|
|
|
system call is present since Linux 2.6.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
This system call is Linux-specific.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
There is no glibc wrapper for this system call,
|
|
because it is intended for use only by the kernel and
|
|
should never be called by applications.
|
|
<P>
|
|
|
|
The kernel uses
|
|
<B>restart_syscall</B>()
|
|
|
|
to ensure that when a system call is restarted
|
|
after a process has been stopped by a signal and then resumed by
|
|
<B>SIGCONT</B>,
|
|
|
|
then the time that the process spent in the stopped state is counted
|
|
against the timeout interval specified in the original system call.
|
|
In the case of system calls that take a timeout argument and
|
|
automatically restart after a stop signal plus
|
|
<B>SIGCONT</B>,
|
|
|
|
but which do not have the
|
|
<B>restart_syscall</B>()
|
|
|
|
mechanism built in, then, after the process resumes execution,
|
|
the time that the process spent in the stop state is
|
|
<I>not</I>
|
|
|
|
counted against the timeout value.
|
|
Notable examples of system calls that suffer this problem are
|
|
<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).
|
|
|
|
<P>
|
|
|
|
From user space, the operation of
|
|
<B>restart_syscall</B>()
|
|
|
|
is largely invisible:
|
|
to the process that made the system call that is restarted,
|
|
it appears as though that system call executed and
|
|
returned in the usual fashion.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+sigreturn">sigreturn</A></B>(2),
|
|
|
|
<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="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="4"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="5"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="6"><A HREF="#lbAG">VERSIONS</A><DD>
|
|
<DT id="7"><A HREF="#lbAH">CONFORMING TO</A><DD>
|
|
<DT id="8"><A HREF="#lbAI">NOTES</A><DD>
|
|
<DT id="9"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="10"><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>
|