summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1998-11-27 11:44:22 +0000
committerdg <dg@FreeBSD.org>1998-11-27 11:44:22 +0000
commitb4bceb0b079d736c80f4455cc03d60f529339dc8 (patch)
tree7d8ff7e49231c3c4302211dbe51229c0c730966f /sys
parent3e9a76f2a538a75a101081c1c8a59de72a559c59 (diff)
downloadFreeBSD-src-b4bceb0b079d736c80f4455cc03d60f529339dc8.zip
FreeBSD-src-b4bceb0b079d736c80f4455cc03d60f529339dc8.tar.gz
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.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_synch.c5
1 files changed, 3 insertions, 2 deletions
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");
OpenPOWER on IntegriCloud