diff options
-rw-r--r-- | libc/sysdeps/linux/common/syscalls.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c index 1b31f7603..54eb744ba 100644 --- a/libc/sysdeps/linux/common/syscalls.c +++ b/libc/sysdeps/linux/common/syscalls.c @@ -870,9 +870,22 @@ _syscall3(int, fchown, int, fd, uid_t, owner, gid_t, group); #endif //#define __NR_getpriority 96 -#ifdef L_getpriority +#ifdef L___syscall_getpriority #include <sys/resource.h> -_syscall2(int, getpriority, __priority_which_t, which, id_t, who); +#define __NR___syscall_getpriority __NR_getpriority +_syscall2(int, __syscall_getpriority, __priority_which_t, which, id_t, who); +/* The return value of __syscall_getpriority is biased by this value + * to avoid returning negative values. */ +#define PZERO 20 +int getpriority (enum __priority_which which, id_t who) +{ + int res; + + res = __syscall_getpriority(which, who); + if (res >= 0) + res = PZERO - res; + return res; +} #endif //#define __NR_setpriority 97 |