OSDN Git Service

144a7255d4795b167e9848ff7c913c12078143a0
[linuxjm/LDP_man-pages.git] / draft / man2 / wait4.2
1 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2 .\" and Copyright (c) 2004 by Michael Kerrisk (mtk.manpages@gmail.com)
3 .\"
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.
8 .\"
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.
13 .\"
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
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
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
32 .\"
33 .\"*******************************************************************
34 .\"
35 .\" This file was generated with po4a. Translate the source file.
36 .\"
37 .\"*******************************************************************
38 .TH WAIT4 2 2012\-09\-23 Linux "Linux Programmer's Manual"
39 .SH 名前
40 wait3, wait4 \- BSD スタイルでプロセスの状態変化を待つ
41 .SH 書式
42 .nf
43 \fB#include <sys/types.h>\fP
44 \fB#include <sys/time.h>\fP
45 \fB#include <sys/resource.h>\fP
46 \fB#include <sys/wait.h>\fP
47 .sp
48 \fBpid_t wait3(int *\fP\fIstatus\fP\fB, int \fP\fIoptions\fP\fB,\fP
49 \fB            struct rusage *\fP\fIrusage\fP\fB);\fP
50 .sp
51 \fBpid_t wait4(pid_t \fP\fIpid\fP\fB, int *\fP\fIstatus\fP\fB, int \fP\fIoptions\fP\fB,\fP
52 \fB            struct rusage *\fP\fIrusage\fP\fB);\fP
53 .fi
54 .sp
55 .in -4n
56 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
57 .in
58 .sp
59 .ad l
60 \fBwait3\fP():
61 .RS 4
62 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
63 .RE
64 .br
65 \fBwait4\fP():
66 .RS 4
67 _BSD_SOURCE
68 .RE
69 .ad
70 .SH 説明
71 これらの関数は廃止予定である。 新しいプログラムでは \fBwaitpid\fP(2) や \fBwaitid\fP(2) を使用すること。
72
73 システムコール \fBwait3\fP()  と \fBwait4\fP()  は \fBwaitpid\fP(2)
74 と同様の動作をする。それに加え、子プロセスのリソース使用状況の情報を \fIrusage\fP が指す構造体に入れて返す。
75 .PP
76 \fIrusage\fP を使用する点を除けば、次の \fBwait3\fP()  の呼び出し
77 .nf
78
79     wait3(status, options, rusage);
80
81 .fi
82 は以下と等価である。
83 .nf
84
85     waitpid(\-1, status, options);
86
87 .fi
88 同様に、次の \fBwait4\fP()  の呼び出し
89 .nf
90
91     wait4(pid, status, options, rusage);
92
93 .fi
94 は以下と等価である。
95 .nf
96
97     waitpid(pid, status, options);
98
99 .fi
100 言い換えると、 \fBwait3\fP()  は全ての子プロセスを対象に待つが、 \fBwait4\fP()  では特定の子プロセス (複数可)
101 を選んで待つことができる。
102 .PP
103 \fIrusage\fP が NULL でない場合、 \fIrusage\fP が指す \fIrusage 構造体\fP には子プロセスのアカウント情報が格納される。
104 詳しくは \fBgetrusage\fP(2)  を参照のこと。
105 .SH 返り値
106 \fBwaitpid\fP(2)  と同様。
107 .SH エラー
108 \fBwaitpid\fP(2)  と同様。
109 .SH 準拠
110 4.3BSD.
111
112 SUSv1 には \fBwait3\fP() の規定があった。 SUSv2 には \fBwait3\fP() が含まれていたが、「過去の名残
113 (LEGACY)」となっていた。 SUSv3 では \fBwait3\fP() は削除された。
114 .SH 注意
115 現在では \fI<sys/time.h>\fP をインクルードする必要はないが、インクルードしておくと 移植性を高めることができる (実際には
116 \fI<sys/resource.h>\fP で \fIrusage\fP 構造体が定義されているが、そのフィールドで使用されている
117 \fIstruct timeval\fP 型は \fI<sys/time.h>\fP で定義されている)。
118
119 Linux では、 \fBwait3\fP()  はライブラリ関数であり、 \fBwait4\fP()  システムコールを使って実装されている。
120 .SH 関連項目
121 \fBfork\fP(2), \fBgetrusage\fP(2), \fBsigaction\fP(2), \fBsignal\fP(2), \fBwait\fP(2),
122 \fBsignal\fP(7)
123 .SH この文書について
124 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
125 である。プロジェクトの説明とバグ報告に関する情報は
126 http://www.kernel.org/doc/man\-pages/ に書かれている。