diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/cgroup.c | 4 | ||||
-rw-r--r-- | src/core/manager.c | 11 | ||||
-rw-r--r-- | src/core/manager.h | 1 |
3 files changed, 12 insertions, 4 deletions
diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 9248cb523b..6c6e4f5e7b 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -300,7 +300,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha char buf[MAX(DECIMAL_STR_MAX(unsigned long), DECIMAL_STR_MAX(usec_t)) + 1]; sprintf(buf, "%lu\n", - state == MANAGER_STARTING && c->startup_cpu_shares != (unsigned long) -1 ? c->startup_cpu_shares : + IN_SET(state, MANAGER_STARTING, MANAGER_INITIALIZING) && c->startup_cpu_shares != (unsigned long) -1 ? c->startup_cpu_shares : c->cpu_shares != (unsigned long) -1 ? c->cpu_shares : 1024); r = cg_set_attribute("cpu", path, "cpu.shares", buf); if (r < 0) @@ -328,7 +328,7 @@ void cgroup_context_apply(CGroupContext *c, CGroupControllerMask mask, const cha CGroupBlockIODeviceBandwidth *b; if (!is_root) { - sprintf(buf, "%lu\n", state == MANAGER_STARTING && c->startup_blockio_weight != (unsigned long) -1 ? c->startup_blockio_weight : + sprintf(buf, "%lu\n", IN_SET(state, MANAGER_STARTING, MANAGER_INITIALIZING) && c->startup_blockio_weight != (unsigned long) -1 ? c->startup_blockio_weight : c->blockio_weight != (unsigned long) -1 ? c->blockio_weight : 1000); r = cg_set_attribute("blkio", path, "blkio.weight", buf); if (r < 0) diff --git a/src/core/manager.c b/src/core/manager.c index 7639aeef19..9abdf475cf 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -2837,7 +2837,7 @@ static bool manager_get_show_status(Manager *m) { if (m->no_console_output) return false; - if (!IN_SET(manager_state(m), MANAGER_STARTING, MANAGER_STOPPING)) + if (!IN_SET(manager_state(m), MANAGER_INITIALIZING, MANAGER_STARTING, MANAGER_STOPPING)) return false; if (m->show_status > 0) @@ -2928,8 +2928,14 @@ ManagerState manager_state(Manager *m) { assert(m); /* Did we ever finish booting? If not then we are still starting up */ - if (!dual_timestamp_is_set(&m->finish_timestamp)) + if (!dual_timestamp_is_set(&m->finish_timestamp)) { + + u = manager_get_unit(m, SPECIAL_BASIC_TARGET); + if (!u || !UNIT_IS_ACTIVE_OR_RELOADING(unit_active_state(u))) + return MANAGER_INITIALIZING; + return MANAGER_STARTING; + } /* Is the special shutdown target queued? If so, we are in shutdown state */ u = manager_get_unit(m, SPECIAL_SHUTDOWN_TARGET); @@ -2955,6 +2961,7 @@ ManagerState manager_state(Manager *m) { } static const char *const manager_state_table[_MANAGER_STATE_MAX] = { + [MANAGER_INITIALIZING] = "initializing", [MANAGER_STARTING] = "starting", [MANAGER_RUNNING] = "running", [MANAGER_DEGRADED] = "degraded", diff --git a/src/core/manager.h b/src/core/manager.h index 7d26c3adea..8e3c146b42 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -38,6 +38,7 @@ typedef struct Manager Manager; typedef enum ManagerState { + MANAGER_INITIALIZING, MANAGER_STARTING, MANAGER_RUNNING, MANAGER_DEGRADED, |