ulimit.cpp 900 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2022, Lucas Chollet <lucas.chollet@free.fr>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include <AK/Format.h>
  8. #include <assert.h>
  9. #include <sys/resource.h>
  10. #include <syscall.h>
  11. #include <ulimit.h>
  12. extern "C" {
  13. long ulimit([[maybe_unused]] int cmd, [[maybe_unused]] long newlimit)
  14. {
  15. dbgln("FIXME: Implement ulimit()");
  16. TODO();
  17. return -1;
  18. }
  19. // https://pubs.opengroup.org/onlinepubs/009696699/functions/getrusage.html
  20. int getrusage(int who, struct rusage* usage)
  21. {
  22. int rc = syscall(SC_getrusage, who, usage);
  23. __RETURN_WITH_ERRNO(rc, rc, -1);
  24. }
  25. int getrlimit([[maybe_unused]] int resource, rlimit* rl)
  26. {
  27. rl->rlim_cur = RLIM_INFINITY;
  28. rl->rlim_max = RLIM_INFINITY;
  29. return 0;
  30. }
  31. int setrlimit([[maybe_unused]] int resource, [[maybe_unused]] rlimit const* rl)
  32. {
  33. return 0;
  34. }
  35. }