-/**
- * Monitored normal callback for events.
- * This function is called by the monitor
- * to run the event loop when the safe environment
- * is set.
- * @param signum 0 on normal flow or the number
- * of the signal that interrupted the normal
- * flow
- * @param arg the events to run
- */
-static void evloop_run(int signum, void *arg)
-{
- int rc;
- struct sd_event *se;
-
- if (!signum) {
- se = evloop.sdev;
- rc = sd_event_prepare(se);
- if (rc < 0) {
- errno = -rc;
- CRITICAL("sd_event_prepare returned an error (state: %d): %m", sd_event_get_state(se));
- abort();
- } else {
- if (rc == 0) {
- rc = sd_event_wait(se, (uint64_t)(int64_t)-1);
- if (rc < 0) {
- errno = -rc;
- ERROR("sd_event_wait returned an error (state: %d): %m", sd_event_get_state(se));
- }
- }
- evloop.state = EVLOOP_STATE_RUN;
- if (rc > 0) {
- rc = sd_event_dispatch(se);
- if (rc < 0) {
- errno = -rc;
- ERROR("sd_event_dispatch returned an error (state: %d): %m", sd_event_get_state(se));
- }
- }
- }
- }
-}
-
-/**
- * Internal callback for evloop management.
- * The effect of this function is hidden: it exits
- * the waiting poll if any.
- */
-static void evloop_on_efd_event()
-{
- uint64_t x;
- read(evloop.efd, &x, sizeof x);
-}
-