getpriority.c 723 B

123456789101112131415161718192021222324252627282930
  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. #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(__priority_which_t 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. }
  25. libc_hidden_def(getpriority)