From d336b8ee9c67d2226f869c75052619617948e738 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Thu, 18 Apr 2024 08:59:10 +0800 Subject: [PATCH] core/manager: log about previous objective Addresses https://github.com/systemd/systemd/pull/32320#discussion_r1569192295 --- src/core/manager.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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) -- 2.47.3