[uClibc]getpriority system call

Marshall M. Midden m4 at brecis.com
Mon Aug 19 17:02:08 UTC 2002


glibc has the following to fix the fact that linux returns a positive value
for the system call.

sysdeps/unix/sysv/linux/getpriority.c:
------------------------------------------------------------------------------
...
extern int __syscall_getpriority (int, id_t);

/* The return value of __syscall_getpriority is biased by this value
   to avoid returning negative values.  */
#define PZERO 20

/* Return the highest priority of any process specified by WHICH and WHO
   (see above); if WHO is zero, the current process, process group, or user
   (as specified by WHO) is used.  A lower priority number means higher
   priority.  Priorities range from PRIO_MIN to PRIO_MAX.  */

int
getpriority (enum __priority_which which, id_t who)
{
  int res;

  res = INLINE_SYSCALL (getpriority, 2, (int) which, who);
  if (res >= 0)
    res = PZERO - res;
  return res;
}
------------------------------------------------------------------------------
I think linux is broken, and the kernel should be fixed -- instead of kludging
uclibc.



More information about the uClibc mailing list