Re: nice: clamp the niceness correctly on GNU/Hurd
From:
Collin Funk
Subject:
Re: nice: clamp the niceness correctly on GNU/Hurd
Date:
Sat, 08 Nov 2025 23:17:45 -0800
User-agent:
Gnus/5.13 (Gnus v5.13)
Collin Funk <collin.funk1@gmail.com> 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.
Collin