]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: allow "off" as special watchdog time to be specified
authorLennart Poettering <lennart@poettering.net>
Wed, 13 Oct 2021 11:06:03 +0000 (13:06 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 Oct 2021 11:10:34 +0000 (13:10 +0200)
Right now we already understand "default" as special string for enabling
the watchdog but not reconfiguring its timeout (it is internally mapped
to USEC_MAX). To be systematic this adds "off" as special string for
disabling the watchdog logic (it is internally mapped to 0, which is how
this behaviour was previously requested).

src/core/load-fragment.c
src/core/main.c
src/core/system.conf.in

index 7c844a29df9afb35332bbd0cdde5d2eae403f6e1..18d9bb377c7a469494d8aa9623d60a72615b8da9 100644 (file)
@@ -6347,6 +6347,8 @@ int config_parse_watchdog_sec(
                 void *data,
                 void *userdata) {
 
+        usec_t *usec = data;
+
         assert(filename);
         assert(lvalue);
         assert(rvalue);
@@ -6354,12 +6356,12 @@ int config_parse_watchdog_sec(
         /* This is called for {Runtime,Reboot,KExec}WatchdogSec= where "default" maps to
          * USEC_INFINITY internally. */
 
-        if (streq(rvalue, "default")) {
-                usec_t *usec = data;
-
+        if (streq(rvalue, "default"))
                 *usec = USEC_INFINITY;
-                return 0;
-        }
+        else if (streq(rvalue, "off"))
+                *usec = 0;
+        else
+                return config_parse_sec(unit, filename, line, section, section_line, lvalue, ltype, rvalue, data, userdata);
 
-        return config_parse_sec(unit, filename, line, section, section_line, lvalue, ltype, rvalue, data, userdata);
+        return 0;
 }
index 4b8e923a1e08107c7a5c0c5a1f5d7c5b2a5d73ae..6e01398523c47a7516346e20308b4230e5a65164 100644 (file)
@@ -544,6 +544,8 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
 
                 if (streq(value, "default"))
                         arg_runtime_watchdog = USEC_INFINITY;
+                else if (streq(value, "off"))
+                        arg_runtime_watchdog = 0;
                 else {
                         r = parse_sec(value, &arg_runtime_watchdog);
                         if (r < 0) {
index e88280bd0a7b52e4c0d7dfd0b6e257d2bb77a28c..96fb64d2c1e4f9b2547b55789f7c9760234845c1 100644 (file)
@@ -29,9 +29,9 @@
 #CPUAffinity=
 #NUMAPolicy=default
 #NUMAMask=
-#RuntimeWatchdogSec=0
+#RuntimeWatchdogSec=off
 #RebootWatchdogSec=10min
-#KExecWatchdogSec=0
+#KExecWatchdogSec=off
 #WatchdogDevice=
 #CapabilityBoundingSet=
 #NoNewPrivileges=no