feat(resource): rlimit/rusage/priority
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include "../internal/syscall.h"
|
||||
|
||||
#if VLIBC_LEVEL_GE(2)
|
||||
|
||||
/*
|
||||
* setrlimit/setrlimit64 (todo 31).
|
||||
*
|
||||
* The write side of the prlimit64 ABI: (pid = 0, resource,
|
||||
* new_limit = &rlim, old_limit = NULL). struct rlimit is the kernel's
|
||||
* struct rlimit64 layout on x86_64, so the record passes through without
|
||||
* conversion; the kernel rejects a soft limit above the hard limit with
|
||||
* EINVAL and a hard-limit raise without CAP_SYS_RESOURCE with EPERM.
|
||||
*
|
||||
* setrlimit64 is a name-only distinction on this architecture (rlim_t is
|
||||
* already 64 bits); it exists as a separate exported symbol for LFS
|
||||
* callers.
|
||||
*/
|
||||
int
|
||||
setrlimit(int resource, const struct rlimit *rlim)
|
||||
{
|
||||
return syscall_ret(__syscall4(SYS_prlimit64, 0, (long)resource, (long)rlim, 0));
|
||||
}
|
||||
|
||||
int
|
||||
setrlimit64(int resource, const struct rlimit *rlim)
|
||||
{
|
||||
return setrlimit(resource, rlim);
|
||||
}
|
||||
|
||||
#endif /* VLIBC_LEVEL_GE(2) */
|
||||
Reference in New Issue
Block a user