core: serialize and deserialize auto start/stop ratelimit
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 17 Nov 2023 16:53:00 +0000 (17:53 +0100)
committerLuca Boccassi <bluca@debian.org>
Wed, 22 Nov 2023 12:12:35 +0000 (12:12 +0000)
The limit is not configurable, so the logic in the helper will always update
the counters. The helper is a bit overkill, but it doesn't really matter.

src/core/unit-serialize.c

index bef3654..fe4221c 100644 (file)
@@ -141,6 +141,7 @@ int unit_serialize_state(Unit *u, FILE *f, FDSet *fds, bool switching_root) {
         (void) serialize_dual_timestamp(f, "assert-timestamp", &u->assert_timestamp);
 
         (void) serialize_ratelimit(f, "start-ratelimit", &u->start_ratelimit);
+        (void) serialize_ratelimit(f, "auto-start-stop-ratelimit", &u->auto_start_stop_ratelimit);
 
         if (dual_timestamp_is_set(&u->condition_timestamp))
                 (void) serialize_bool(f, "condition-result", u->condition_result);
@@ -348,6 +349,9 @@ int unit_deserialize_state(Unit *u, FILE *f, FDSet *fds) {
                 } else if (streq(l, "start-ratelimit")) {
                         deserialize_ratelimit(&u->start_ratelimit, l, v);
                         continue;
+                } else if (streq(l, "auto-start-stop-ratelimit")) {
+                        deserialize_ratelimit(&u->auto_start_stop_ratelimit, l, v);
+                        continue;
 
                 } else if (MATCH_DESERIALIZE("condition-result", l, v, parse_boolean, u->condition_result))
                         continue;