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).
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
#CPUAffinity=
|
||||
#NUMAPolicy=default
|
||||
#NUMAMask=
|
||||
#RuntimeWatchdogSec=0
|
||||
#RuntimeWatchdogSec=off
|
||||
#RebootWatchdogSec=10min
|
||||
#KExecWatchdogSec=0
|
||||
#KExecWatchdogSec=off
|
||||
#WatchdogDevice=
|
||||
#CapabilityBoundingSet=
|
||||
#NoNewPrivileges=no
|
||||
|
||||
Reference in New Issue
Block a user