Date: Sun, 05 Apr 1998 13:31:35 +0200 From: Poul-Henning Kamp <phk@critter.freebsd.dk> To: =?koi8-r?B?4c7E0sXKIP7F0s7P1w==?= <ache@nagual.pp.ru> Cc: current@FreeBSD.ORG Subject: Re: dead hang after ppp started (with workaround) Message-ID: <7186.891775895@critter.freebsd.dk> In-Reply-To: Your message of "Sun, 05 Apr 1998 14:54:27 %2B0400." <19980405145427.14961@nagual.pp.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
Try this patch... I overlooked something in the itimer handling...
Index: kern_time.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_time.c,v
retrieving revision 1.48
diff -u -r1.48 kern_time.c
--- kern_time.c 1998/04/05 10:28:01 1.48
+++ kern_time.c 1998/04/05 11:30:46
@@ -102,10 +102,6 @@
ts.tv_nsec = tv->tv_usec * 1000;
set_timecounter(&ts);
(void) splsoftclock();
- for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
- if (timerisset(&p->p_realtimer.it_value))
- timevaladd(&p->p_realtimer.it_value, &delta);
- }
lease_updatetime(delta.tv_sec);
splx(s);
resettodr();
@@ -479,7 +475,7 @@
*/
aitv = p->p_realtimer;
if (timerisset(&aitv.it_value)) {
- getmicrotime(&ctv);
+ getmicroruntime(&ctv);
if (timercmp(&aitv.it_value, &ctv, <))
timerclear(&aitv.it_value);
else
@@ -533,6 +529,8 @@
if (timerisset(&aitv.it_value))
p->p_ithandle = timeout(realitexpire, (caddr_t)p,
tvtohz(&aitv.it_value));
+ getmicroruntime(&ctv);
+ timevaladd(&aitv.it_value, &ctv);
p->p_realtimer = aitv;
} else
p->p_stats->p_timer[uap->which] = aitv;
@@ -557,7 +555,7 @@
void *arg;
{
register struct proc *p;
- struct timeval ctv;
+ struct timeval ctv, ntv;
int s;
p = (struct proc *)arg;
@@ -570,11 +568,12 @@
s = splclock(); /* XXX: still neeeded ? */
timevaladd(&p->p_realtimer.it_value,
&p->p_realtimer.it_interval);
- getmicrotime(&ctv);
+ getmicroruntime(&ctv);
if (timercmp(&p->p_realtimer.it_value, &ctv, >)) {
+ ntv = p->p_realtimer.it_value;
+ timevalsub(&ntv, &ctv);
p->p_ithandle =
- timeout(realitexpire, (caddr_t)p,
- hzto(&p->p_realtimer.it_value) - 1);
+ timeout(realitexpire, (caddr_t)p, tvtohz(&ntv));
splx(s);
return;
}
--
Poul-Henning Kamp FreeBSD coreteam member
phk@FreeBSD.ORG "Real hackers run -current on their laptop."
"Drink MONO-tonic, it goes down but it will NEVER come back up!"
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7186.891775895>
