Sync w/ kern_time.c and sys_generic.c

This commit is contained in:
thorpej 2000-07-13 17:39:03 +00:00
parent f9ba0345f1
commit 75159452f1

View File

@ -1,4 +1,4 @@
/* $NetBSD: netbsd32_netbsd.c,v 1.32 2000/07/09 13:39:31 mrg Exp $ */ /* $NetBSD: netbsd32_netbsd.c,v 1.33 2000/07/13 17:39:03 thorpej Exp $ */
/* /*
* Copyright (c) 1998 Matthew R. Green * Copyright (c) 1998 Matthew R. Green
@ -2320,6 +2320,10 @@ netbsd32_setitimer(p, v, retval)
if (which == ITIMER_REAL) { if (which == ITIMER_REAL) {
callout_stop(&p->p_realit_ch); callout_stop(&p->p_realit_ch);
if (timerisset(&aitv.it_value)) { if (timerisset(&aitv.it_value)) {
/*
* Don't need to check hzto() return value, here.
* callout_reset() does it for us.
*/
timeradd(&aitv.it_value, &time, &aitv.it_value); timeradd(&aitv.it_value, &time, &aitv.it_value);
callout_reset(&p->p_realit_ch, hzto(&aitv.it_value), callout_reset(&p->p_realit_ch, hzto(&aitv.it_value),
realitexpire, p); realitexpire, p);
@ -2466,12 +2470,6 @@ netbsd32_select(p, v, retval)
} }
s = splclock(); s = splclock();
timeradd(&atv, &time, &atv); timeradd(&atv, &time, &atv);
timo = hzto(&atv);
/*
* Avoid inadvertently sleeping forever.
*/
if (timo == 0)
timo = 1;
splx(s); splx(s);
} else } else
timo = 0; timo = 0;
@ -2482,11 +2480,15 @@ retry:
(fd_mask *)(bits + ni * 3), SCARG(uap, nd), retval); (fd_mask *)(bits + ni * 3), SCARG(uap, nd), retval);
if (error || *retval) if (error || *retval)
goto done; goto done;
s = splhigh(); if (SCARG(uap, tv)) {
if (timo && timercmp(&time, &atv, >=)) { /*
splx(s); * We have to recalculate the timeout on every retry.
goto done; */
timo = hzto(&atv);
if (timo <= 0)
goto done;
} }
s = splhigh();
if ((p->p_flag & P_SELECT) == 0 || nselcoll != ncoll) { if ((p->p_flag & P_SELECT) == 0 || nselcoll != ncoll) {
splx(s); splx(s);
goto retry; goto retry;