[hurd, commited] hurd: make setpriority clamp nice values to 0..2*NZERO-1 [BZ #33614]
Collin Funk
collin.funk1@gmail.com
Sun Nov 9 19:50:50 GMT 2025
Samuel Thibault <samuel.thibault@ens-lyon.org> writes:
> ---
> sysdeps/mach/hurd/setpriority.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/sysdeps/mach/hurd/setpriority.c b/sysdeps/mach/hurd/setpriority.c
> index f1ef46ca26..aff2014457 100644
> --- a/sysdeps/mach/hurd/setpriority.c
> +++ b/sysdeps/mach/hurd/setpriority.c
> @@ -17,6 +17,7 @@
>
> #include <hurd.h>
> #include <hurd/resource.h>
> +#include <sys/param.h>
>
> /* Set the priority of all processes specified by WHICH and WHO
> to PRIO. Returns 0 on success, -1 on errors. */
> @@ -27,6 +28,8 @@ __setpriority (enum __priority_which which, id_t who, int prio)
> error_t pidloser, priloser;
> unsigned int npids, ntasks, nwin, nperm, nacces;
>
> + prio = MAX (0, MIN (2 * NZERO - 1, prio));
> +
> error_t setonepriority (pid_t pid, struct procinfo *pi)
> {
> task_t task;
Isn't NZERO defined to 20 on Hurd? That means (2 * NZERO - 1) == 39, but
Hurd's max niceness is 38.
Collin
More information about the Libc-alpha
mailing list