1WAIT4(2)                   Linux Programmer's Manual                  WAIT4(2)
2
3
4

NAME

6       wait3, wait4 - wait for process to change state, BSD style
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <sys/time.h>
11       #include <sys/resource.h>
12       #include <sys/wait.h>
13
14       pid_t wait3(int *status, int options,
15                   struct rusage *rusage);
16
17       pid_t wait4(pid_t pid, int *status, int options,
18                   struct rusage *rusage);
19
20   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
21
22       wait3():
23           _BSD_SOURCE || _XOPEN_SOURCE >= 500 ||
24           _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
25       wait4():
26           _BSD_SOURCE
27

DESCRIPTION

29       These functions are obsolete; use waitpid(2) or waitid(2) in  new  pro‐
30       grams.
31
32       The  wait3()  and  wait4()  system calls are similar to waitpid(2), but
33       additionally return resource usage information about the child  in  the
34       structure pointed to by rusage.
35
36       Other than the use of the rusage argument, the following wait3() call:
37
38           wait3(status, options, rusage);
39
40       is equivalent to:
41
42           waitpid(-1, status, options);
43
44       Similarly, the following wait4() call:
45
46           wait4(pid, status, options, rusage);
47
48       is equivalent to:
49
50           waitpid(pid, status, options);
51
52       In  other  words, wait3() waits of any child, while wait4() can be used
53       to select a specific child, or children, on which to wait.  See wait(2)
54       for further details.
55
56       If  rusage  is  not  NULL, the struct rusage to which it points will be
57       filled with accounting information about the child.   See  getrusage(2)
58       for details.
59

RETURN VALUE

61       As for waitpid(2).
62

ERRORS

64       As for waitpid(2).
65

CONFORMING TO

67       4.3BSD.
68
69       SUSv1  included a specification of wait3(); SUSv2 included wait3(), but
70       marked it LEGACY; SUSv3 removed it.
71

NOTES

73       Including <sys/time.h> is not required these days, but increases porta‐
74       bility.   (Indeed,  <sys/resource.h>  defines the rusage structure with
75       fields of type struct timeval defined in <sys/time.h>.)
76
77       On Linux, wait3() is a library  function  implemented  on  top  of  the
78       wait4() system call.
79

SEE ALSO

81       fork(2), getrusage(2), sigaction(2), signal(2), wait(2), signal(7)
82

COLOPHON

84       This  page  is  part of release 3.53 of the Linux man-pages project.  A
85       description of the project, and information about reporting  bugs,  can
86       be found at http://www.kernel.org/doc/man-pages/.
87
88
89
90Linux                             2012-09-23                          WAIT4(2)
Impressum