[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RFC: [PATCH] Fix setpriority calling __task_priority() for processes ins

From: Svante Signell
Subject: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.
Date: Wed, 31 Aug 2016 12:35:26 +0200


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
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


Attachment: sysdeps_mach_hurd_setpriority.c.diff
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]