core: annotate event sources
This commit is contained in:
parent
77cfd1139c
commit
7dfbe2e3fc
|
@ -274,12 +274,13 @@ static int automount_coldplug(Unit *u) {
|
|||
|
||||
if (a->deserialized_state == AUTOMOUNT_WAITING ||
|
||||
a->deserialized_state == AUTOMOUNT_RUNNING) {
|
||||
|
||||
assert(a->pipe_fd >= 0);
|
||||
|
||||
r = sd_event_add_io(u->manager->event, &a->pipe_event_source, a->pipe_fd, EPOLLIN, automount_dispatch_io, u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) sd_event_source_set_description(a->pipe_event_source, "automount-io");
|
||||
}
|
||||
|
||||
automount_set_state(a, a->deserialized_state);
|
||||
|
@ -595,6 +596,8 @@ static void automount_enter_waiting(Automount *a) {
|
|||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
(void) sd_event_source_set_description(a->pipe_event_source, "automount-io");
|
||||
|
||||
a->pipe_fd = p[0];
|
||||
a->dev_id = st.st_dev;
|
||||
|
||||
|
@ -683,11 +686,17 @@ static int automount_start_expire(Automount *a) {
|
|||
return sd_event_source_set_enabled(a->expire_event_source, SD_EVENT_ONESHOT);
|
||||
}
|
||||
|
||||
return sd_event_add_time(
|
||||
r = sd_event_add_time(
|
||||
UNIT(a)->manager->event,
|
||||
&a->expire_event_source,
|
||||
CLOCK_MONOTONIC, timeout, 0,
|
||||
automount_dispatch_expire, a);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) sd_event_source_set_description(a->expire_event_source, "automount-expire");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void automount_enter_runnning(Automount *a) {
|
||||
|
|
|
@ -124,12 +124,18 @@ static int busname_arm_timer(BusName *n) {
|
|||
return sd_event_source_set_enabled(n->timer_event_source, SD_EVENT_ONESHOT);
|
||||
}
|
||||
|
||||
return sd_event_add_time(
|
||||
r = sd_event_add_time(
|
||||
UNIT(n)->manager->event,
|
||||
&n->timer_event_source,
|
||||
CLOCK_MONOTONIC,
|
||||
now(CLOCK_MONOTONIC) + n->timeout_usec, 0,
|
||||
busname_dispatch_timer, n);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) sd_event_source_set_description(n->timer_event_source, "busname-timer");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int busname_add_default_default_dependencies(BusName *n) {
|
||||
|
@ -285,6 +291,7 @@ static int busname_watch_fd(BusName *n) {
|
|||
r = sd_event_source_set_enabled(n->starter_event_source, SD_EVENT_ON);
|
||||
else
|
||||
r = sd_event_add_io(UNIT(n)->manager->event, &n->starter_event_source, n->starter_fd, EPOLLIN, busname_dispatch_io, n);
|
||||
(void) sd_event_source_set_description(n->starter_event_source, "busname-starter");
|
||||
if (r < 0) {
|
||||
log_unit_warning_errno(UNIT(n)->id, r, "Failed to watch starter fd: %m");
|
||||
busname_unwatch_fd(n);
|
||||
|
|
|
@ -982,6 +982,8 @@ static int bus_init_private(Manager *m) {
|
|||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to allocate event source: %m");
|
||||
|
||||
(void) sd_event_source_set_description(s, "bus-connection");
|
||||
|
||||
m->private_listen_fd = fd;
|
||||
m->private_listen_event_source = s;
|
||||
fd = -1;
|
||||
|
|
|
@ -627,6 +627,8 @@ static int device_enumerate(Manager *m) {
|
|||
r = sd_event_add_io(m->event, &m->udev_event_source, udev_monitor_get_fd(m->udev_monitor), EPOLLIN, device_dispatch_io, m);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
(void) sd_event_source_set_description(m->udev_event_source, "device");
|
||||
}
|
||||
|
||||
e = udev_enumerate_new(m->udev);
|
||||
|
|
|
@ -934,6 +934,8 @@ int job_start_timer(Job *j) {
|
|||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) sd_event_source_set_description(j->timer_event_source, "job-start");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1130,6 +1132,8 @@ int job_coldplug(Job *j) {
|
|||
if (r < 0)
|
||||
log_debug_errno(r, "Failed to restart timeout for job: %m");
|
||||
|
||||
(void) sd_event_source_set_description(j->timer_event_source, "job-timeout");
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,8 @@ static void manager_watch_jobs_in_progress(Manager *m) {
|
|||
CLOCK_MONOTONIC,
|
||||
next, 0,
|
||||
manager_dispatch_jobs_in_progress, m);
|
||||
|
||||
(void) sd_event_source_set_description(m->jobs_in_progress_event_source, "manager-jobs-in-progress");
|
||||
}
|
||||
|
||||
#define CYLON_BUFFER_EXTRA (2*(sizeof(ANSI_RED_ON)-1) + sizeof(ANSI_HIGHLIGHT_RED_ON)-1 + 2*(sizeof(ANSI_HIGHLIGHT_OFF)-1))
|
||||
|
@ -278,6 +280,8 @@ static int manager_check_ask_password(Manager *m) {
|
|||
return -errno;
|
||||
}
|
||||
|
||||
(void) sd_event_source_set_description(m->ask_password_event_source, "manager-ask-password");
|
||||
|
||||
/* Queries might have been added meanwhile... */
|
||||
manager_dispatch_ask_password_fd(m->ask_password_event_source,
|
||||
m->ask_password_inotify_fd, EPOLLIN, m);
|
||||
|
@ -301,6 +305,8 @@ static int manager_watch_idle_pipe(Manager *m) {
|
|||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to watch idle pipe: %m");
|
||||
|
||||
(void) sd_event_source_set_description(m->idle_pipe_event_source, "manager-idle-pipe");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -343,6 +349,8 @@ static int manager_setup_time_change(Manager *m) {
|
|||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to create time change event source: %m");
|
||||
|
||||
(void) sd_event_source_set_description(m->time_change_event_source, "manager-time-change");
|
||||
|
||||
log_debug("Set up TFD_TIMER_CANCEL_ON_SET timerfd.");
|
||||
|
||||
return 0;
|
||||
|
@ -453,6 +461,8 @@ static int manager_setup_signals(Manager *m) {
|
|||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) sd_event_source_set_description(m->signal_event_source, "manager-signal");
|
||||
|
||||
/* Process signals a bit earlier than the rest of things, but
|
||||
* later than notify_fd processing, so that the notify
|
||||
* processing can still figure out to which process/service a
|
||||
|
@ -593,6 +603,8 @@ int manager_new(SystemdRunningAs running_as, bool test_run, Manager **_m) {
|
|||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
(void) sd_event_source_set_description(m->run_queue_event_source, "manager-run-queue");
|
||||
|
||||
r = manager_setup_signals(m);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
@ -691,6 +703,8 @@ static int manager_setup_notify(Manager *m) {
|
|||
r = sd_event_source_set_priority(m->notify_event_source, -7);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to set priority of notify event source: %m");
|
||||
|
||||
(void) sd_event_source_set_description(m->notify_event_source, "manager-notify");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -164,12 +164,18 @@ static int mount_arm_timer(Mount *m) {
|
|||
return sd_event_source_set_enabled(m->timer_event_source, SD_EVENT_ONESHOT);
|
||||
}
|
||||
|
||||
return sd_event_add_time(
|
||||
r = sd_event_add_time(
|
||||
UNIT(m)->manager->event,
|
||||
&m->timer_event_source,
|
||||
CLOCK_MONOTONIC,
|
||||
now(CLOCK_MONOTONIC) + m->timeout_usec, 0,
|
||||
mount_dispatch_timer, m);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) sd_event_source_set_description(m->timer_event_source, "mount-timer");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void mount_unwatch_control_pid(Mount *m) {
|
||||
|
@ -1645,6 +1651,8 @@ static int mount_enumerate(Manager *m) {
|
|||
r = sd_event_source_set_priority(m->mount_event_source, -10);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
(void) sd_event_source_set_description(m->mount_event_source, "mount-mountinfo-dispatch");
|
||||
}
|
||||
|
||||
if (m->utab_inotify_fd < 0) {
|
||||
|
@ -1669,6 +1677,8 @@ static int mount_enumerate(Manager *m) {
|
|||
r = sd_event_source_set_priority(m->mount_utab_event_source, -10);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
(void) sd_event_source_set_description(m->mount_utab_event_source, "mount-utab-dispatch");
|
||||
}
|
||||
|
||||
r = mount_load_proc_self_mountinfo(m, false);
|
||||
|
|
|
@ -73,6 +73,8 @@ int path_spec_watch(PathSpec *s, sd_event_io_handler_t handler) {
|
|||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
(void) sd_event_source_set_description(s->event_source, "path");
|
||||
|
||||
/* This assumes the path was passed through path_kill_slashes()! */
|
||||
|
||||
for (slash = strchr(s->path, '/'); ; slash = strchr(slash+1, '/')) {
|
||||
|
|
|
@ -81,12 +81,18 @@ static int scope_arm_timer(Scope *s) {
|
|||
return sd_event_source_set_enabled(s->timer_event_source, SD_EVENT_ONESHOT);
|
||||
}
|
||||
|
||||
return sd_event_add_time(
|
||||
r = sd_event_add_time(
|
||||
UNIT(s)->manager->event,
|
||||
&s->timer_event_source,
|
||||
CLOCK_MONOTONIC,
|
||||
now(CLOCK_MONOTONIC) + s->timeout_stop_usec, 0,
|
||||
scope_dispatch_timer, s);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) sd_event_source_set_description(s->timer_event_source, "scope-timer");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void scope_set_state(Scope *s, ScopeState state) {
|
||||
|
|
|
@ -227,6 +227,8 @@ static void service_start_watchdog(Service *s) {
|
|||
return;
|
||||
}
|
||||
|
||||
(void) sd_event_source_set_description(s->watchdog_event_source, "service-watchdog");
|
||||
|
||||
/* Let's process everything else which might be a sign
|
||||
* of living before we consider a service died. */
|
||||
r = sd_event_source_set_priority(s->watchdog_event_source, SD_EVENT_PRIORITY_IDLE);
|
||||
|
@ -372,6 +374,8 @@ static int service_add_fd_store(Service *s, int fd) {
|
|||
return r;
|
||||
}
|
||||
|
||||
(void) sd_event_source_set_description(fs->event_source, "service-fd-store");
|
||||
|
||||
LIST_PREPEND(fd_store, s->fd_store, fs);
|
||||
s->n_fd_store++;
|
||||
|
||||
|
@ -422,12 +426,18 @@ static int service_arm_timer(Service *s, usec_t usec) {
|
|||
return sd_event_source_set_enabled(s->timer_event_source, SD_EVENT_ONESHOT);
|
||||
}
|
||||
|
||||
return sd_event_add_time(
|
||||
r = sd_event_add_time(
|
||||
UNIT(s)->manager->event,
|
||||
&s->timer_event_source,
|
||||
CLOCK_MONOTONIC,
|
||||
now(CLOCK_MONOTONIC) + usec, 0,
|
||||
service_dispatch_timer, s);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) sd_event_source_set_description(s->timer_event_source, "service-timer");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int service_verify(Service *s) {
|
||||
|
|
|
@ -170,12 +170,18 @@ static int socket_arm_timer(Socket *s) {
|
|||
return sd_event_source_set_enabled(s->timer_event_source, SD_EVENT_ONESHOT);
|
||||
}
|
||||
|
||||
return sd_event_add_time(
|
||||
r = sd_event_add_time(
|
||||
UNIT(s)->manager->event,
|
||||
&s->timer_event_source,
|
||||
CLOCK_MONOTONIC,
|
||||
now(CLOCK_MONOTONIC) + s->timeout_usec, 0,
|
||||
socket_dispatch_timer, s);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) sd_event_source_set_description(s->timer_event_source, "socket-timer");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int socket_instantiate_service(Socket *s) {
|
||||
|
@ -1266,6 +1272,7 @@ static int socket_watch_fds(Socket *s) {
|
|||
else
|
||||
r = sd_event_add_io(UNIT(s)->manager->event, &p->event_source, p->fd, EPOLLIN, socket_dispatch_io, p);
|
||||
|
||||
(void) sd_event_source_set_description(p->event_source, "socket-port-io");
|
||||
if (r < 0) {
|
||||
log_unit_warning_errno(UNIT(s)->id, r, "Failed to watch listening fds: %m");
|
||||
goto fail;
|
||||
|
|
|
@ -177,12 +177,18 @@ static int swap_arm_timer(Swap *s) {
|
|||
return sd_event_source_set_enabled(s->timer_event_source, SD_EVENT_ONESHOT);
|
||||
}
|
||||
|
||||
return sd_event_add_time(
|
||||
r = sd_event_add_time(
|
||||
UNIT(s)->manager->event,
|
||||
&s->timer_event_source,
|
||||
CLOCK_MONOTONIC,
|
||||
now(CLOCK_MONOTONIC) + s->timeout_usec, 0,
|
||||
swap_dispatch_timer, s);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
(void) sd_event_source_set_description(s->timer_event_source, "swap-timer");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int swap_add_device_links(Swap *s) {
|
||||
|
@ -1294,6 +1300,8 @@ static int swap_enumerate(Manager *m) {
|
|||
r = sd_event_source_set_priority(m->swap_event_source, -10);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
(void) sd_event_source_set_description(m->swap_event_source, "swap-proc");
|
||||
}
|
||||
|
||||
r = swap_load_proc_swaps(m, false);
|
||||
|
|
|
@ -444,6 +444,8 @@ static void timer_enter_waiting(Timer *t, bool initial) {
|
|||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
(void) sd_event_source_set_description(t->monotonic_event_source, "timer-monotonic");
|
||||
|
||||
} else if (t->monotonic_event_source) {
|
||||
|
||||
r = sd_event_source_set_enabled(t->monotonic_event_source, SD_EVENT_OFF);
|
||||
|
@ -471,6 +473,8 @@ static void timer_enter_waiting(Timer *t, bool initial) {
|
|||
if (r < 0)
|
||||
goto fail;
|
||||
|
||||
(void) sd_event_source_set_description(t->realtime_event_source, "timer-realtime");
|
||||
|
||||
} else if (t->realtime_event_source) {
|
||||
|
||||
r = sd_event_source_set_enabled(t->realtime_event_source, SD_EVENT_OFF);
|
||||
|
|
Loading…
Reference in New Issue