On Mon, Apr 1, 2013 at 3:05 PM, Rich Felker <dalias@aerifal.cx> wrote:
On Mon, Apr 01, 2013 at 02:54:18PM +0100, Justin Cormack wrote:
> cat ./src/misc/setpriority.c
> #include <sys/resource.h>
> #include "syscall.h"
>
> int setpriority(int which, id_t who, int prio)
> {
> return syscall(SYS_getpriority, which, who, prio);
> }
>
>                                     ^ should be set!

This is definitely a bug, but I need to look at whether changing it
will fix the problem. getpriority is doing some transformation on the
prio value and I don't remember why, but it seems likely setpriority
might need to do the same.

Rich

From the man page:

Within the kernel, nice values are actually represented using the corresponding range 40..1
       (since negative numbers are error codes) and these are the values employed by the setpriority() and  getpriority()  system
       calls... The glibc wrapper functions for these system calls handle the translations between the user-land and kernel repre‐
       sentations of the nice value according to the formula unice = 20 - knice.

So to be compatible with glibc there should be an adjustment.

Justin