Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 1 Apr 2013 15:30:06 +0100
From: Justin Cormack <>
Subject: Re: setpriority typo

On Mon, Apr 1, 2013 at 3:05 PM, Rich Felker <> 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 -

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


Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.