1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 07:54:58 +00:00

LibC: Add a wrapper for the getrusage syscall

This commit is contained in:
Lucas CHOLLET 2022-01-31 23:14:49 +01:00 committed by Andreas Kling
parent 839d3d9f74
commit 8a9a9fac4d

View file

@ -1,5 +1,6 @@
/* /*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022, Lucas Chollet <lucas.chollet@free.fr>
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
@ -7,21 +8,23 @@
#include <AK/Format.h> #include <AK/Format.h>
#include <assert.h> #include <assert.h>
#include <sys/resource.h> #include <sys/resource.h>
#include <syscall.h>
#include <ulimit.h> #include <ulimit.h>
extern "C" { extern "C" {
long ulimit([[maybe_unused]] int cmd, [[maybe_unused]] long newlimit) long ulimit([[maybe_unused]] int cmd, [[maybe_unused]] long newlimit)
{ {
dbgln("FIXME: Implement getrusage()"); dbgln("FIXME: Implement ulimit()");
TODO(); TODO();
return -1; 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()"); int rc = syscall(SC_getrusage, who, usage);
return -1; __RETURN_WITH_ERRNO(rc, rc, -1);
} }
int getrlimit([[maybe_unused]] int resource, rlimit* rl) int getrlimit([[maybe_unused]] int resource, rlimit* rl)