summaryrefslogtreecommitdiffstats
path: root/freebsd/sys/kern/kern_event.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-11-04 11:33:00 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-11-04 15:28:21 +0100
commitaf5333e0a02b2295304d4e029b15ee15a4fe2b3a (patch)
treec5c43680d374f58b487eeeaf18fb7ec6b84ba074 /freebsd/sys/kern/kern_event.c
parentBUS_SPACE(9): Use simple memory model for ARM (diff)
downloadrtems-libbsd-af5333e0a02b2295304d4e029b15ee15a4fe2b3a.tar.bz2
Update to FreeBSD 8.4
Diffstat (limited to 'freebsd/sys/kern/kern_event.c')
-rw-r--r--freebsd/sys/kern/kern_event.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/freebsd/sys/kern/kern_event.c b/freebsd/sys/kern/kern_event.c
index d318c8ba..62498b25 100644
--- a/freebsd/sys/kern/kern_event.c
+++ b/freebsd/sys/kern/kern_event.c
@@ -530,6 +530,10 @@ knote_fork(struct knlist *list, int pid)
}
#endif /* __rtems__ */
+/*
+ * XXX: EVFILT_TIMER should perhaps live in kern_time.c beside the
+ * interval timer support code.
+ */
static int
timertoticks(intptr_t data)
{
@@ -543,7 +547,6 @@ timertoticks(intptr_t data)
return tticks;
}
-/* XXX - move to kern_timeout.c? */
static void
filt_timerexpire(void *knx)
{
@@ -553,9 +556,16 @@ filt_timerexpire(void *knx)
kn->kn_data++;
KNOTE_ACTIVATE(kn, 0); /* XXX - handle locking */
+ /*
+ * timertoticks() uses tvtohz() which always adds 1 to allow
+ * for the time until the next clock interrupt being strictly
+ * less than 1 clock tick. We don't want that here since we
+ * want to appear to be in sync with the clock interrupt even
+ * when we're delayed.
+ */
if ((kn->kn_flags & EV_ONESHOT) != EV_ONESHOT) {
calloutp = (struct callout *)kn->kn_hook;
- callout_reset_curcpu(calloutp, timertoticks(kn->kn_sdata),
+ callout_reset_curcpu(calloutp, timertoticks(kn->kn_sdata) - 1,
filt_timerexpire, kn);
}
}
@@ -563,7 +573,6 @@ filt_timerexpire(void *knx)
/*
* data contains amount of time to sleep, in milliseconds
*/
-/* XXX - move to kern_timeout.c? */
static int
filt_timerattach(struct knote *kn)
{
@@ -587,7 +596,6 @@ filt_timerattach(struct knote *kn)
return (0);
}
-/* XXX - move to kern_timeout.c? */
static void
filt_timerdetach(struct knote *kn)
{
@@ -600,7 +608,6 @@ filt_timerdetach(struct knote *kn)
kn->kn_status |= KN_DETACHED; /* knlist_remove usually clears it */
}
-/* XXX - move to kern_timeout.c? */
static int
filt_timer(struct knote *kn, long hint)
{
@@ -1851,6 +1858,7 @@ kqueue_close(struct file *fp, struct thread *td)
rtems_libio_unlock();
#endif /* __rtems__ */
+ seldrain(&kq->kq_sel);
knlist_destroy(&kq->kq_sel.si_note);
mtx_destroy(&kq->kq_lock);
#ifndef __rtems__