1RESTART_SYSCALL(2)         Linux Programmer's Manual        RESTART_SYSCALL(2)
2
3
4

NAME

6       restart_syscall  -  restart  a system call after interruption by a stop
7       signal
8

SYNOPSIS

10       int restart_syscall(void);
11
12       Note: There is no glibc wrapper for this system call; see NOTES.
13

DESCRIPTION

15       The restart_syscall() system call is used  to  restart  certain  system
16       calls  after  a  process that was stopped by a signal (e.g., SIGSTOP or
17       SIGTSTP) is later resumed after receiving a SIGCONT signal.  This  sys‐
18       tem call is designed only for internal use by the kernel.
19
20       restart_syscall()  is used for restarting only those system calls that,
21       when restarted,  should  adjust  their  time-related  parameters—namely
22       poll(2)   (since   Linux   2.6.24),  nanosleep(2)  (since  Linux  2.6),
23       clock_nanosleep(2) (since Linux 2.6), and futex(2), when employed  with
24       the  FUTEX_WAIT (since Linux 2.6.22) and FUTEX_WAIT_BITSET (since Linux
25       2.6.31) operations.  restart_syscall() restarts the interrupted  system
26       call  with a time argument that is suitably adjusted to account for the
27       time that has already elapsed (including the time where the process was
28       stopped   by  a  signal).   Without  the  restart_syscall()  mechanism,
29       restarting these system calls would not correctly  deduct  the  already
30       elapsed time when the process continued execution.
31

RETURN VALUE

33       The  return  value of restart_syscall() is the return value of whatever
34       system call is being restarted.
35

ERRORS

37       errno is set as per the  errors  for  whatever  system  call  is  being
38       restarted by restart_syscall().
39

VERSIONS

41       The restart_syscall() system call is present since Linux 2.6.
42

CONFORMING TO

44       This system call is Linux-specific.
45

NOTES

47       There  is no glibc wrapper for this system call, because it is intended
48       for use only by the kernel and should never be called by applications.
49
50       The kernel uses restart_syscall() to ensure that when a system call  is
51       restarted after a process has been stopped by a signal and then resumed
52       by SIGCONT, then the time that the process spent in the  stopped  state
53       is  counted against the timeout interval specified in the original sys‐
54       tem call.  In the case of system calls that take a timeout argument and
55       automatically  restart  after  a stop signal plus SIGCONT, but which do
56       not have the restart_syscall() mechanism  built  in,  then,  after  the
57       process  resumes execution, the time that the process spent in the stop
58       state is not counted against the timeout value.   Notable  examples  of
59       system calls that suffer this problem are ppoll(2), select(2), and pse‐
60       lect(2).
61
62       From user space, the operation of restart_syscall() is largely  invisi‐
63       ble:  to  the  process  that made the system call that is restarted, it
64       appears as though that system call executed and returned in  the  usual
65       fashion.
66

SEE ALSO

68       sigaction(2), sigreturn(2), signal(7)
69

COLOPHON

71       This  page  is  part of release 5.07 of the Linux man-pages project.  A
72       description of the project, information about reporting bugs,  and  the
73       latest     version     of     this    page,    can    be    found    at
74       https://www.kernel.org/doc/man-pages/.
75
76
77
78Linux                             2017-09-15                RESTART_SYSCALL(2)
Impressum