2013-07-30 03:08:16 +00:00
|
|
|
.\" Copyright (c) 2013 by Michael Kerrisk <mtk.manpages@gmail.com>
|
|
|
|
.\"
|
|
|
|
.\" %%%LICENSE_START(VERBATIM)
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
|
|
|
.\"
|
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
|
|
|
.\"
|
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\" %%%LICENSE_END
|
|
|
|
.\"
|
|
|
|
.\" http://thread.gmane.org/gmane.linux.kernel/76552/focus=76803
|
|
|
|
.\" From: Linus Torvalds <torvalds <at> transmeta.com>
|
|
|
|
.\" Subject: Re: [PATCH] compatibility syscall layer (lets try again)
|
|
|
|
.\" Newsgroups: gmane.linux.kernel
|
|
|
|
.\" Date: 2002-12-05 02:51:12 GMT
|
|
|
|
.\"
|
|
|
|
.\" See also Section 11.3.3 of Understanding the Linux Kernel, 3rd edition
|
|
|
|
.\"
|
memusage.1, memusagestat.1, pldd.1, accept.2, adjtimex.2, arch_prctl.2, bdflush.2, bpf.2, close.2, epoll_ctl.2, epoll_wait.2, execve.2, execveat.2, fanotify_init.2, fanotify_mark.2, fcntl.2, fsync.2, get_kernel_syms.2, getdomainname.2, getgroups.2, gethostname.2, getrandom.2, getrlimit.2, getrusage.2, getsid.2, getunwind.2, io_getevents.2, ioctl_fat.2, kexec_load.2, killpg.2, listxattr.2, lseek.2, madvise.2, memfd_create.2, mknod.2, mlock.2, modify_ldt.2, msgctl.2, msgget.2, msgop.2, readlink.2, readv.2, reboot.2, recvmmsg.2, rename.2, request_key.2, restart_syscall.2, sched_setaffinity.2, sched_setattr.2, sched_setparam.2, seccomp.2, select_tut.2, semctl.2, semget.2, semop.2, set_thread_area.2, seteuid.2, setgid.2, setpgid.2, setresuid.2, setreuid.2, setsid.2, setuid.2, shmctl.2, shmget.2, shmop.2, sigaction.2, sigprocmask.2, stat.2, symlink.2, syscall.2, sysctl.2, unlink.2, bindresvport.3, byteorder.3, dlopen.3, endian.3, error.3, ffs.3, fmemopen.3, getcwd.3, getlogin.3, getnetent.3, getprotoent.3, getservent.3, getumask.3, getutent.3, glob.3, isalpha.3, lio_listio.3, login.3, mbsinit.3, mbstowcs.3, mbtowc.3, mkstemp.3, nextup.3, ntp_gettime.3, posix_fallocate.3, posix_spawn.3, pthread_join.3, pthread_rwlockattr_setkind_np.3, random.3, rcmd.3, realpath.3, resolver.3, setjmp.3, setnetgrent.3, sigvec.3, strerror.3, strverscmp.3, system.3, toupper.3, towlower.3, towupper.3, wcstombs.3, wordexp.3, cciss.4, loop.4, mouse.4, random.4, core.5, group.5, hosts.5, resolv.conf.5, ascii.7, environ.7, epoll.7, glob.7, ip.7, mq_overview.7, packet.7, pipe.7, raw.7, sched.7, signal.7, socket.7, symlink.7, ld.so.8, sln.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-10-08 10:53:47 +00:00
|
|
|
.TH RESTART_SYSCALL 2 2016-10-08 "Linux" "Linux Programmer's Manual"
|
2013-07-30 03:08:16 +00:00
|
|
|
.SH NAME
|
|
|
|
restart_syscall \- restart a system call after interruption by a stop signal
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.B int restart_syscall(void);
|
|
|
|
|
|
|
|
.IR Note :
|
|
|
|
There is no glibc wrapper for this system call; see NOTES.
|
|
|
|
.SH DESCRIPTION
|
|
|
|
The
|
|
|
|
.BR restart_syscall ()
|
|
|
|
system call is used to restart certain system calls
|
|
|
|
after a process that was stopped by a signal (e.g.,
|
|
|
|
.BR SIGSTOP
|
|
|
|
or
|
|
|
|
.BR SIGTSTP )
|
|
|
|
is later resumed after receiving a
|
|
|
|
.BR SIGCONT
|
|
|
|
signal.
|
|
|
|
This system call is designed only for internal use by the kernel.
|
|
|
|
|
|
|
|
.BR restart_syscall ()
|
|
|
|
is used for restarting only those system calls that,
|
|
|
|
when restarted, should adjust their time-related parameters\(emnamely
|
|
|
|
.BR poll (2)
|
|
|
|
(since Linux 2.6.24),
|
|
|
|
.BR nanosleep (2)
|
|
|
|
(since Linux 2.6),
|
|
|
|
.BR clock_nanosleep (2)
|
|
|
|
(since Linux 2.6),
|
|
|
|
and
|
|
|
|
.BR futex (2),
|
|
|
|
when employed with the
|
|
|
|
.BR FUTEX_WAIT
|
|
|
|
(since Linux 2.6.22)
|
|
|
|
and
|
|
|
|
.BR FUTEX_WAIT_BITSET
|
|
|
|
(since Linux 2.6.31)
|
|
|
|
operations.
|
|
|
|
.\" These system calls correspond to the special internal errno value
|
|
|
|
.\" ERESTART_RESTARTBLOCK. Each of the system calls has a "restart"
|
|
|
|
.\" helper function that is invoked by restart_syscall().
|
2014-12-11 10:52:12 +00:00
|
|
|
.\" Notable (as at Linux 3.17) is that poll() has such a "restart"
|
|
|
|
.\" function, but ppoll(), select(), and pselect() do not.
|
|
|
|
.\" This means that the latter system calls do not take account of the
|
|
|
|
.\" time spent in the stopped state when restarting.
|
2013-07-30 03:08:16 +00:00
|
|
|
.BR restart_syscall ()
|
|
|
|
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
|
|
|
|
.BR restart_syscall ()
|
2014-12-11 07:16:32 +00:00
|
|
|
mechanism, restarting these system calls would not correctly deduct the
|
2013-07-30 03:08:16 +00:00
|
|
|
already elapsed time when the process continued execution.
|
|
|
|
.SH RETURN VALUE
|
|
|
|
The return value of
|
|
|
|
.BR restart_syscall ()
|
|
|
|
is the return value of whatever system call is being restarted.
|
|
|
|
.SH ERRORS
|
|
|
|
.I errno
|
|
|
|
is set as per the errors for whatever system call is being restarted by
|
|
|
|
.BR restart_syscall ().
|
|
|
|
.SH VERSIONS
|
|
|
|
The
|
|
|
|
.BR restart_syscall ()
|
|
|
|
system call is present since Linux 2.6.
|
|
|
|
.SH CONFORMING TO
|
getcpu.2, getunwind.2, kcmp.2, mmap.2, perf_event_open.2, perfmonctl.2, quotactl.2, restart_syscall.2, btree.3, dbopen.3, hash.3, recno.3, sched_getcpu.3, elf.5, bootparam.7, hier.7, netdevice.7, rtnetlink.7: wfix: "xxxx specific" ==> "xxxx-specific"
2014-01-10 17:16:28 +00:00
|
|
|
This system call is Linux-specific.
|
2013-07-30 03:08:16 +00:00
|
|
|
.SH NOTES
|
|
|
|
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.
|
|
|
|
|
2014-12-12 14:49:47 +00:00
|
|
|
The kernel uses
|
|
|
|
.BR restart_syscall ()
|
|
|
|
to ensure that when a system call is restarted
|
|
|
|
after a process has been stopped by a signal and then resumed by
|
|
|
|
.BR SIGCONT ,
|
|
|
|
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
|
|
|
|
.BR SIGCONT ,
|
|
|
|
but which do not have the
|
arch_prctl.2, execveat.2, fanotify_mark.2, fcntl.2, fork.2, madvise.2, mknod.2, mmap.2, modify_ldt.2, mount.2, open.2, prctl.2, ptrace.2, restart_syscall.2, seccomp.2, semop.2, set_thread_area.2, symlink.2, umount.2, unlink.2, error.3, getnetent.3, getprotoent.3, getservent.3, getutent.3, glob.3, login.3, setjmp.3, setnetgrent.3, wordexp.3, epoll.7: Remove section number from page self reference
Fix places where pages refer to the function that they describe
and include a section number in that reference. Such references
cause some HTML-rendering tools to create self-references in the
page.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-08-07 16:40:35 +00:00
|
|
|
.BR restart_syscall ()
|
2014-12-12 14:49:47 +00:00
|
|
|
mechanism built in, then, after the process resumes execution,
|
|
|
|
the time that the process spent in the stop state is
|
|
|
|
.I not
|
|
|
|
counted against the timeout value.
|
|
|
|
Notable examples of system calls that suffer this problem are
|
|
|
|
.BR ppoll (2),
|
|
|
|
.BR select (2),
|
|
|
|
and
|
|
|
|
.BR pselect (2).
|
|
|
|
|
2013-07-30 03:08:16 +00:00
|
|
|
From user space, the operation of
|
2015-02-21 06:04:26 +00:00
|
|
|
.BR restart_syscall ()
|
2013-07-30 03:08:16 +00:00
|
|
|
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.
|
|
|
|
.SH SEE ALSO
|
|
|
|
.BR sigaction (2),
|
2014-02-10 09:26:57 +00:00
|
|
|
.BR sigreturn (2),
|
2013-07-30 03:08:16 +00:00
|
|
|
.BR signal (7)
|
2014-12-12 14:51:41 +00:00
|
|
|
.\" FIXME . ppoll(2), select(2), and pselect(2)
|
|
|
|
.\" should probably get the restart_syscall() treatment:
|
2013-07-30 03:08:16 +00:00
|
|
|
.\" If a select() call is suspended by stop-sig+SIGCONT, the time
|
|
|
|
.\" spent suspended is *not* deducted when the select() is restarted.
|
adjtimex.2, bind.2, cacheflush.2, clone.2, fallocate.2, fanotify_init.2, fanotify_mark.2, flock.2, futex.2, getdents.2, getpriority.2, getrlimit.2, gettid.2, gettimeofday.2, ioprio_set.2, kexec_load.2, migrate_pages.2, modify_ldt.2, mount.2, move_pages.2, mprotect.2, msgop.2, nfsservctl.2, perf_event_open.2, pread.2, ptrace.2, recvmmsg.2, rename.2, restart_syscall.2, sched_setattr.2, send.2, shmop.2, shutdown.2, sigaction.2, signalfd.2, syscalls.2, timer_create.2, timerfd_create.2, tkill.2, vmsplice.2, wait.2, aio_init.3, confstr.3, exit.3, fmemopen.3, fopen.3, getaddrinfo.3, getauxval.3, getspnam.3, isalpha.3, isatty.3, mallinfo.3, malloc.3, mallopt.3, psignal.3, pthread_attr_setinheritsched.3, qecvt.3, queue.3, rtnetlink.3, strerror.3, strftime.3, toupper.3, towlower.3, towupper.3, initrd.4, locale.5, proc.5, bootparam.7, capabilities.7, ddp.7, fanotify.7, icmp.7, inotify.7, ip.7, ipv6.7, netdevice.7, netlink.7, path_resolution.7, rtld-audit.7, rtnetlink.7, sched.7, signal.7, socket.7, svipc.7, tcp.7, unix.7, ld.so.8: srcfix: Update FIXMEs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2014-08-21 21:47:44 +00:00
|
|
|
.\" FIXME . check whether recvmmsg() handles stop-sig+SIGCONT properly.
|