Hi,
Attached is a patch for the call of __task_priority() in
sysdeps/mach/hurd/setpriority.c. According to setpriority(2) and POSIX the nice
value should be per-process not per-thread.
According to: http://pubs.opengroup.org/onlinepubs/009695399/functions/getpriori
ty.html
The nice value set with setpriority() shall be applied to the process. If the
process is multi-threaded, the nice value shall affect all system scope threads
in the process.
Unfortunately the call to __task_priority() is set with the change_threads
parameter true in gnumach/kern/task.c making a simple test program fail.
cat check_setpriority.c
#include <err.h>
#include <sys/time.h>
#include <sys/resource.h>
int main ()
{
if (setpriority(PRIO_PROCESS, 0, -20) == -1)
{
warn("can't set priority");
return -1;
}
return 0;
}
The attached patch changes this fixing the previous:
check_setpriority: can't set priority: Permission denied
Thanks!
--- a/sysdeps/mach/hurd/setpriority.c.orig 2016-02-18 18:54:00.000000000 +0100
+++ b/sysdeps/mach/hurd/setpriority.c 2016-08-31 10:05:20.000000000 +0200
@@ -54,7 +54,7 @@
0, 1);
}
#else
- prierr = __task_priority (task, NICE_TO_MACH_PRIORITY (prio), 1);
+ prierr = __task_priority (task, NICE_TO_MACH_PRIORITY (prio), 0);
#endif
__mach_port_deallocate (__mach_task_self (), task);
switch (prierr)