OSDN Git Service

(split) LDP: Restore and add Copyrights for draft pages
[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 .\"
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>
48 .\"
49 .TH WAIT4 2 2012\-09\-23 Linux "Linux Programmer's Manual"
50 .SH 名前
51 wait3, wait4 \- BSD スタイルでプロセスの状態変化を待つ
52 .SH 書式
53 .nf
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
58 .sp
59 \fBpid_t wait3(int *\fP\fIstatus\fP\fB, int \fP\fIoptions\fP\fB,\fP
60 \fB            struct rusage *\fP\fIrusage\fP\fB);\fP
61 .sp
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
64 .fi
65 .sp
66 .in -4n
67 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
68 .in
69 .sp
70 .ad l
71 \fBwait3\fP():
72 .RS 4
73 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
74 .RE
75 .br
76 \fBwait4\fP():
77 .RS 4
78 _BSD_SOURCE
79 .RE
80 .ad
81 .SH 説明
82 これらの関数は廃止予定である。 新しいプログラムでは \fBwaitpid\fP(2) や \fBwaitid\fP(2) を使用すること。
83
84 システムコール \fBwait3\fP()  と \fBwait4\fP()  は \fBwaitpid\fP(2)
85 と同様の動作をする。それに加え、子プロセスのリソース使用状況の情報を \fIrusage\fP が指す構造体に入れて返す。
86 .PP
87 \fIrusage\fP を使用する点を除けば、次の \fBwait3\fP()  の呼び出し
88 .nf
89
90     wait3(status, options, rusage);
91
92 .fi
93 は以下と等価である。
94 .nf
95
96     waitpid(\-1, status, options);
97
98 .fi
99 同様に、次の \fBwait4\fP()  の呼び出し
100 .nf
101
102     wait4(pid, status, options, rusage);
103
104 .fi
105 は以下と等価である。
106 .nf
107
108     waitpid(pid, status, options);
109
110 .fi
111 言い換えると、 \fBwait3\fP()  は全ての子プロセスを対象に待つが、 \fBwait4\fP()  では特定の子プロセス (複数可)
112 を選んで待つことができる。
113 .PP
114 \fIrusage\fP が NULL でない場合、 \fIrusage\fP が指す \fIrusage 構造体\fP には子プロセスのアカウント情報が格納される。
115 詳しくは \fBgetrusage\fP(2)  を参照のこと。
116 .SH 返り値
117 \fBwaitpid\fP(2)  と同様。
118 .SH エラー
119 \fBwaitpid\fP(2)  と同様。
120 .SH 準拠
121 4.3BSD.
122
123 SUSv1 には \fBwait3\fP() の規定があった。 SUSv2 には \fBwait3\fP() が含まれていたが、「過去の名残
124 (LEGACY)」となっていた。 SUSv3 では \fBwait3\fP() は削除された。
125 .SH 注意
126 現在では \fI<sys/time.h>\fP をインクルードする必要はないが、インクルードしておくと 移植性を高めることができる (実際には
127 \fI<sys/resource.h>\fP で \fIrusage\fP 構造体が定義されているが、そのフィールドで使用されている
128 \fIstruct timeval\fP 型は \fI<sys/time.h>\fP で定義されている)。
129
130 Linux では、 \fBwait3\fP()  はライブラリ関数であり、 \fBwait4\fP()  システムコールを使って実装されている。
131 .SH 関連項目
132 \fBfork\fP(2), \fBgetrusage\fP(2), \fBsigaction\fP(2), \fBsignal\fP(2), \fBwait\fP(2),
133 \fBsignal\fP(7)
134 .SH この文書について
135 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
136 である。プロジェクトの説明とバグ報告に関する情報は
137 http://www.kernel.org/doc/man\-pages/ に書かれている。