2 * Copyright 2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 * Distributed under the terms of the MIT License.
11 #include <sys/resource.h>
18 wait() should wait only once. If any argument is given, waitpid() should return
19 an error (and errno to ECHILD), since there is no child with that process group ID.
31 //! exits before child 2
36 // put us into a new process group
48 main(int argc
, char** argv
)
50 bool waitForGroup
= argc
> 1;
59 memset(&usage
, 0, sizeof(usage
));
61 pid
= wait4(-1, &childStatus
, 0, &usage
);
62 printf("wait4() returned %" PRId32
" (%s), child status %" PRId32
63 ", kernel: %ld.%06" PRId32
" user: %ld.%06" PRId32
"\n",
64 pid
, strerror(errno
), childStatus
, usage
.ru_stime
.tv_sec
,
65 usage
.ru_stime
.tv_usec
, usage
.ru_utime
.tv_sec
,
66 usage
.ru_utime
.tv_usec
);