1 .\" Copyright (c) 2013 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" http://thread.gmane.org/gmane.linux.kernel/76552/focus=76803
26 .\" From: Linus Torvalds <torvalds <at> transmeta.com>
27 .\" Subject: Re: [PATCH] compatibility syscall layer (lets try again)
28 .\" Newsgroups: gmane.linux.kernel
29 .\" Date: 2002-12-05 02:51:12 GMT
31 .\" See also Section 11.3.3 of Understanding the Linux Kernel, 3rd edition
33 .TH RESTART_SYSCALL 2 2013-07-30 "Linux" "Linux Programmer's Manual"
35 restart_syscall \- restart a system call after interruption by a stop signal
37 .B int restart_syscall(void);
40 There is no glibc wrapper for this system call; see NOTES.
43 .BR restart_syscall ()
44 system call is used to restart certain system calls
45 after a process that was stopped by a signal (e.g.,
49 is later resumed after receiving a
52 This system call is designed only for internal use by the kernel.
54 .BR restart_syscall ()
55 is used for restarting only those system calls that,
56 when restarted, should adjust their time-related parameters\(emnamely
61 .BR clock_nanosleep (2)
65 when employed with the
72 .\" These system calls correspond to the special internal errno value
73 .\" ERESTART_RESTARTBLOCK. Each of the system calls has a "restart"
74 .\" helper function that is invoked by restart_syscall().
75 .BR restart_syscall ()
76 restarts the interrupted system call with a
77 time argument that is suitably adjusted to account for the
78 time that has already elapsed (including the time where the process
79 was stopped by a signal).
81 .BR restart_syscall ()
82 mechanism, restarting these system calls would not correctly deduce the
83 already elapsed time when the process continued execution.
86 .BR restart_syscall ()
87 is the return value of whatever system call is being restarted.
90 is set as per the errors for whatever system call is being restarted by
91 .BR restart_syscall ().
94 .BR restart_syscall ()
95 system call is present since Linux 2.6.
97 This system call is Linux-specific.
99 There is no glibc wrapper for this system call,
100 because it is intended for use only by the kernel and
101 should never be called by applications.
103 From user space, the operation of
104 .BR restart_syscall (2)
105 is largely invisible:
106 to the process that made the system call that is restarted,
107 it appears as though that system call executed and
108 returned in the usual fashion.
111 .\" There is one oddness in the implementation though, with respect to
112 .\" nanosleep() (and probably also clock_nanosleep()). The scenario
114 .\" 1. Start a nanosleep() for (say) 30 seconds,
115 .\" 2. Stop the process with (say) SIGTSTP (^Z).
116 .\" 3. Resume the process with SIGCONT,
117 .\" 4. Upon return, the 'rem' argument of nanosleep() will contain the
118 .\" remaining unslept time **at the time when SIGTSTP was delivered**.
119 .\" The behavior at point 4 is odd, but doesn't violate the standards, which
120 .\" specify the treatment of 'rem' only when the system call returns with
121 .\" the error EINTR (i.e., the call was interrupted by a signal handler).
127 .\" FIXME select(2) should probably get the restart_syscall() treatment:
128 .\" If a select() call is suspended by stop-sig+SIGCONT, the time
129 .\" spent suspended is *not* deducted when the select() is restarted.
130 .\" FIXME: check whether recvmmsg() handles stop-sig+SIGCONT properly.