On 09/11/2025 11:00, Pádraig Brady wrote:
On 09/11/2025 07:17, Collin Funk wrote:
Collin Funk <[email protected]> writes:
That test program assumes that nice() does not clamp the niceness to the
supported range as it is supposed to [1]. This is the case on GNU/Hurd,
so I will submit a bug report for that later.
The output is the same on a normal and privileged user:
$ gcc main.c ./a.out
starting nice: 0
minimum nice: 0
maximum nice: 38
minimum errno: EPERM
maximum errno: ESRCH
This patch clamps it to the supported range and adds some tests. Here is
the corrected behavior:
$ ./src/nice -n +100 ./src/nice
38
Actually my original patch did not work if 'nice' was invoked with a
niceness greater than zero. This v2 patch fixes that and adds more
tests.
That's restricted to Hurd so looks safe to push.
I should add that this should be reported to Hurd also,
so it's a layering violation to do the workaround in user space,
as we can't do it robustly because of races.
cheers,
Padraig