[PATCH] cputime_t patches broke RLIMIT_CPU

From: Roland McGrath
Date: Wed Jan 19 2005 - 15:57:19 EST


The RLIMIT_CPU limit is in seconds, not in jiffies.

Signed-off-by: Roland McGrath <roland@xxxxxxxxxx>

--- linux-2.6/kernel/sched.c
+++ linux-2.6/kernel/sched.c
@@ -2301,14 +2327,14 @@ static void check_rlimit(struct task_str
cputime_t total, tmp;

total = cputime_add(p->utime, p->stime);
- tmp = jiffies_to_cputime(p->signal->rlim[RLIMIT_CPU].rlim_cur);
+ tmp = secs_to_cputime(p->signal->rlim[RLIMIT_CPU].rlim_cur);
if (unlikely(cputime_gt(total, tmp))) {
/* Send SIGXCPU every second. */
tmp = cputime_sub(total, cputime);
if (cputime_to_secs(tmp) < cputime_to_secs(total))
send_sig(SIGXCPU, p, 1);
/* and SIGKILL when we go over max.. */
- tmp = jiffies_to_cputime(p->signal->rlim[RLIMIT_CPU].rlim_max);
+ tmp = secs_to_cputime(p->signal->rlim[RLIMIT_CPU].rlim_max);
if (cputime_gt(total, tmp))
send_sig(SIGKILL, p, 1);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/