]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/manager: log about previous objective 32328/head
authorMike Yuan <me@yhndnzj.com>
Thu, 18 Apr 2024 00:59:10 +0000 (08:59 +0800)
committerMike Yuan <me@yhndnzj.com>
Thu, 18 Apr 2024 12:32:52 +0000 (20:32 +0800)
Addresses https://github.com/systemd/systemd/pull/32320#discussion_r1569192295

src/core/manager.c

index fb3da638538e12644a79f99b28db1966c19443ce..d113089e3e3f6e91e8d2276ab8f78191c75dbcba 100644 (file)
@@ -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)