getpriority.c 698 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * getpriority() for uClibc
  3. *
  4. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <sys/syscall.h>
  9. #include <sys/resource.h>
  10. #define __NR___syscall_getpriority __NR_getpriority
  11. static __inline__ _syscall2(int, __syscall_getpriority,
  12. __priority_which_t, which, id_t, who)
  13. /* The return value of __syscall_getpriority is biased by this value
  14. * to avoid returning negative values. */
  15. #define PZERO 20
  16. int getpriority(__priority_which_t which, id_t who)
  17. {
  18. int res;
  19. res = __syscall_getpriority(which, who);
  20. if (res >= 0)
  21. res = PZERO - res;
  22. return res;
  23. }
  24. libc_hidden_def(getpriority)