summaryrefslogtreecommitdiff
path: root/sys/kern/kern_event.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-09 11:47:31 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-10-09 11:47:31 +0000
commitc50e4b62a156f8b9d029c2dcf981fd9c2023364f (patch)
tree04c0d2883b651923aaf2a8250fe6837ef1d9730f /sys/kern/kern_event.c
parenteb077ca268a66474b3ee18f5af30ca8043be22cd (diff)
oops, snuck into a syscalls sync; spotted by sthen
Diffstat (limited to 'sys/kern/kern_event.c')
-rw-r--r--sys/kern/kern_event.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 6446d6230d9..73ca39e01f3 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_event.c,v 1.62 2015/10/09 01:11:12 deraadt Exp $ */
+/* $OpenBSD: kern_event.c,v 1.63 2015/10/09 11:47:30 deraadt Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -323,28 +323,22 @@ filt_proc(struct knote *kn, long hint)
return (kn->kn_fflags != 0);
}
-static void
-filt_timer_timeout_add(struct knote *kn)
-{
- struct timeval tv;
- int tticks;
-
- tv.tv_sec = kn->kn_sdata / 1000;
- tv.tv_usec = (kn->kn_sdata % 1000) * 1000;
- tticks = tvtohz(&tv);
- timeout_add(kn->kn_hook, tticks ? tticks : 1);
-}
-
void
filt_timerexpire(void *knx)
{
struct knote *kn = knx;
+ struct timeval tv;
+ int tticks;
kn->kn_data++;
KNOTE_ACTIVATE(kn);
- if ((kn->kn_flags & EV_ONESHOT) == 0)
- filt_timer_timeout_add(kn);
+ if ((kn->kn_flags & EV_ONESHOT) == 0) {
+ tv.tv_sec = kn->kn_sdata / 1000;
+ tv.tv_usec = (kn->kn_sdata % 1000) * 1000;
+ tticks = tvtohz(&tv);
+ timeout_add((struct timeout *)kn->kn_hook, tticks);
+ }
}
@@ -355,16 +349,22 @@ int
filt_timerattach(struct knote *kn)
{
struct timeout *to;
+ struct timeval tv;
+ int tticks;
if (kq_ntimeouts > kq_timeoutmax)
return (ENOMEM);
kq_ntimeouts++;
+ tv.tv_sec = kn->kn_sdata / 1000;
+ tv.tv_usec = (kn->kn_sdata % 1000) * 1000;
+ tticks = tvtohz(&tv);
+
kn->kn_flags |= EV_CLEAR; /* automatically set */
to = malloc(sizeof(*to), M_KEVENT, M_WAITOK);
timeout_set(to, filt_timerexpire, kn);
+ timeout_add(to, tticks);
kn->kn_hook = to;
- filt_timer_timeout_add(kn);
return (0);
}