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 -1
View File
@@ -194,7 +194,9 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
SD_VARLINK_FIELD_COMMENT("Exit code of the manager"),
SD_VARLINK_DEFINE_FIELD(ExitCode, SD_VARLINK_INT, 0),
SD_VARLINK_FIELD_COMMENT("Encodes how many soft-reboots were successfully completed"),
SD_VARLINK_DEFINE_FIELD(SoftRebootsCount, SD_VARLINK_INT, 0));
SD_VARLINK_DEFINE_FIELD(SoftRebootsCount, SD_VARLINK_INT, 0),
SD_VARLINK_FIELD_COMMENT("Number of successfully completed configuration reloads"),
SD_VARLINK_DEFINE_FIELD(ReloadCount, SD_VARLINK_INT, 0));
static SD_VARLINK_DEFINE_METHOD(
Describe,