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 2021-03-22 "Linux" "Linux Programmer's Manual"
35 restart_syscall \- restart a system call after interruption by a stop signal
38 .B long restart_syscall(void);
42 There is no glibc wrapper for this system call; see NOTES.
45 .BR restart_syscall ()
46 system call is used to restart certain system calls
47 after a process that was stopped by a signal (e.g.,
51 is later resumed after receiving a
54 This system call is designed only for internal use by the kernel.
56 .BR restart_syscall ()
57 is used for restarting only those system calls that,
58 when restarted, should adjust their time-related parameters\(emnamely
63 .BR clock_nanosleep (2)
67 when employed with the
74 .\" These system calls correspond to the special internal errno value
75 .\" ERESTART_RESTARTBLOCK. Each of the system calls has a "restart"
76 .\" helper function that is invoked by restart_syscall().
77 .\" Notable (as at Linux 3.17) is that poll() has such a "restart"
78 .\" function, but ppoll(), select(), and pselect() do not.
79 .\" This means that the latter system calls do not take account of the
80 .\" time spent in the stopped state when restarting.
81 .BR restart_syscall ()
82 restarts the interrupted system call with a
83 time argument that is suitably adjusted to account for the
84 time that has already elapsed (including the time where the process
85 was stopped by a signal).
87 .BR restart_syscall ()
88 mechanism, restarting these system calls would not correctly deduct the
89 already elapsed time when the process continued execution.
92 .BR restart_syscall ()
93 is the return value of whatever system call is being restarted.
96 is set as per the errors for whatever system call is being restarted by
97 .BR restart_syscall ().
100 .BR restart_syscall ()
101 system call is present since Linux 2.6.
103 This system call is Linux-specific.
105 There is no glibc wrapper for this system call,
106 because it is intended for use only by the kernel and
107 should never be called by applications.
110 .BR restart_syscall ()
111 to ensure that when a system call is restarted
112 after a process has been stopped by a signal and then resumed by
114 then the time that the process spent in the stopped state is counted
115 against the timeout interval specified in the original system call.
116 In the case of system calls that take a timeout argument and
117 automatically restart after a stop signal plus
119 but which do not have the
120 .BR restart_syscall ()
121 mechanism built in, then, after the process resumes execution,
122 the time that the process spent in the stop state is
124 counted against the timeout value.
125 Notable examples of system calls that suffer this problem are
131 From user space, the operation of
132 .BR restart_syscall ()
133 is largely invisible:
134 to the process that made the system call that is restarted,
135 it appears as though that system call executed and
136 returned in the usual fashion.
141 .\" FIXME . ppoll(2), select(2), and pselect(2)
142 .\" should probably get the restart_syscall() treatment:
143 .\" If a select() call is suspended by stop-sig+SIGCONT, the time
144 .\" spent suspended is *not* deducted when the select() is restarted.
145 .\" FIXME . check whether recvmmsg() handles stop-sig+SIGCONT properly.