提交 26f38328 编写于 作者: R Rich Felker

add prlimit syscall wrapper

上级 0b6dc097
......@@ -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
......
#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);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册