>Synopsis: setpriority(2) returns EACCES instead of EPERM
>Arrival-Date: Mon May 25 14:40:01 +0000 2009
>Originator: Stathis Kamperis
>Release: NetBSD 5.0_STABLE
Aristotle University of Thessaloniki
NetBSD voyager 5.0_STABLE NetBSD 5.0_STABLE (GENERIC) #10: Fri May 22 17:59:56
EEST 2009 stathis@voyager:/usr/obj/sys/arch/i386/compile/GENERIC i386
According to POSIX's description for setpriority(2):
A process was located, but neither the real nor effective user ID of the
executing process match the effective user ID of the process whose nice value
is being changed.
OTOH, if I try to change the priority of init process I get EACCES. Mind that I
don't try to increase/lower it. I just re-set it to 0.
Call this and examine errno variable:
setpriority(PRIO_PROCESS, /* init */ 1, /* nice */ 0);