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(): _BSD_SOURCE
23       wait4(): _BSD_SOURCE || _XOPEN_SOURCE >= 500
24

DESCRIPTION

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

RETURN VALUE

55       As for waitpid(2).
56

ERRORS

58       As for waitpid(2).
59

CONFORMING TO

61       4.3BSD.
62

NOTES

64       Including <sys/time.h> is not required these days, but increases porta‐
65       bility.  (Indeed, <sys/resource.h> defines the  rusage  structure  with
66       fields of type struct timeval defined in <sys/time.h>.)
67
68       On  Linux,  wait3()  is  a  library  function implemented on top of the
69       wait4() system call.
70

SEE ALSO

72       fork(2), getrusage(2), sigaction(2), signal(2), wait(2), signal(7)
73

COLOPHON

75       This page is part of release 3.22 of the Linux  man-pages  project.   A
76       description  of  the project, and information about reporting bugs, can
77       be found at http://www.kernel.org/doc/man-pages/.
78
79
80
81Linux                             2008-09-28                          WAIT4(2)
Impressum