naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
b11b5f
From f2de5398b0a1ebb3e6390506368c11329b843524 Mon Sep 17 00:00:00 2001
b11b5f
From: Jan Macku <jamacku@redhat.com>
b11b5f
Date: Thu, 2 Sep 2021 16:50:50 +0200
b11b5f
Subject: [PATCH] core: Indicate the time when the manager started loading
b11b5f
 units the last time
b11b5f
b11b5f
(cherry picked from commit 15b9243c0d7f6d1531fa65dbc01bd11e8e6c12ca)
b11b5f
b11b5f
Resolves: #2136869
b11b5f
---
b11b5f
 src/core/manager.c | 5 +++++
b11b5f
 1 file changed, 5 insertions(+)
b11b5f
b11b5f
diff --git a/src/core/manager.c b/src/core/manager.c
b11b5f
index 8aa398cac8..a9cd51b624 100644
b11b5f
--- a/src/core/manager.c
b11b5f
+++ b/src/core/manager.c
b11b5f
@@ -3554,6 +3554,11 @@ int manager_reload(Manager *m) {
b11b5f
         /* Let's finally catch up with any changes that took place while we were reloading/reexecing */
b11b5f
         manager_catchup(m);
b11b5f
 
b11b5f
+        /* Create a file which will indicate when the manager started loading units the last time. */
b11b5f
+        (void) touch_file("/run/systemd/systemd-units-load", false,
b11b5f
+                m->timestamps[MANAGER_TIMESTAMP_UNITS_LOAD].realtime ?: now(CLOCK_REALTIME),
b11b5f
+                UID_INVALID, GID_INVALID, 0444);
b11b5f
+
b11b5f
         /* Sync current state of bus names with our set of listening units */
b11b5f
         q = manager_enqueue_sync_bus_names(m);
b11b5f
         if (q < 0 && r >= 0)