OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[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)