LibC: Implement dummy get_rusage

One port seems to use this function. This dummy just reports no used CPU
time for current process nor children
This commit is contained in:
Bananymous 2024-09-17 15:59:22 +03:00
parent 5e4aa75e03
commit 7177da7d62
1 changed files with 15 additions and 2 deletions

View File

@ -1,7 +1,20 @@
#include <BAN/Assert.h>
#include <errno.h>
#include <sys/resource.h>
int getrusage(int, struct rusage*)
int getrusage(int who, struct rusage* r_usage)
{
ASSERT_NOT_REACHED();
if (who != RUSAGE_CHILDREN && who != RUSAGE_SELF)
{
errno = EINVAL;
return -1;
}
r_usage->ru_stime.tv_sec = 0;
r_usage->ru_stime.tv_usec = 0;
r_usage->ru_utime.tv_sec = 0;
r_usage->ru_utime.tv_usec = 0;
return 0;
}