.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) .\" and Copyright (c) 2004 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 .\" .\" Modified Sat Jul 24 13:32:44 1993 by Rik Faith (faith@cs.unc.edu) .\" Modified Mon Jun 23 14:09:52 1997 by aeb - add EINTR. .\" Modified Tue Jul 7 12:26:42 1998 by aeb - changed return value wait3 .\" Modified 2004-11-11, Michael Kerrisk .\" Rewrote much of this page, and removed much duplicated text, .\" replacing with pointers to wait.2 .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997,1998 HANATAKA Shinya .\" all rights reserved. .\" Translated 1997-03-04, HANATAKA Shinya .\" Modified 1997-09-28, HANATAKA Shinya .\" Modified 2001-08-17, HANATAKA Shinya .\" Updated 2001-12-13, Kentaro Shirakata .\" Updated 2003-09-12, Kentaro Shirakata .\" Updated 2005-03-04, Akihiro MOTOKI .\" Updated 2013-05-06, Akihiro MOTOKI .\" .TH WAIT4 2 2012\-09\-23 Linux "Linux Programmer's Manual" .SH 名前 wait3, wait4 \- BSD スタイルでプロセスの状態変化を待つ .SH 書式 .nf \fB#include \fP \fB#include \fP \fB#include \fP \fB#include \fP .sp \fBpid_t wait3(int *\fP\fIstatus\fP\fB, int \fP\fIoptions\fP\fB,\fP \fB struct rusage *\fP\fIrusage\fP\fB);\fP .sp \fBpid_t wait4(pid_t \fP\fIpid\fP\fB, int *\fP\fIstatus\fP\fB, int \fP\fIoptions\fP\fB,\fP \fB struct rusage *\fP\fIrusage\fP\fB);\fP .fi .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp .ad l \fBwait3\fP(): .RS 4 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED .RE .br \fBwait4\fP(): .RS 4 _BSD_SOURCE .RE .ad .SH 説明 これらの関数は廃止予定である。 新しいプログラムでは \fBwaitpid\fP(2) や \fBwaitid\fP(2) を使用すること。 システムコール \fBwait3\fP() と \fBwait4\fP() は \fBwaitpid\fP(2) と同様の動作をする。それに加え、子プロセスのリソース使用状況の情報を \fIrusage\fP が指す構造体に入れて返す。 .PP \fIrusage\fP を使用する点を除けば、次の \fBwait3\fP() の呼び出し .nf wait3(status, options, rusage); .fi は以下と等価である。 .nf waitpid(\-1, status, options); .fi 同様に、次の \fBwait4\fP() の呼び出し .nf wait4(pid, status, options, rusage); .fi は以下と等価である。 .nf waitpid(pid, status, options); .fi 言い換えると、 \fBwait3\fP() は全ての子プロセスを対象に待つが、 \fBwait4\fP() では特定の子プロセス (複数可) を選んで待つことができる。 .PP \fIrusage\fP が NULL でない場合、 \fIrusage\fP が指す \fIrusage 構造体\fP には子プロセスのアカウント情報が格納される。 詳しくは \fBgetrusage\fP(2) を参照のこと。 .SH 返り値 \fBwaitpid\fP(2) と同様。 .SH エラー \fBwaitpid\fP(2) と同様。 .SH 準拠 4.3BSD. SUSv1 には \fBwait3\fP() の規定があった。 SUSv2 には \fBwait3\fP() が含まれていたが、「過去の名残 (LEGACY)」となっていた。 SUSv3 では \fBwait3\fP() は削除された。 .SH 注意 現在では \fI\fP をインクルードする必要はないが、インクルードしておくと 移植性を高めることができる (実際には \fI\fP で \fIrusage\fP 構造体が定義されているが、そのフィールドで使用されている \fIstruct timeval\fP 型は \fI\fP で定義されている)。 Linux では、 \fBwait3\fP() はライブラリ関数であり、 \fBwait4\fP() システムコールを使って実装されている。 .SH 関連項目 \fBfork\fP(2), \fBgetrusage\fP(2), \fBsigaction\fP(2), \fBsignal\fP(2), \fBwait\fP(2), \fBsignal\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部である。 プロジェクトの説明とバグ報告に関する情報は \%http://www.kernel.org/doc/man\-pages/ に書かれている。