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       #define _BSD_SOURCE
10                       /* Or #define _XOPEN_SOURCE 500 for wait3() */
11       #include <sys/types.h>
12       #include <sys/time.h>
13       #include <sys/resource.h>
14       #include <sys/wait.h>
15
16       pid_t wait3(int *status, int options,
17             struct rusage *rusage);
18
19       pid_t wait4(pid_t pid, int *status, int options,
20             struct rusage *rusage);
21

DESCRIPTION

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

RETURN VALUE

52       As for waitpid(2).
53

ERRORS

55       As for waitpid(2).
56

NOTES

58       Including <sys/time.h> is not required these days, but increases porta‐
59       bility.  (Indeed, <sys/resource.h> defines the  rusage  structure  with
60       fields of type struct timeval defined in <sys/time.h>.)
61

CONFORMING TO

63       4.3BSD
64

SEE ALSO

66       fork(2),   getrusage(2),   sigaction(2),   signal(2),   wait(2),   fea‐
67       ture_test_macros(7), signal(7)
68
69
70
71Linux                             2004-11-11                          WAIT4(2)
Impressum