diff options
author | jhb <jhb@FreeBSD.org> | 2003-05-13 19:21:46 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2003-05-13 19:21:46 +0000 |
commit | 824931292d5a803f618bb8e452dce2caf6233624 (patch) | |
tree | f844064163221852c9b27dacbda6400d2baebed7 /sys | |
parent | 0c04949ed7f6c52d02a70c3517566069c812c0bd (diff) | |
download | FreeBSD-src-824931292d5a803f618bb8e452dce2caf6233624.zip FreeBSD-src-824931292d5a803f618bb8e452dce2caf6233624.tar.gz |
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)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_time.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 6a046fa..29de672 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -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); |