forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibC: Add a wrapper for the getrusage syscall
- Loading branch information
1 parent
839d3d9
commit 8a9a9fa
Showing
1 changed file
with
7 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
/* | ||
* Copyright (c) 2018-2020, Andreas Kling <[email protected]> | ||
* Copyright (c) 2022, Lucas Chollet <[email protected]> | ||
* | ||
* SPDX-License-Identifier: BSD-2-Clause | ||
*/ | ||
|
||
#include <AK/Format.h> | ||
#include <assert.h> | ||
#include <sys/resource.h> | ||
#include <syscall.h> | ||
#include <ulimit.h> | ||
|
||
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) | ||
|