2 * Copyright 2009, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Bruno Albuquerque, bga@bug-br.org.br
11 #include <sys/resource.h>
15 extern pid_t
_waitpid(pid_t pid
, int* _status
, int options
,
16 team_usage_info
*usage_info
);
20 wait3(int *status
, int options
, struct rusage
*rusage
)
22 return wait4(-1, status
, options
, rusage
);
27 wait4(pid_t pid
, int *status
, int options
, struct rusage
*rusage
)
30 pid_t waitPid
= _waitpid(pid
, status
, options
,
31 rusage
!= NULL
? &info
: NULL
);
32 if (waitPid
!= -1 && rusage
!= NULL
) {
33 rusage
->ru_utime
.tv_sec
= info
.user_time
/ 1000000;
34 rusage
->ru_utime
.tv_usec
= info
.user_time
% 1000000;
36 rusage
->ru_stime
.tv_sec
= info
.kernel_time
/ 1000000;
37 rusage
->ru_stime
.tv_usec
= info
.kernel_time
% 1000000;