.\" Copyright (c) 2013 by Michael Kerrisk .\" .\" %%%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 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 .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH RESTART_SYSCALL 2 2014\-12\-31 Linux "Linux Programmer's Manual" .SH 名前 restart_syscall \- 一時停止シグナルによる割り込み後にシステムコールを再開する .SH 書式 \fBint restart_syscall(void);\fP \fI注\fP: このシステムコールには、glibc のラッパー関数はない。「注意」の節を参照。 .SH 説明 \fBrestart_syscall\fP() システムコールは、 シグナル (\fBSIGSTOP\fP や \fBSIGTSTP\fP など) によって停止されたプロセスが \fBSIGCONT\fP シグナルを受信して再開された後に、 特定のシステムコールを再開するのに使用される。 このシステムコールはカーネル内部での利用のみを想定している。 .\" 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(). .\" 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. \fBrestart_syscall\fP() は、 再開時に時刻関連のパラメーターを調整する必要があるシステムコールを再開させる場合にのみ使用される。 概要するシステムコールは \fBpoll\fP(2) (Linux 2.6.24 以降)、 \fBnanosleep\fP(2) (Linux 2.6 以降)、 \fBclock_nanosleep\fP(2) (Linux 2.6 以降)、 \fBFUTEX_WAIT\fP (Linux 2.6.22 以降) や \fBFUTEX_WAIT_BITSET\fP (Linux 2.6.31 以降) 操作を利用した場合の \fBfutex\fP(2) である。 \fBrestart_syscall\fP() は、 中断されたシステムコールを、 経過した時間 (プロセスがシグナルにより停止されていた時間も含む) を考慮に入れて適切に調整した時刻引き数で再開する。 \fBrestart_syscall\fP() の仕組みがないと、 これらのシステムコールの再開で、 プロセスが実行を継続する際にすでに経過した時間を正しく減算できない。 .SH 返り値 \fBrestart_syscall\fP() の返り値は、 再開中のシステムコールの返り値となる。 .SH エラー \fIerrno\fP は \fBrestart_syscall\fP() が再開しているシステムコールのエラーに基づいて設定される。 .SH バージョン \fBrestart_syscall\fP() システムコールは Linux 2.6 以降に存在する。 .SH 準拠 このシステムコールは Linux 固有である。 .SH 注意 このシステムコールには glibc のラッパー関数はない。 それはカーネルによる利用だけが想定されており、 アプリケーションは決してこのシステムコールを呼び出すべきではない。 カーネルは \fBrestart_syscall\fP() を使用することで、 シグナルにより停止されたプロセスが \fBSIGCONT\fP により再開された後にシステムコールが再開される際に、 元のシステムコールに指定されたタイムアウト時間の計算に、 プロセスが停止中に経過した時間が含まれることを保証する。 タイムアウト引き数を取り、停止シグナルの後に \fBSIGCONT\fP があった場合自動的に再開するシステムコールだが、 そのシステムコールに \fBrestart_syscall\fP() の仕組みが組込まれていない場合には、 プロセスの実行が再開された後、 停止中にプロセスが消費した時間はタイムアウト値としてカウント「されない」。 この問題を持つ有名なシステムコールとしては \fBppoll\fP(2), \fBselect\fP(2), \fBpselect\fP(2) がある。 ユーザー空間からは \fBrestart_syscall\fP() の動作はほとんど見えない。 再開されたシステムコールを呼び出したプロセスには、 そのシステムコールが通常通り実行され返ったように見える。 .SH 関連項目 .\" FIXME . ppoll(2), select(2), and pselect(2) .\" should probably get the restart_syscall() treatment: .\" If a select() call is suspended by stop-sig+SIGCONT, the time .\" spent suspended is *not* deducted when the select() is restarted. .\" FIXME . check whether recvmmsg() handles stop-sig+SIGCONT properly. \fBsigaction\fP(2), \fBsigreturn\fP(2), \fBsignal\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部である。 プロジェクトの説明とバグ報告に関する情報は \%http://www.kernel.org/doc/man\-pages/ に書かれている。