getpriority.c 685 B

12345678910111213141516171819202122232425262728
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * getpriority() for uClibc
  4. *
  5. * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
  6. *
  7. * GNU Library General Public License (LGPL) version 2 or later.
  8. */
  9. #include "syscalls.h"
  10. #include <sys/resource.h>
  11. #define __NR___syscall_getpriority __NR_getpriority
  12. static inline _syscall2(int, __syscall_getpriority,
  13. __priority_which_t, which, id_t, who);
  14. /* The return value of __syscall_getpriority is biased by this value
  15. * to avoid returning negative values. */
  16. #define PZERO 20
  17. int getpriority(enum __priority_which which, id_t who)
  18. {
  19. int res;
  20. res = __syscall_getpriority(which, who);
  21. if (res >= 0)
  22. res = PZERO - res;
  23. return res;
  24. }