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

Function filt_timerattach

freebsd/kern/kern_event.c:734–760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

732}
733
734static int
735filt_timerattach(struct knote *kn)
736{
737 struct kq_timer_cb_data *kc;
738 sbintime_t to;
739 unsigned int ncallouts;
740 int error;
741
742 error = filt_timervalidate(kn, &to);
743 if (error != 0)
744 return (error);
745
746 do {
747 ncallouts = kq_ncallouts;
748 if (ncallouts >= kq_calloutmax)
749 return (ENOMEM);
750 } while (!atomic_cmpset_int(&kq_ncallouts, ncallouts, ncallouts + 1));
751
752 if ((kn->kn_sfflags & NOTE_ABSTIME) == 0)
753 kn->kn_flags |= EV_CLEAR; /* automatically set */
754 kn->kn_status &= ~KN_DETACHED; /* knlist_add clears it */
755 kn->kn_ptr.p_v = kc = malloc(sizeof(*kc), M_KQUEUE, M_WAITOK);
756 callout_init(&kc->c, 1);
757 filt_timerstart(kn, to);
758
759 return (0);
760}
761
762static void
763filt_timerstart(struct knote *kn, sbintime_t to)

Callers

nothing calls this directly

Calls 4

filt_timervalidateFunction · 0.85
mallocFunction · 0.85
filt_timerstartFunction · 0.85
callout_initFunction · 0.70

Tested by

no test coverage detected