Skip to content

Commit

Permalink
LibC: Add a wrapper for the getrusage syscall
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasChollet authored and awesomekling committed Feb 28, 2022
1 parent 839d3d9 commit 8a9a9fa
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Userland/Libraries/LibC/ulimit.cpp
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)
Expand Down

0 comments on commit 8a9a9fa

Please sign in to comment.