From: Lennart Poettering Date: Wed, 13 Oct 2021 11:06:03 +0000 (+0200) Subject: core: allow "off" as special watchdog time to be specified X-Git-Tag: v250-rc1~509^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c91c95e66c50b590fbc0d4b7b464c56978100596;p=thirdparty%2Fsystemd.git core: allow "off" as special watchdog time to be specified 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). --- diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 7c844a29df9..18d9bb377c7 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -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; } diff --git a/src/core/main.c b/src/core/main.c index 4b8e923a1e0..6e01398523c 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -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) { diff --git a/src/core/system.conf.in b/src/core/system.conf.in index e88280bd0a7..96fb64d2c1e 100644 --- a/src/core/system.conf.in +++ b/src/core/system.conf.in @@ -29,9 +29,9 @@ #CPUAffinity= #NUMAPolicy=default #NUMAMask= -#RuntimeWatchdogSec=0 +#RuntimeWatchdogSec=off #RebootWatchdogSec=10min -#KExecWatchdogSec=0 +#KExecWatchdogSec=off #WatchdogDevice= #CapabilityBoundingSet= #NoNewPrivileges=no