feat(resource): rlimit/rusage/priority

This commit is contained in:
2026-09-05 22:55:20 -04:00
parent c4156efeff
commit 3ab43c7f10
8 changed files with 668 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <sys/resource.h>
#include "../internal/syscall.h"
#if VLIBC_LEVEL_GE(2)
/*
* getrlimit/getrlimit64 (todo 31).
*
* x86_64 has no getrlimit syscall; the prlimit64 ABI serves the read with
* (pid = 0, resource, new_limit = NULL, old_limit = &rlim). struct rlimit
* is two 64-bit words here — the same layout as the kernel's struct
* rlimit64 — so the record passes through without conversion.
*
* getrlimit64 is a name-only distinction on this architecture (rlim_t is
* already 64 bits); it exists as a separate exported symbol so LFS callers
* that reference it link cleanly.
*/
int
getrlimit(int resource, struct rlimit *rlim)
{
return syscall_ret(__syscall4(SYS_prlimit64, 0, (long)resource, 0, (long)rlim));
}
int
getrlimit64(int resource, struct rlimit *rlim)
{
return getrlimit(resource, rlim);
}
#endif /* VLIBC_LEVEL_GE(2) */