chiark / gitweb /
systemctl: show sub state along active state
[elogind.git] / service.c
index 86406e8041e5678c52140e82d376a1850da44728..74e8019bd194eddd804bd7aa143bf416c7e5bfec 100644 (file)
--- a/service.c
+++ b/service.c
@@ -624,7 +624,7 @@ static int service_load_sysv_path(Service *s, const char *path) {
         s->valid_no_process = true;
 
         /* Don't timeout special services during boot (like fsck) */
-        if (!chars_intersect("12345", s->sysv_runlevels))
+        if (s->sysv_runlevels && !chars_intersect("12345", s->sysv_runlevels))
                 s->timeout_usec = -1;
 
         u->meta.load_state = UNIT_LOADED;
@@ -1638,6 +1638,12 @@ static UnitActiveState service_active_state(Unit *u) {
         return state_translation_table[SERVICE(u)->state];
 }
 
+static const char *service_sub_state_to_string(Unit *u) {
+        assert(u);
+
+        return service_state_to_string(SERVICE(u)->state);
+}
+
 static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) {
         Service *s = SERVICE(u);
         bool success;
@@ -2065,6 +2071,7 @@ const UnitVTable service_vtable = {
         .can_reload = service_can_reload,
 
         .active_state = service_active_state,
+        .sub_state_to_string = service_sub_state_to_string,
 
         .sigchld_event = service_sigchld_event,
         .timer_event = service_timer_event,