1 .\" Copyright (c) 2013 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" http://thread.gmane.org/gmane.linux.kernel/76552/focus=76803
6 .\" From: Linus Torvalds <torvalds <at> transmeta.com>
7 .\" Subject: Re: [PATCH] compatibility syscall layer (lets try again)
8 .\" Newsgroups: gmane.linux.kernel
9 .\" Date: 2002-12-05 02:51:12 GMT
11 .\" See also Section 11.3.3 of Understanding the Linux Kernel, 3rd edition
13 .TH RESTART_SYSCALL 2 2021-03-22 "Linux man-pages (unreleased)"
15 restart_syscall \- restart a system call after interruption by a stop signal
18 .B long restart_syscall(void);
22 There is no glibc wrapper for this system call; see NOTES.
25 .BR restart_syscall ()
26 system call is used to restart certain system calls
27 after a process that was stopped by a signal (e.g.,
31 is later resumed after receiving a
34 This system call is designed only for internal use by the kernel.
36 .BR restart_syscall ()
37 is used for restarting only those system calls that,
38 when restarted, should adjust their time-related parameters\(emnamely
43 .BR clock_nanosleep (2)
47 when employed with the
54 .\" These system calls correspond to the special internal errno value
55 .\" ERESTART_RESTARTBLOCK. Each of the system calls has a "restart"
56 .\" helper function that is invoked by restart_syscall().
57 .\" Notable (as at Linux 3.17) is that poll() has such a "restart"
58 .\" function, but ppoll(), select(), and pselect() do not.
59 .\" This means that the latter system calls do not take account of the
60 .\" time spent in the stopped state when restarting.
61 .BR restart_syscall ()
62 restarts the interrupted system call with a
63 time argument that is suitably adjusted to account for the
64 time that has already elapsed (including the time where the process
65 was stopped by a signal).
67 .BR restart_syscall ()
68 mechanism, restarting these system calls would not correctly deduct the
69 already elapsed time when the process continued execution.
72 .BR restart_syscall ()
73 is the return value of whatever system call is being restarted.
76 is set as per the errors for whatever system call is being restarted by
77 .BR restart_syscall ().
80 .BR restart_syscall ()
81 system call is present since Linux 2.6.
83 This system call is Linux-specific.
85 There is no glibc wrapper for this system call,
86 because it is intended for use only by the kernel and
87 should never be called by applications.
90 .BR restart_syscall ()
91 to ensure that when a system call is restarted
92 after a process has been stopped by a signal and then resumed by
94 then the time that the process spent in the stopped state is counted
95 against the timeout interval specified in the original system call.
96 In the case of system calls that take a timeout argument and
97 automatically restart after a stop signal plus
99 but which do not have the
100 .BR restart_syscall ()
101 mechanism built in, then, after the process resumes execution,
102 the time that the process spent in the stop state is
104 counted against the timeout value.
105 Notable examples of system calls that suffer this problem are
111 From user space, the operation of
112 .BR restart_syscall ()
113 is largely invisible:
114 to the process that made the system call that is restarted,
115 it appears as though that system call executed and
116 returned in the usual fashion.
121 .\" FIXME . ppoll(2), select(2), and pselect(2)
122 .\" should probably get the restart_syscall() treatment:
123 .\" If a select() call is suspended by stop-sig+SIGCONT, the time
124 .\" spent suspended is *not* deducted when the select() is restarted.
125 .\" FIXME . check whether recvmmsg() handles stop-sig+SIGCONT properly.