From: Mike Yuan Date: Thu, 18 Apr 2024 00:59:10 +0000 (+0800) Subject: core/manager: log about previous objective X-Git-Tag: v256-rc1~132^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F32328%2Fhead;p=thirdparty%2Fsystemd.git core/manager: log about previous objective Addresses https://github.com/systemd/systemd/pull/32320#discussion_r1569192295 --- diff --git a/src/core/manager.c b/src/core/manager.c index fb3da638538..d113089e3e3 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -1974,6 +1974,15 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds, const char *roo return log_error_errno(r, "Deserialization failed: %m"); } + if (m->previous_objective >= 0) { + if (IN_SET(m->previous_objective, MANAGER_REEXECUTE, MANAGER_SOFT_REBOOT, MANAGER_SWITCH_ROOT)) + log_debug("Launching as effect of a '%s' operation.", + manager_objective_to_string(m->previous_objective)); + else + log_warning("Got unexpected previous objective '%s', ignoring.", + manager_objective_to_string(m->previous_objective)); + } + /* If we are in a new soft-reboot iteration bump the counter now before starting units, so * that they can reliably read it. We get the previous objective from serialized state. */ if (m->previous_objective == MANAGER_SOFT_REBOOT)