#include <kern/clock.h>
#include <kern/thread_call.h>
#include <kern/sched_prim.h>
+#include <kern/wait_queue.h>
#include <kern/zalloc.h>
#include <kern/assert.h>
int oktodrop;
oktodrop = ((kn->kn_status & (KN_DROPPING | KN_ATTACHING)) == 0);
+ kn->kn_status &= ~KN_STAYQUEUED;
kn->kn_status |= KN_DROPPING;
if (oktodrop) {
if (kn->kn_inuse == 0) {
kq->kq_p = p;
} else {
FREE_ZONE(kq, sizeof (struct kqueue), M_KQUEUE);
+ kq = NULL;
}
}
kern_return_t kr;
kr = wait_queue_unlink_nofree(wq, kq->kq_wqs, wqlp);
- kqlock(kq);
- kn->kn_status &= ~KN_STAYQUEUED;
- knote_dequeue(kn);
- kqunlock(kq);
+ knote_clearstayqueued(kn);
return ((kr != KERN_SUCCESS) ? EINVAL : 0);
}
knote_enqueue(kn);
kqunlock(kn->kn_kq);
}
+
+void
+knote_clearstayqueued(struct knote *kn)
+{
+ kqlock(kn->kn_kq);
+ kn->kn_status &= ~KN_STAYQUEUED;
+ knote_dequeue(kn);
+ kqunlock(kn->kn_kq);
+}