- Get the process information of the correct team by using get_team_usage_info
instead of getrusage. - Thanks François for insisting on this. :) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34133 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
e663610e84
commit
7d39f1f137
@ -6,7 +6,9 @@
|
||||
* Bruno Albuquerque, bga@bug-br.org.br
|
||||
*/
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
#include <sys/resource.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
|
||||
@ -21,9 +23,20 @@ pid_t
|
||||
wait4(pid_t pid, int *status, int options, struct rusage *rusage)
|
||||
{
|
||||
pid_t waitPid = waitpid(pid, status, options);
|
||||
if (waitPid != -1)
|
||||
getrusage(RUSAGE_CHILDREN, rusage);
|
||||
if (waitPid != -1) {
|
||||
team_usage_info info;
|
||||
|
||||
// Obtain info for the process that changed state.
|
||||
if (get_team_usage_info(waitPid, RUSAGE_SELF, &info) != B_OK)
|
||||
return -1;
|
||||
|
||||
rusage->ru_utime.tv_sec = info.user_time / 1000000;
|
||||
rusage->ru_utime.tv_usec = info.user_time % 1000000;
|
||||
|
||||
rusage->ru_stime.tv_sec = info.kernel_time / 1000000;
|
||||
rusage->ru_stime.tv_usec = info.kernel_time % 1000000;
|
||||
}
|
||||
|
||||
return waitPid;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user