In setitimer(2), if the it_value of the new itimer value is clear, then

don't add the current time to it, but leave it as clear so that when the
timer is disabled, the it_value is always clear.

Reviewed by:	bde
Approved by:	re (rwatson)
This commit is contained in:
John Baldwin 2003-05-13 19:21:46 +00:00
parent 55b1eadc89
commit 25b4d3a8a6

View File

@ -482,11 +482,12 @@ setitimer(struct thread *td, struct setitimer_args *uap)
PROC_LOCK(p);
if (timevalisset(&p->p_realtimer.it_value))
callout_stop(&p->p_itcallout);
if (timevalisset(&aitv.it_value))
getmicrouptime(&ctv);
if (timevalisset(&aitv.it_value)) {
callout_reset(&p->p_itcallout, tvtohz(&aitv.it_value),
realitexpire, p);
getmicrouptime(&ctv);
timevaladd(&aitv.it_value, &ctv);
timevaladd(&aitv.it_value, &ctv);
}
oitv = p->p_realtimer;
p->p_realtimer = aitv;
PROC_UNLOCK(p);