getpriority.c 751 B

12345678910111213141516171819202122232425262728293031
  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. #include <sys/syscall.h>
  10. #include <sys/resource.h>
  11. libc_hidden_proto(getpriority)
  12. #define __NR___syscall_getpriority __NR_getpriority
  13. static inline _syscall2(int, __syscall_getpriority,
  14. __priority_which_t, which, id_t, who);
  15. /* The return value of __syscall_getpriority is biased by this value
  16. * to avoid returning negative values. */
  17. #define PZERO 20
  18. int getpriority(__priority_which_t which, id_t who)
  19. {
  20. int res;
  21. res = __syscall_getpriority(which, who);
  22. if (res >= 0)
  23. res = PZERO - res;
  24. return res;
  25. }
  26. libc_hidden_def(getpriority)