From b4bceb0b079d736c80f4455cc03d60f529339dc8 Mon Sep 17 00:00:00 2001 From: dg Date: Fri, 27 Nov 1998 11:44:22 +0000 Subject: Compare p_cpulimit with RLIM_INFINITY before comparing it with the process runtime. p_runtime is unsigned while p_cpulimit is not, so this avoids the nasty side effect of the process getting killed when the runtime comes up "negative" due to other bugs. --- sys/kern/kern_synch.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c index 40fcdcc..a659f70 100644 --- a/sys/kern/kern_synch.c +++ b/sys/kern/kern_synch.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_synch.c 8.9 (Berkeley) 5/19/95 - * $Id: kern_synch.c,v 1.67 1998/11/26 14:05:58 bde Exp $ + * $Id: kern_synch.c,v 1.68 1998/11/26 16:49:55 bde Exp $ */ #include "opt_ktrace.h" @@ -650,7 +650,8 @@ mi_switch() * Check if the process exceeds its cpu resource allocation. * If over max, kill it. */ - if (p->p_stat != SZOMB && p->p_runtime > p->p_limit->p_cpulimit) { + if (p->p_stat != SZOMB && p->p_limit->p_cpulimit != RLIM_INFINITY && + p->p_runtime > p->p_limit->p_cpulimit) { rlim = &p->p_rlimit[RLIMIT_CPU]; if (p->p_runtime / (rlim_t)1000000 >= rlim->rlim_max) { killproc(p, "exceeded maximum CPU limit"); -- cgit v1.1