Lines Matching refs:kqop
77 struct kqop { struct
88 static void kqop_free(struct kqop *kqop); argument
124 struct kqop *kqueueop = NULL; in kq_init()
126 if (!(kqueueop = mm_calloc(1, sizeof(struct kqop)))) in kq_init()
206 struct kqop *kqop) in kq_build_changes_list() argument
214 if (n_changes >= kqop->changes_size - 1) { in kq_build_changes_list()
218 if (kqop->changes_size > INT_MAX / 2 || in kq_build_changes_list()
219 (size_t)kqop->changes_size * 2 > EV_SIZE_MAX / in kq_build_changes_list()
225 newsize = kqop->changes_size * 2; in kq_build_changes_list()
226 newchanges = mm_realloc(kqop->changes, in kq_build_changes_list()
232 kqop->changes = newchanges; in kq_build_changes_list()
233 kqop->changes_size = newsize; in kq_build_changes_list()
236 out_ch = &kqop->changes[n_changes++]; in kq_build_changes_list()
241 out_ch = &kqop->changes[n_changes++]; in kq_build_changes_list()
250 kq_grow_events(struct kqop *kqop, size_t new_size) in kq_grow_events() argument
254 newresult = mm_realloc(kqop->events, in kq_grow_events()
258 kqop->events = newresult; in kq_grow_events()
259 kqop->events_size = new_size; in kq_grow_events()
269 struct kqop *kqop = base->evbase; in kq_dispatch() local
270 struct kevent *events = kqop->events; in kq_dispatch()
282 EVUTIL_ASSERT(kqop->changes); in kq_dispatch()
283 n_changes = kq_build_changes_list(&base->changelist, kqop); in kq_dispatch()
291 changes = kqop->changes; in kq_dispatch()
292 kqop->changes = NULL; in kq_dispatch()
303 if (kqop->events_size < n_changes) { in kq_dispatch()
304 int new_size = kqop->events_size; in kq_dispatch()
309 kq_grow_events(kqop, new_size); in kq_dispatch()
310 events = kqop->events; in kq_dispatch()
315 res = kevent(kqop->kq, changes, n_changes, in kq_dispatch()
316 events, kqop->events_size, ts_p); in kq_dispatch()
320 EVUTIL_ASSERT(kqop->changes == NULL); in kq_dispatch()
321 kqop->changes = changes; in kq_dispatch()
422 if (res == kqop->events_size) { in kq_dispatch()
425 kq_grow_events(kqop, kqop->events_size * 2); in kq_dispatch()
432 kqop_free(struct kqop *kqop) in kqop_free() argument
434 if (kqop->changes) in kqop_free()
435 mm_free(kqop->changes); in kqop_free()
436 if (kqop->events) in kqop_free()
437 mm_free(kqop->events); in kqop_free()
438 if (kqop->kq >= 0 && kqop->pid == getpid()) in kqop_free()
439 close(kqop->kq); in kqop_free()
440 memset(kqop, 0, sizeof(struct kqop)); in kqop_free()
441 mm_free(kqop); in kqop_free()
447 struct kqop *kqop = base->evbase; in kq_dealloc() local
449 kqop_free(kqop); in kq_dealloc()
456 struct kqop *kqop = base->evbase; in kq_sig_add() local
471 if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1) in kq_sig_add()
489 struct kqop *kqop = base->evbase; in kq_sig_del() local
505 if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1) in kq_sig_del()
524 struct kqop *kqop = base->evbase; in event_kq_add_notify_event_() local
530 if (kqop->notify_event_added) in event_kq_add_notify_event_()
539 if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1) { in event_kq_add_notify_event_()
544 kqop->notify_event_added = 1; in event_kq_add_notify_event_()
555 struct kqop *kqop = base->evbase; in event_kq_notify_base_() local
560 if (! kqop->notify_event_added) in event_kq_notify_base_()
569 if (kevent(kqop->kq, &kev, 1, NULL, 0, &timeout) == -1) { in event_kq_notify_base_()