Lines Matching refs:ev

228         osevent_hook_pre_##nexusop(gc, ev, nexi, &ev->nexus);            \
232 osevent_hook_failed_##nexusop(gc, ev, nexi, &ev->nexus); \
280 void *ev; member
288 return nexus->ev; in osevent_ev_from_hook_nexus()
295 nexus->ev = 0; in osevent_release_nexus()
300 static void osevent_hook_pre_alloc(libxl__gc *gc, void *ev, in osevent_hook_pre_alloc() argument
310 nexus->ev = ev; in osevent_hook_pre_alloc()
313 static void osevent_hook_failed_alloc(libxl__gc *gc, void *ev, in osevent_hook_failed_alloc() argument
321 static void osevent_hook_pre_release(libxl__gc *gc, void *ev, in osevent_hook_pre_release() argument
327 static void osevent_hook_failed_release(libxl__gc *gc, void *ev, in osevent_hook_failed_release() argument
335 static void osevent_hook_pre_noop(libxl__gc *gc, void *ev, in osevent_hook_pre_noop() argument
338 static void osevent_hook_failed_noop(libxl__gc *gc, void *ev, in osevent_hook_failed_noop() argument
347 int libxl__ev_fd_register(libxl__gc *gc, libxl__ev_fd *ev, in libxl__ev_fd_register() argument
357 DBG("ev_fd=%p register fd=%d events=%x", ev, fd, events); in libxl__ev_fd_register()
359 rc = OSEVENT_HOOK(fd,register, alloc, fd, &ev->nexus->for_app_reg, in libxl__ev_fd_register()
360 events, ev->nexus); in libxl__ev_fd_register()
363 ev->fd = fd; in libxl__ev_fd_register()
364 ev->events = events; in libxl__ev_fd_register()
365 ev->func = func; in libxl__ev_fd_register()
367 LIBXL_LIST_INSERT_HEAD(&CTX->efds, ev, entry); in libxl__ev_fd_register()
377 int libxl__ev_fd_modify(libxl__gc *gc, libxl__ev_fd *ev, short events) in libxl__ev_fd_modify() argument
382 assert(libxl__ev_fd_isregistered(ev)); in libxl__ev_fd_modify()
384 DBG("ev_fd=%p modify fd=%d events=%x", ev, ev->fd, events); in libxl__ev_fd_modify()
386 rc = OSEVENT_HOOK(fd,modify, noop, ev->fd, &ev->nexus->for_app_reg, events); in libxl__ev_fd_modify()
389 if ((events & ~ev->events)) in libxl__ev_fd_modify()
391 ev->events = events; in libxl__ev_fd_modify()
399 void libxl__ev_fd_deregister(libxl__gc *gc, libxl__ev_fd *ev) in libxl__ev_fd_deregister() argument
404 if (!libxl__ev_fd_isregistered(ev)) { in libxl__ev_fd_deregister()
405 DBG("ev_fd=%p deregister unregistered",ev); in libxl__ev_fd_deregister()
409 DBG("ev_fd=%p deregister fd=%d", ev, ev->fd); in libxl__ev_fd_deregister()
411 OSEVENT_HOOK_VOID(fd,deregister, release, ev->fd, ev->nexus->for_app_reg); in libxl__ev_fd_deregister()
412 LIBXL_LIST_REMOVE(ev, entry); in libxl__ev_fd_deregister()
413 ev->fd = -1; in libxl__ev_fd_deregister()
477 static int time_register_finite(libxl__gc *gc, libxl__ev_time *ev, in time_register_finite() argument
483 rc = OSEVENT_HOOK(timeout,register, alloc, &ev->nexus->for_app_reg, in time_register_finite()
484 absolute, ev->nexus); in time_register_finite()
487 ev->infinite = 0; in time_register_finite()
488 ev->abs = absolute; in time_register_finite()
489 LIBXL_TAILQ_INSERT_SORTED(&CTX->etimes, entry, ev, evsearch, /*empty*/, in time_register_finite()
490 timercmp(&ev->abs, &evsearch->abs, >)); in time_register_finite()
496 static void time_deregister(libxl__gc *gc, libxl__ev_time *ev) in time_deregister() argument
498 libxl__ao_abortable_deregister(&ev->abrt); in time_deregister()
500 if (!ev->infinite) { in time_deregister()
502 if (ev->nexus) /* only set if app provided hooks */ in time_deregister()
503 ev->nexus->ev = 0; in time_deregister()
506 &ev->nexus->for_app_reg, right_away); in time_deregister()
507 LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry); in time_deregister()
512 libxl__ev_time *ev, int rc) in time_done_debug() argument
517 ev, rc, ev->func, ev->infinite, in time_done_debug()
518 (unsigned long)ev->abs.tv_sec, (unsigned long)ev->abs.tv_usec); in time_done_debug()
524 libxl__ev_time *ev = CONTAINER_OF(abrt, *ev, abrt); in time_aborted() local
527 time_deregister(gc, ev); in time_aborted()
528 DBG("ev_time=%p aborted", ev); in time_aborted()
529 ev->func(egc, ev, &ev->abs, rc); in time_aborted()
532 static int time_register_abortable(libxl__ao *ao, libxl__ev_time *ev) in time_register_abortable() argument
534 ev->abrt.ao = ao; in time_register_abortable()
535 ev->abrt.callback = time_aborted; in time_register_abortable()
536 return libxl__ao_abortable_register(&ev->abrt); in time_register_abortable()
539 int libxl__ev_time_register_abs(libxl__ao *ao, libxl__ev_time *ev, in libxl__ev_time_register_abs() argument
549 ev, (unsigned long)absolute.tv_sec, (unsigned long)absolute.tv_usec); in libxl__ev_time_register_abs()
551 rc = time_register_abortable(ao, ev); in libxl__ev_time_register_abs()
554 rc = time_register_finite(gc, ev, absolute); in libxl__ev_time_register_abs()
557 ev->func = func; in libxl__ev_time_register_abs()
561 libxl__ao_abortable_deregister(&ev->abrt); in libxl__ev_time_register_abs()
562 time_done_debug(gc,__func__,ev,rc); in libxl__ev_time_register_abs()
568 int libxl__ev_time_register_rel(libxl__ao *ao, libxl__ev_time *ev, in libxl__ev_time_register_rel() argument
578 DBG("ev_time=%p register ms=%d", ev, milliseconds); in libxl__ev_time_register_rel()
580 rc = time_register_abortable(ao, ev); in libxl__ev_time_register_rel()
584 ev->infinite = 1; in libxl__ev_time_register_rel()
589 rc = time_register_finite(gc, ev, absolute); in libxl__ev_time_register_rel()
593 ev->func = func; in libxl__ev_time_register_rel()
597 if (!libxl__ev_time_isregistered(ev)) in libxl__ev_time_register_rel()
598 libxl__ao_abortable_deregister(&ev->abrt); in libxl__ev_time_register_rel()
599 time_done_debug(gc,__func__,ev,rc); in libxl__ev_time_register_rel()
604 void libxl__ev_time_deregister(libxl__gc *gc, libxl__ev_time *ev) in libxl__ev_time_deregister() argument
608 DBG("ev_time=%p deregister", ev); in libxl__ev_time_deregister()
610 if (!libxl__ev_time_isregistered(ev)) in libxl__ev_time_deregister()
613 time_deregister(gc, ev); in libxl__ev_time_deregister()
614 ev->func = 0; in libxl__ev_time_deregister()
617 time_done_debug(gc,__func__,ev,0); in libxl__ev_time_deregister()
681 static void watchfd_callback(libxl__egc *egc, libxl__ev_fd *ev, in watchfd_callback() argument
894 static void evtchn_fd_callback(libxl__egc *egc, libxl__ev_fd *ev, in evtchn_fd_callback() argument
1513 libxl__ev_fd *ev = osevent_ev_from_hook_nexus(ctx, for_libxl); in libxl_osevent_occurred_fd() local
1514 if (!ev) goto out; in libxl_osevent_occurred_fd()
1515 if (ev->fd != fd) goto out; in libxl_osevent_occurred_fd()
1517 fd_occurs(egc, ev, revents_ign); in libxl_osevent_occurred_fd()
1530 libxl__ev_time *ev = osevent_ev_from_hook_nexus(ctx, nexus); in libxl_osevent_occurred_timeout() local
1534 if (!ev) goto out; in libxl_osevent_occurred_timeout()
1535 assert(!ev->infinite); in libxl_osevent_occurred_timeout()
1537 LIBXL_TAILQ_REMOVE(&CTX->etimes, ev, entry); in libxl_osevent_occurred_timeout()
1539 time_occurs(egc, ev, ERROR_TIMEDOUT); in libxl_osevent_occurred_timeout()
1576 libxl_event *ev, *ev_tmp; in egc_run_callbacks() local
1590 LIBXL_TAILQ_FOREACH_SAFE(ev, &egc->occurred_for_callback, link, ev_tmp) { in egc_run_callbacks()
1591 LIBXL_TAILQ_REMOVE(&egc->occurred_for_callback, ev, link); in egc_run_callbacks()
1593 ev, libxl_event_type_to_string(ev->type)); in egc_run_callbacks()
1594 CTX->event_hooks->event_occurs(CTX->event_hooks_user, ev); in egc_run_callbacks()
1600 aop->how->callback(CTX, aop->ev, aop->how->for_callback); in egc_run_callbacks()
1673 libxl_event *ev; in libxl__event_new() local
1675 ev = libxl__zalloc(NOGC,sizeof(*ev)); in libxl__event_new()
1677 libxl_event_init(ev); in libxl__event_new()
1678 libxl_event_init_type(ev, type); in libxl__event_new()
1680 ev->domid = domid; in libxl__event_new()
1681 ev->for_user = for_user; in libxl__event_new()
1683 return ev; in libxl__event_new()
1691 libxl_event *ev; in event_check_internal() local
1694 LIBXL_TAILQ_FOREACH(ev, &CTX->occurred, link) { in event_check_internal()
1695 if (!(typemask & ((uint64_t)1 << ev->type))) in event_check_internal()
1698 if (pred && !pred(ev, pred_user)) in event_check_internal()
1702 LIBXL_TAILQ_REMOVE(&CTX->occurred, ev, link); in event_check_internal()
1703 *event_r = ev; in event_check_internal()
2112 libxl_event *ev; in libxl__ao_complete_check_progress_reports() local
2113 ev = NEW_EVENT(egc, OPERATION_COMPLETE, ao->domid, ao->how.u.for_event); in libxl__ao_complete_check_progress_reports()
2114 if (ev) { in libxl__ao_complete_check_progress_reports()
2115 ev->u.operation_complete.rc = ao->rc; in libxl__ao_complete_check_progress_reports()
2116 libxl__event_occurred(egc, ev); in libxl__ao_complete_check_progress_reports()
2386 (libxl_ctx *ctx, libxl_event *ev, void *for_callback) { } in dummy_asyncprogress_callback_ignore() argument
2397 const libxl_asyncprogress_how *how, libxl_event *ev) in libxl__ao_progress_report() argument
2403 libxl_event_free(CTX,ev); in libxl__ao_progress_report()
2409 aop->ev = ev; in libxl__ao_progress_report()
2415 ao, ev, libxl_event_type_to_string(ev->type)); in libxl__ao_progress_report()
2416 libxl__event_occurred(egc, ev); in libxl__ao_progress_report()