Пример #1
0
static inline int cpu_time_before(const clockid_t which_clock,
				  union cpu_time_count now,
				  union cpu_time_count then)
{
	if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {
		return now.sched < then.sched;
	}  else {
		return cputime_lt(now.cpu, then.cpu);
	}
}
Пример #2
0
/*
 * Called after updating RLIMIT_CPU to set timer expiration if necessary.
 */
void update_rlimit_cpu(unsigned long rlim_new)
{
	cputime_t cputime = secs_to_cputime(rlim_new);
	struct signal_struct *const sig = current->signal;

	if (cputime_eq(sig->it[CPUCLOCK_PROF].expires, cputime_zero) ||
	    cputime_lt(sig->it[CPUCLOCK_PROF].expires, cputime)) {
		spin_lock_irq(&current->sighand->siglock);
		set_process_cpu_timer(current, CPUCLOCK_PROF, &cputime, NULL);
		spin_unlock_irq(&current->sighand->siglock);
	}
}