mirror of git://git.musl-libc.org/musl
add prlimit syscall wrapper
This commit is contained in:
parent
0b6dc09744
commit
26f38328d6
|
@ -470,6 +470,7 @@ static inline long __syscall6(long __n, long __a1, long __a2, long __a3, long __
|
|||
#define __NR_inotify_init1 332
|
||||
#define __NR_preadv 333
|
||||
#define __NR_pwritev 334
|
||||
#define __NR_prlimit64 340
|
||||
|
||||
/* fixup legacy 16-bit junk */
|
||||
#undef __NR_lchown
|
||||
|
@ -881,6 +882,7 @@ static inline long __syscall6(long __n, long __a1, long __a2, long __a3, long __
|
|||
#define SYS_inotify_init1 332
|
||||
#define SYS_preadv 333
|
||||
#define SYS_pwritev 334
|
||||
#define SYS_prlimit64 340
|
||||
|
||||
/* fixup legacy 16-bit junk */
|
||||
#undef SYS_lchown
|
||||
|
|
|
@ -9,6 +9,10 @@ extern "C" {
|
|||
#define __NEED_time_t
|
||||
#define __NEED_struct_timeval
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
#define __NEED_pid_t
|
||||
#endif
|
||||
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
typedef unsigned long long rlim_t;
|
||||
|
@ -49,6 +53,10 @@ int getrusage (int, struct rusage *);
|
|||
int getpriority (int, id_t);
|
||||
int setpriority (int, id_t, int);
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
int prlimit(pid_t, int, const struct rlimit *, struct rlimit *);
|
||||
#endif
|
||||
|
||||
#define PRIO_PROCESS 0
|
||||
#define PRIO_PGRP 1
|
||||
#define PRIO_USER 2
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#include <unistd.h>
|
||||
#include <sys/resource.h>
|
||||
#include "syscall.h"
|
||||
|
||||
int prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlimit *old_limit)
|
||||
{
|
||||
return syscall(SYS_prlimit64, pid, resource, new_limit, old_limit);
|
||||
}
|
Loading…
Reference in New Issue