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

Function knote_attach

freebsd/kern/kern_event.c:2594–2615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2592}
2593
2594static int
2595knote_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
2617static void
2618knote_drop(struct knote *kn, struct thread *td)

Callers 1

kqueue_registerFunction · 0.85

Calls 1

kn_in_fluxFunction · 0.85

Tested by

no test coverage detected