On Tue, Jan 09, 2007 at 07:19:29PM +0300, Alexei Sheplyakov wrote:
> chpst -n seems to always sets the nice value to 19 on x86_64, no 
> matter what argument has been given:
> 
> $ chpst -n 5 ps -l
> F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
> 0 S  1000 11267 10824  0  75   0 -  2634 -      pts/7    00:00:00 bash
> 0 R  1000 11742 11267  0  97  19 -  1892 -      pts/7    00:00:00 ps
> 
> On the other hand, chpst works just fine on x86:
> 
> [on the x86 box]
> $ chpst -n 5 ps -l
> F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
> 0 S  1000 14282 23386  4  75   0 -  2928 -      pts/3    00:00:00 bash
> 0 R  1000  5586 14282  0  82   5 -  1827 -      pts/3    00:00:00 ps
> 
> 
> [on the x86_64 box]
> $ strace -f chpst -n 5 /bin/true 2>&1 | head -n 5
> execve("/usr/bin/chpst", ["chpst", "-n", "5", "/bin/true"], [/* 68 vars */]) 
> = 0
> getpriority(PRIO_PROCESS, 0)            = 20
> setpriority(PRIO_PROCESS, 0, 25)        = 0
> getpriority(PRIO_PROCESS, 0)            = 1
> execve("/bin/true", ["/bin/true"], [/* 68 vars */]) = 0
> 
> On Linux, "getpriority()" will not return the normal nice-value, but
> a negated value that has been offset by 20 (ie it returns 40..1 instead
> of -20..19) to avoid negative return values.
> 
> On the other hand, "setpriority" accepts _regular_ nice value in the
> range -20..19. chpst seems to ignore this difference and sets wrong
> nice value as a result.

Thanks for the report, Alexei.

> x86 is not affected since chpst uses "nice" system call here:

The bug actually is in the dietlibc; not in runit's chpst, which uses
nice() on all archs.

Regards, Gerrit.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to