[PATCH] Fix nice
Thorsten Kukuk
kukuk@suse.de
Sat Mar 2 01:42:00 GMT 2002
On Thu, Feb 28, Jakub Jelinek wrote:
> Hi!
>
> 2001-06-04 patch for nice apparently changed nothing at all on linux, since
> sysdeps/unix/nice.c which was patched is overridden in
> sysdeps/unix/sysv/syscalls.list (nice), thus nice still returns 0 on
> success, not the actual new priority.
> Fix below. I have briefly tested that it works as expected on ia32 linux.
I found another problem: according to 1003.1-2001:
Requests for values above or below 2*{NZERO}-1 shall result in the
nice value being set to the corresponding limit.
In the moment we return "prio + incr" and fail the test. Should we
change this to a "return getpriority (PRIO_PROCESS, 0);" or should
we recalculate the return value with help of the NZERO definition?
A simple patch which works for me:
2002-03-02 Thorsten Kukuk <kukuk@suse.de>
* sysdeps/unix/nice.c: Use getpriority() for the return value
--- sysdeps/unix/nice.c
+++ sysdeps/unix/nice.c 2002/03/02 09:40:14
@@ -43,7 +43,7 @@
result = setpriority (PRIO_PROCESS, 0, prio + incr);
if (result != -1)
- return prio + incr;
+ return getpriority (PRIO_PROCESS, 0);
else
return -1;
--
Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de
SuSE Linux AG Deutschherrenstr. 15-19 D-90429 Nuernberg
--------------------------------------------------------------------
Key fingerprint = A368 676B 5E1B 3E46 CFCE 2D97 F8FD 4E23 56C6 FB4B
More information about the Libc-hacker
mailing list