From d389f8f3bc5c73bb83fe54e39d77946a2f57901b Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 28 Aug 2002 03:34:38 +0000 Subject: Fix broken getpriority syscall, per email from Marshall M. Midden -Erik --- libc/sysdeps/linux/common/syscalls.c | 17 +++++++++++++++-- 1 file 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 -_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 -- cgit v1.2.3