MCPcopy Create free account
hub / github.com/F-Stack/f-stack / knote_drop_detached

Function knote_drop_detached

freebsd/kern/kern_event.c:2626–2660  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2624}
2625
2626static void
2627knote_drop_detached(struct knote *kn, struct thread *td)
2628{
2629 struct kqueue *kq;
2630 struct klist *list;
2631
2632 kq = kn->kn_kq;
2633
2634 KASSERT((kn->kn_status & KN_DETACHED) != 0,
2635 ("knote %p still attached", kn));
2636 KQ_NOTOWNED(kq);
2637
2638 KQ_LOCK(kq);
2639 KASSERT(kn->kn_influx == 1,
2640 ("knote_drop called on %p with influx %d", kn, kn->kn_influx));
2641
2642 if (kn->kn_fop->f_isfd)
2643 list = &kq->kq_knlist[kn->kn_id];
2644 else
2645 list = &kq->kq_knhash[KN_HASH(kn->kn_id, kq->kq_knhashmask)];
2646
2647 if (!SLIST_EMPTY(list))
2648 SLIST_REMOVE(list, kn, knote, kn_link);
2649 if (kn->kn_status & KN_QUEUED)
2650 knote_dequeue(kn);
2651 KQ_UNLOCK_FLUX(kq);
2652
2653 if (kn->kn_fop->f_isfd) {
2654 fdrop(kn->kn_fp, td);
2655 kn->kn_fp = NULL;
2656 }
2657 kqueue_fo_release(kn->kn_kevent.filter);
2658 kn->kn_fop = NULL;
2659 knote_free(kn);
2660}
2661
2662static void
2663knote_enqueue(struct knote *kn)

Callers 3

kqueue_registerFunction · 0.85
knlist_cleardelFunction · 0.85
knote_dropFunction · 0.85

Calls 3

knote_dequeueFunction · 0.85
kqueue_fo_releaseFunction · 0.85
knote_freeFunction · 0.85

Tested by

no test coverage detected