summaryrefslogtreecommitdiffstats
path: root/libc/sysdeps
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-08-28 03:34:38 +0000
committerEric Andersen <andersen@codepoet.org>2002-08-28 03:34:38 +0000
commitd389f8f3bc5c73bb83fe54e39d77946a2f57901b (patch)
treee3b38c25feccea3d50dfe431d310bee4aa9ab5d4 /libc/sysdeps
parent033caa0a43fed8a298fa1e5a00f05e9bcd111cd7 (diff)
downloaduClibc-alpine-d389f8f3bc5c73bb83fe54e39d77946a2f57901b.tar.bz2
uClibc-alpine-d389f8f3bc5c73bb83fe54e39d77946a2f57901b.tar.xz
Fix broken getpriority syscall, per email from Marshall M. Midden
-Erik
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/common/syscalls.c17
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