Page MenuHomeFreeBSD

D30069.diff
No OneTemporary

D30069.diff

diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -718,6 +718,7 @@
{
struct kq_timer_cb_data *kc;
struct proc *p;
+ uint64_t delta;
sbintime_t now;
kc = kn->kn_ptr.p_v;
@@ -728,9 +729,17 @@
return;
}
- for (now = sbinuptime(); kc->next <= now; kc->next += kc->to)
- kn->kn_data++;
- KNOTE_ACTIVATE(kn, 0); /* XXX - handle locking */
+ now = sbinuptime();
+ if (now >= kc->next) {
+ delta = (now - kc->next) / kc->to;
+ if (delta == 0)
+ delta = 1;
+ kn->kn_data += delta;
+ kc->next += (delta + 1) * kc->to;
+ if (now >= kc->next) /* overflow */
+ kc->next = now + kc->to;
+ KNOTE_ACTIVATE(kn, 0); /* XXX - handle locking */
+ }
/*
* Initial check for stopped kc->p is racy. It is fine to

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 2:42 PM (22 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14536846
Default Alt Text
D30069.diff (795 B)

Event Timeline