diff options
author | Tom Gundersen <teg@jklm.no> | 2015-04-29 16:05:32 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2015-04-29 17:08:31 +0200 |
commit | 7dfbe2e3fc0215b49d8202a32beb6b1aae08c4e4 (patch) | |
tree | a4916772973c4a6053f5eec7492b273304e473e5 /src/core | |
parent | 77cfd1139cd116e9761aacfaf8c3cde71fc5d058 (diff) |
core: annotate event sources
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/automount.c | 13 | ||||
-rw-r--r-- | src/core/busname.c | 9 | ||||
-rw-r--r-- | src/core/dbus.c | 2 | ||||
-rw-r--r-- | src/core/device.c | 2 | ||||
-rw-r--r-- | src/core/job.c | 4 | ||||
-rw-r--r-- | src/core/manager.c | 14 | ||||
-rw-r--r-- | src/core/mount.c | 12 | ||||
-rw-r--r-- | src/core/path.c | 2 | ||||
-rw-r--r-- | src/core/scope.c | 8 | ||||
-rw-r--r-- | src/core/service.c | 12 | ||||
-rw-r--r-- | src/core/socket.c | 9 | ||||
-rw-r--r-- | src/core/swap.c | 10 | ||||
-rw-r--r-- | src/core/timer.c | 4 |
13 files changed, 93 insertions, 8 deletions
diff --git a/src/core/automount.c b/src/core/automount.c index 6fc214b704..b1109bd67c 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -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) { diff --git a/src/core/busname.c b/src/core/busname.c index aba2a96c1a..48cc0459ed 100644 --- a/src/core/busname.c +++ b/src/core/busname.c @@ -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); diff --git a/src/core/dbus.c b/src/core/dbus.c index 02b998c6d1..43b2ccd64e 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -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; diff --git a/src/core/device.c b/src/core/device.c index 19b688df55..5656c96669 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -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); diff --git a/src/core/job.c b/src/core/job.c index e92e24e44a..a26f7de450 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -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; } diff --git a/src/core/manager.c b/src/core/manager.c index f13dad538f..0c94e9ef10 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -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; diff --git a/src/core/mount.c b/src/core/mount.c index eb25bcbdbe..d0c41a73a9 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -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); diff --git a/src/core/path.c b/src/core/path.c index fbb695d87f..b6322bdbcd 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -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, '/')) { diff --git a/src/core/scope.c b/src/core/scope.c index cbfa3369ab..b99eca90e0 100644 --- a/src/core/scope.c +++ b/src/core/scope.c @@ -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) { diff --git a/src/core/service.c b/src/core/service.c index 3a614b1c7a..d52ba73aac 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -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) { diff --git a/src/core/socket.c b/src/core/socket.c index 1f931eb986..702742f2a9 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -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; diff --git a/src/core/swap.c b/src/core/swap.c index 74f26b7a76..ae45b80967 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -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); diff --git a/src/core/timer.c b/src/core/timer.c index 940550194b..d6905bb510 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -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); |