From 7177da7d62891fc1ccf30c81f9983414a1dd2e23 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 17 Sep 2024 15:59:22 +0300 Subject: [PATCH] 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 --- userspace/libraries/LibC/sys/resource.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/userspace/libraries/LibC/sys/resource.cpp b/userspace/libraries/LibC/sys/resource.cpp index e21c99a1..aca16eae 100644 --- a/userspace/libraries/LibC/sys/resource.cpp +++ b/userspace/libraries/LibC/sys/resource.cpp @@ -1,7 +1,20 @@ #include +#include #include -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; }