]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/contrib/uclibc/libc/sysdeps/linux/common/getpriority.c
update
[l4.git] / l4 / pkg / uclibc / lib / contrib / uclibc / libc / sysdeps / linux / common / getpriority.c
1 /* vi: set sw=4 ts=4: */
2 /*
3  * getpriority() for uClibc
4  *
5  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
6  *
7  * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8  */
9
10 #include <sys/syscall.h>
11 #include <sys/resource.h>
12
13
14 #define __NR___syscall_getpriority __NR_getpriority
15 static __inline__ _syscall2(int, __syscall_getpriority,
16                 __priority_which_t, which, id_t, who)
17
18 /* The return value of __syscall_getpriority is biased by this value
19  * to avoid returning negative values.  */
20 #define PZERO 20
21 int getpriority(__priority_which_t which, id_t who)
22 {
23         int res;
24
25         res = __syscall_getpriority(which, who);
26         if (res >= 0)
27                 res = PZERO - res;
28         return res;
29 }
30 libc_hidden_def(getpriority)