1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\" and Copyright (c) 2004 by Michael Kerrisk (mtk.manpages@gmail.com)
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" Modified Sat Jul 24 13:32:44 1993 by Rik Faith (faith@cs.unc.edu)
27 .\" Modified Mon Jun 23 14:09:52 1997 by aeb - add EINTR.
28 .\" Modified Tue Jul 7 12:26:42 1998 by aeb - changed return value wait3
29 .\" Modified 2004-11-11, Michael Kerrisk <mtk.manpages@gmail.com>
30 .\" Rewrote much of this page, and removed much duplicated text,
31 .\" replacing with pointers to wait.2
33 .\"*******************************************************************
35 .\" This file was generated with po4a. Translate the source file.
37 .\"*******************************************************************
39 .\" Japanese Version Copyright (c) 1997,1998 HANATAKA Shinya
40 .\" all rights reserved.
41 .\" Translated 1997-03-04, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
42 .\" Modified 1997-09-28, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
43 .\" Modified 2001-08-17, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
44 .\" Updated 2001-12-13, Kentaro Shirakata <argrath@ub32.org>
45 .\" Updated 2003-09-12, Kentaro Shirakata <argrath@ub32.org>
46 .\" Updated 2005-03-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
47 .\" Updated 2013-05-06, Akihiro MOTOKI <amotoki@gmail.com>
49 .TH WAIT4 2 2012\-09\-23 Linux "Linux Programmer's Manual"
51 wait3, wait4 \- BSD スタイルでプロセスの状態変化を待つ
54 \fB#include <sys/types.h>\fP
55 \fB#include <sys/time.h>\fP
56 \fB#include <sys/resource.h>\fP
57 \fB#include <sys/wait.h>\fP
59 \fBpid_t wait3(int *\fP\fIstatus\fP\fB, int \fP\fIoptions\fP\fB,\fP
60 \fB struct rusage *\fP\fIrusage\fP\fB);\fP
62 \fBpid_t wait4(pid_t \fP\fIpid\fP\fB, int *\fP\fIstatus\fP\fB, int \fP\fIoptions\fP\fB,\fP
63 \fB struct rusage *\fP\fIrusage\fP\fB);\fP
67 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照):
73 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
82 これらの関数は廃止予定である。 新しいプログラムでは \fBwaitpid\fP(2) や \fBwaitid\fP(2) を使用すること。
84 システムコール \fBwait3\fP() と \fBwait4\fP() は \fBwaitpid\fP(2)
85 と同様の動作をする。それに加え、子プロセスのリソース使用状況の情報を \fIrusage\fP が指す構造体に入れて返す。
87 \fIrusage\fP を使用する点を除けば、次の \fBwait3\fP() の呼び出し
90 wait3(status, options, rusage);
96 waitpid(\-1, status, options);
99 同様に、次の \fBwait4\fP() の呼び出し
102 wait4(pid, status, options, rusage);
108 waitpid(pid, status, options);
111 言い換えると、 \fBwait3\fP() は全ての子プロセスを対象に待つが、 \fBwait4\fP() では特定の子プロセス (複数可)
114 \fIrusage\fP が NULL でない場合、 \fIrusage\fP が指す \fIrusage 構造体\fP には子プロセスのアカウント情報が格納される。
115 詳しくは \fBgetrusage\fP(2) を参照のこと。
117 \fBwaitpid\fP(2) と同様。
119 \fBwaitpid\fP(2) と同様。
123 SUSv1 には \fBwait3\fP() の規定があった。 SUSv2 には \fBwait3\fP() が含まれていたが、「過去の名残
124 (LEGACY)」となっていた。 SUSv3 では \fBwait3\fP() は削除された。
126 現在では \fI<sys/time.h>\fP をインクルードする必要はないが、インクルードしておくと 移植性を高めることができる (実際には
127 \fI<sys/resource.h>\fP で \fIrusage\fP 構造体が定義されているが、そのフィールドで使用されている
128 \fIstruct timeval\fP 型は \fI<sys/time.h>\fP で定義されている)。
130 Linux では、 \fBwait3\fP() はライブラリ関数であり、 \fBwait4\fP() システムコールを使って実装されている。
132 \fBfork\fP(2), \fBgetrusage\fP(2), \fBsigaction\fP(2), \fBsignal\fP(2), \fBwait\fP(2),
135 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.78 の一部である。
136 プロジェクトの説明とバグ報告に関する情報は \%http://www.kernel.org/doc/man\-pages/ に書かれている。