Implemented getrusage
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10241 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,19 +1,30 @@
|
|||||||
/*
|
/*
|
||||||
|
** Copyright 2004, JérômDuval, [email protected].
|
||||||
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
** Distributed under the terms of the Haiku License.
|
** Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <OS.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <syscalls.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
getrusage(int who, struct rusage *rusage)
|
getrusage(int who, struct rusage *rusage)
|
||||||
{
|
{
|
||||||
// ToDo: implement me!
|
team_usage_info info;
|
||||||
errno = B_BAD_VALUE;
|
|
||||||
return -1;
|
if (get_team_usage_info(B_CURRENT_TEAM, who, &info) != B_OK) {
|
||||||
|
errno = B_BAD_VALUE;
|
||||||
|
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 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user