Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.

2016-09-21 Thread Olaf Buddenhagen
Hi, On Wed, Aug 31, 2016 at 02:16:12PM +0200, Samuel Thibault wrote: > Linux' notion of nice values is already not > really POSIX for root :) (POSIX doesn't define negative nice values). It's been a while; but I'm almost confident that according to my last reading of the POSIX man pages, the Lin

Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.

2016-09-01 Thread Samuel Thibault
Svante Signell, on Thu 01 Sep 2016 12:44:04 +0200, wrote: > On Wed, 2016-08-31 at 14:16 +0200, Samuel Thibault wrote: > > Svante Signell, on Wed 31 Aug 2016 14:10:22 +0200, wrote: > > > > > >  > > > I would expect values [-20,19] to be OK converted to [5,44] with > > > #define NICE_TO_MACH_PRIORIT

Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.

2016-09-01 Thread Svante Signell
On Wed, 2016-08-31 at 14:16 +0200, Samuel Thibault wrote: > Svante Signell, on Wed 31 Aug 2016 14:10:22 +0200, wrote: > > > >  > > I would expect values [-20,19] to be OK converted to [5,44] with > > #define NICE_TO_MACH_PRIORITY(nice) ((nice) + 25) from hurd/hurd/resource.h > > and  > > #define i

Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.

2016-08-31 Thread Samuel Thibault
Svante Signell, on Wed 31 Aug 2016 14:10:22 +0200, wrote: > On Wed, 2016-08-31 at 13:51 +0200, Samuel Thibault wrote: > > Svante Signell, on Wed 31 Aug 2016 13:42:58 +0200, wrote: > > > > > >  > > > Which is the original bug then? > > You didn't say what application you are actually trying to fix,

Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.

2016-08-31 Thread Svante Signell
On Wed, 2016-08-31 at 13:51 +0200, Samuel Thibault wrote: > Svante Signell, on Wed 31 Aug 2016 13:42:58 +0200, wrote: > > > >  > > Which is the original bug then? > You didn't say what application you are actually trying to fix, but the > issue you have shown is that task_priority returns permissi

Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.

2016-08-31 Thread Samuel Thibault
Svante Signell, on Wed 31 Aug 2016 13:42:58 +0200, wrote: > On Wed, 2016-08-31 at 13:28 +0200, Samuel Thibault wrote: > > Svante Signell, on Wed 31 Aug 2016 13:24:34 +0200, wrote: > > > > Re-read your test again: it requests nice -19, i.e. something which is > > > > reserved to root. No wonder you

Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.

2016-08-31 Thread Svante Signell
On Wed, 2016-08-31 at 13:28 +0200, Samuel Thibault wrote: > Svante Signell, on Wed 31 Aug 2016 13:24:34 +0200, wrote: > >  > > > > > > Re-read your test again: it requests nice -19, i.e. something which is > > > reserved to root. No wonder you are getting a permission denied. > > Explain please, I

Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.

2016-08-31 Thread Samuel Thibault
Svante Signell, on Wed 31 Aug 2016 13:24:34 +0200, wrote: > On Wed, 2016-08-31 at 12:58 +0200, Samuel Thibault wrote: > > Svante Signell, on Wed 31 Aug 2016 12:35:26 +0200, wrote: > > > > > > The attached patch changes this fixing the previous: > > > check_setpriority: can't set priority: Permissi

Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.

2016-08-31 Thread Svante Signell
On Wed, 2016-08-31 at 12:58 +0200, Samuel Thibault wrote: > Svante Signell, on Wed 31 Aug 2016 12:35:26 +0200, wrote: > > > > The attached patch changes this fixing the previous: > > check_setpriority: can't set priority: Permission denied > > > > -   prierr = __task_priority (task, NICE_TO_MAC

Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.

2016-08-31 Thread Samuel Thibault
Svante Signell, on Wed 31 Aug 2016 12:35:26 +0200, wrote: > The attached patch changes this fixing the previous: > check_setpriority: can't set priority: Permission denied > > - prierr = __task_priority (task, NICE_TO_MACH_PRIORITY (prio), 1); > + prierr = __task_priority (task, NICE_T

RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.

2016-08-31 Thread Svante Signell
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