OSDN Git Service

966b86fce9a2e0308d0df466bd2173fcb14c0cfb
[linuxjm/LDP_man-pages.git] / draft / man2 / wait4.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
4 .\" and Copyright (c) 2004 by Michael Kerrisk (mtk.manpages@gmail.com)
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" License.
26 .\"
27 .\" Modified Sat Jul 24 13:32:44 1993 by Rik Faith (faith@cs.unc.edu)
28 .\" Modified Mon Jun 23 14:09:52 1997 by aeb - add EINTR.
29 .\" Modified Tue Jul  7 12:26:42 1998 by aeb - changed return value wait3
30 .\" Modified 2004-11-11, Michael Kerrisk <mtk.manpages@gmail.com>
31 .\"     Rewrote much of this page, and removed much duplicated text,
32 .\"             replacing with pointers to wait.2
33 .\"
34 .\" Japanese Version Copyright (c) 1997,1998 HANATAKA Shinya
35 .\"         all rights reserved.
36 .\" Translated 1997-03-04, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
37 .\" Modified 1997-09-28, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
38 .\" Modified 2001-08-17, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
39 .\" Updated 2001-12-13, Kentaro Shirakata <argrath@ub32.org>
40 .\" Updated 2003-09-12, Kentaro Shirakata <argrath@ub32.org>
41 .\" Updated 2005-03-04, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
42 .\"
43 .\"WORD:        signal handling         シグナル処理
44 .\"WORD:        suspend                 停止(suspend)
45 .\"WORD:        zombie                  ゾンビ(zombie)
46 .\"WORD:        child process           子プロセス
47 .\"WORD:        process group           プロセス・グループ
48 .\"WORD:        process group ID        プロセス・グループID
49 .\"WORD:        stop                    停止(stop)
50 .\"WORD:        effective user ID       実効ユーザーID
51 .\"WORD:        block                   禁止(block)
52 .\"WORD:        catch                   捕獲(catch)
53 .\"WORD:        account                 アカウント
54 .\"
55 .TH WAIT4 2  2010-09-20 "Linux" "Linux Programmer's Manual"
56 .\"O .SH NAME
57 .SH 名前
58 .\"O wait3, wait4 \- wait for process to change state, BSD style
59 wait3, wait4 \- BSD スタイルでプロセスの状態変化を待つ
60 .\"O .SH SYNOPSIS
61 .SH 書式
62 .nf
63 .B #include <sys/types.h>
64 .B #include <sys/time.h>
65 .B #include <sys/resource.h>
66 .B #include <sys/wait.h>
67 .sp
68 .BI "pid_t wait3(int *" "status" ", int " options ,
69 .BI "            struct rusage *" rusage );
70 .sp
71 .BI "pid_t wait4(pid_t " pid ", int *" status ", int " options ,
72 .BI "            struct rusage *" rusage );
73 .fi
74 .sp
75 .in -4n
76 .\"O Feature Test Macro Requirements for glibc (see
77 .\"O .BR feature_test_macros (7)):
78 glibc 向けの機能検査マクロの要件
79 .RB ( feature_test_macros (7)
80 参照):
81 .in
82 .sp
83 .ad l
84 .BR wait3 ():
85 .RS 4
86 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
87 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
88 .RE
89 .br
90 .BR wait4 ():
91 .RS 4
92 _BSD_SOURCE
93 .RE
94 .ad
95 .\"O .SH DESCRIPTION
96 .SH 説明
97 .\"O The
98 .\"O .BR wait3 ()
99 .\"O and
100 .\"O .BR wait4 ()
101 .\"O system calls are similar to
102 .\"O .BR waitpid (2),
103 .\"O but additionally return resource usage information about the
104 .\"O child in the structure pointed to by
105 .\"O .IR rusage .
106 システムコール
107 .BR wait3 ()
108
109 .BR wait4 ()
110
111 .BR waitpid (2)
112 と同様の動作をする。それに加え、子プロセスのリソース使用状況の情報を
113 .I rusage
114 が指す構造体に入れて返す。
115 .PP
116 .\"O Other than the use of the
117 .\"O .I rusage
118 .\"O argument, the following
119 .\"O .BR wait3 ()
120 .\"O call:
121 .\"O .nf
122 .\"O
123 .\"O     wait3(status, options, rusage);
124 .\"O
125 .\"O .fi
126 .\"O is equivalent to:
127 .\"O .nf
128 .\"O
129 .\"O     waitpid(\-1, status, options);
130 .\"O
131 .\"O .fi
132 .I rusage
133 を使用する点を除けば、以下の 2つは等価である。
134 .nf
135
136     wait3(status, options, rusage);
137
138     waitpid(\-1, status, options);
139
140 .fi
141 .\"O Similarly, the following
142 .\"O .BR wait4 ()
143 .\"O call:
144 .\"O .nf
145 .\"O
146 .\"O     wait4(pid, status, options, rusage);
147 .\"O
148 .\"O .fi
149 .\"O is equivalent to:
150 .\"O .nf
151 .\"O
152 .\"O     waitpid(pid, status, options);
153 .\"O
154 .\"O .fi
155 同様に、以下の 2つも等価である。
156 .nf
157
158     wait4(pid, status, options, rusage);
159
160     waitpid(pid, status, options);
161
162 .fi
163 .\"O In other words,
164 .\"O .BR wait3 ()
165 .\"O waits of any child, while
166 .\"O .BR wait4 ()
167 .\"O can be used to select a specific child, or children, on which to wait.
168 .\"O See
169 .\"O .BR wait (2)
170 .\"O for further details.
171 言い換えると、
172 .BR wait3 ()
173 は全ての子プロセスを対象に待つが、
174 .BR wait4 ()
175 では特定の子プロセス (複数可) を選んで待つことができる。
176 .PP
177 .\"O If
178 .\"O .I rusage
179 .\"O is not NULL, the
180 .\"O .I struct rusage
181 .\"O to which it points will be filled with accounting information
182 .\"O about the child.
183 .\"O See
184 .\"O .BR getrusage (2)
185 .\"O for details.
186 .I rusage
187 が NULL でない場合、
188 .I rusage
189 が指す
190 .I rusage 構造体
191 には子プロセスのアカウント情報が格納される。
192 詳しくは
193 .BR getrusage (2)
194 を参照のこと。
195 .\"O .SH "RETURN VALUE"
196 .SH 返り値
197 .\"O As for
198 .\"O .BR waitpid (2).
199 .BR waitpid (2)
200 と同様。
201 .\"O .SH ERRORS
202 .SH エラー
203 .\"O As for
204 .\"O .BR waitpid (2).
205 .BR waitpid (2)
206 と同様。
207 .\"O .SH "CONFORMING TO"
208 .SH 準拠
209 4.3BSD.
210 .\"O .SH NOTES
211 .SH 注意
212 .\"O Including
213 .\"O .I <sys/time.h>
214 .\"O is not required these days, but increases portability.
215 .\"O (Indeed,
216 .\"O .I <sys/resource.h>
217 .\"O defines the
218 .\"O .I rusage
219 .\"O structure with fields of type
220 .\"O .I struct timeval
221 .\"O defined in
222 .\"O .IR <sys/time.h> .)
223 現在では
224 .I <sys/time.h>
225 をインクルードする必要はないが、インクルードしておくと
226 移植性を高めることができる (実際には
227 .I <sys/resource.h>
228
229 .I rusage
230 構造体が定義されているが、そのフィールドで使用されている
231 .I struct timeval
232 型は
233 .I <sys/time.h>
234 で定義されている)。
235
236 .\"O On Linux,
237 .\"O .BR wait3 ()
238 .\"O is a library function implemented on top of the
239 .\"O .BR wait4 ()
240 .\"O system call.
241 Linux では、
242 .BR wait3 ()
243 はライブラリ関数であり、
244 .BR wait4 ()
245 システムコールを使って実装されている。
246 .\"O .SH "SEE ALSO"
247 .SH 関連項目
248 .BR fork (2),
249 .BR getrusage (2),
250 .BR sigaction (2),
251 .BR signal (2),
252 .BR wait (2),
253 .BR signal (7)