From 644c242081dde9853c049e34b6fead1aa27689bb Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Wed, 10 Nov 2004 08:27:54 +0000 Subject: [PATCH] The min() and max() macros in sys/libkern.h are typed u_int and thus do not do the right things when handed negative numbers. Use MIN and MAX instead. This was causing renice -N processes to wrap back around to the worst priority instead of MIN()'ing to the best priority. --- sys/kern/kern_synch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index a6edf6bc55..50afd92622 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -37,7 +37,7 @@ * * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95 * $FreeBSD: src/sys/kern/kern_synch.c,v 1.87.2.6 2002/10/13 07:29:53 kbyanc Exp $ - * $DragonFly: src/sys/kern/kern_synch.c,v 1.37 2004/09/17 01:09:09 joerg Exp $ + * $DragonFly: src/sys/kern/kern_synch.c,v 1.38 2004/11/10 08:27:54 dillon Exp $ */ #include "opt_ktrace.h" @@ -760,8 +760,8 @@ resetpriority(struct proc *p) interactive = p->p_interactive / 10; newpriority += interactive; - newpriority = min(newpriority, MAXPRI); - newpriority = max(newpriority, 0); + newpriority = MIN(newpriority, MAXPRI); + newpriority = MAX(newpriority, 0); npq = newpriority / PPQ; crit_enter(); opq = (p->p_priority & PRIMASK) / PPQ; -- 2.35.2