| 2624 | } |
| 2625 | |
| 2626 | static void |
| 2627 | knote_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 | |
| 2662 | static void |
| 2663 | knote_enqueue(struct knote *kn) |
no test coverage detected