core: add ReloadCount to Manager and bump on successful reload

Introduce a counter that tracks how many configuration reloads have
been successfully completed by the manager. The increment lives in
manager_reload() right after the "point of no return", so failed
reload attempts that bail out earlier (e.g. during serialization)
do not bump the counter.

It is accessible as a new ReloadCount property to
org.freedesktop.systemd1.Manager (D-Bus) and ReloadCount to
io.systemd.Manager.Describe (Varlink).

Also add an integration test for ReloadCount
that verifies that the new ReloadCount property increments by one per
daemon-reload, accumulates correctly across multiple reloads, and that
D-Bus and Varlink return identical values. Also tests that the counter
reset after a reexec.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: Simon Lucido <simonlucido@meta.com>
This commit is contained in:
Simon Lucido
2026-05-03 10:23:55 +01:00
committed by Luca Boccassi
parent db28490c9f
commit d667b6b97f
8 changed files with 81 additions and 4 deletions
+3
View File
@@ -492,6 +492,9 @@ typedef struct Manager {
unsigned soft_reboots_count;
/* The number of successfully completed configuration reloads. */
uint64_t reload_count;
/* Original ambient capabilities when we were initialized */
uint64_t saved_ambient_set;
} Manager;