| 2592 | } |
| 2593 | |
| 2594 | static int |
| 2595 | knote_attach(struct knote *kn, struct kqueue *kq) |
| 2596 | { |
| 2597 | struct klist *list; |
| 2598 | |
| 2599 | KASSERT(kn_in_flux(kn), ("knote %p not marked influx", kn)); |
| 2600 | KQ_OWNED(kq); |
| 2601 | |
| 2602 | if ((kq->kq_state & KQ_CLOSING) != 0) |
| 2603 | return (EBADF); |
| 2604 | if (kn->kn_fop->f_isfd) { |
| 2605 | if (kn->kn_id >= kq->kq_knlistsize) |
| 2606 | return (ENOMEM); |
| 2607 | list = &kq->kq_knlist[kn->kn_id]; |
| 2608 | } else { |
| 2609 | if (kq->kq_knhash == NULL) |
| 2610 | return (ENOMEM); |
| 2611 | list = &kq->kq_knhash[KN_HASH(kn->kn_id, kq->kq_knhashmask)]; |
| 2612 | } |
| 2613 | SLIST_INSERT_HEAD(list, kn, kn_link); |
| 2614 | return (0); |
| 2615 | } |
| 2616 | |
| 2617 | static void |
| 2618 | knote_drop(struct knote *kn, struct thread *td) |
no test coverage detected