diff --git a/Userland/Libraries/LibC/ulimit.cpp b/Userland/Libraries/LibC/ulimit.cpp index 4fa0e5fd370..6ca11d33704 100644 --- a/Userland/Libraries/LibC/ulimit.cpp +++ b/Userland/Libraries/LibC/ulimit.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2022, Lucas Chollet * * SPDX-License-Identifier: BSD-2-Clause */ @@ -7,21 +8,23 @@ #include #include #include +#include #include extern "C" { long ulimit([[maybe_unused]] int cmd, [[maybe_unused]] long newlimit) { - dbgln("FIXME: Implement getrusage()"); + dbgln("FIXME: Implement ulimit()"); TODO(); return -1; } -int getrusage([[maybe_unused]] int who, [[maybe_unused]] struct rusage* usage) +// https://pubs.opengroup.org/onlinepubs/009696699/functions/getrusage.html +int getrusage(int who, struct rusage* usage) { - dbgln("FIXME: Implement getrusage()"); - return -1; + int rc = syscall(SC_getrusage, who, usage); + __RETURN_WITH_ERRNO(rc, rc, -1); } int getrlimit([[maybe_unused]] int resource, rlimit* rl)