mirror of
https://github.com/systemd/systemd.git
synced 2024-10-27 10:25:37 +03:00
watchdog: rename special string "infinity" taken by the watchdog timeout options to "default"
This commit is contained in:
parent
0ffdfe7d68
commit
8a85c5b616
@ -137,7 +137,7 @@
|
|||||||
seconds (or in other time units if suffixed with <literal>ms</literal>, <literal>min</literal>,
|
seconds (or in other time units if suffixed with <literal>ms</literal>, <literal>min</literal>,
|
||||||
<literal>h</literal>, <literal>d</literal>, <literal>w</literal>). If set to zero the watchdog logic
|
<literal>h</literal>, <literal>d</literal>, <literal>w</literal>). If set to zero the watchdog logic
|
||||||
is disabled: no watchdog device is opened, configured, or pinged. If set to the special string
|
is disabled: no watchdog device is opened, configured, or pinged. If set to the special string
|
||||||
<literal>infinity</literal> the watchdog is opened and pinged in regular intervals, but the timeout
|
<literal>default</literal> the watchdog is opened and pinged in regular intervals, but the timeout
|
||||||
is not changed from the default. If set to any other time value the watchdog timeout is configured to
|
is not changed from the default. If set to any other time value the watchdog timeout is configured to
|
||||||
the specified value (or a value close to it, depending on hardware capabilities).</para>
|
the specified value (or a value close to it, depending on hardware capabilities).</para>
|
||||||
|
|
||||||
|
@ -6262,3 +6262,32 @@ int config_parse_swap_priority(
|
|||||||
s->parameters_fragment.priority_set = true;
|
s->parameters_fragment.priority_set = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int config_parse_watchdog_sec(
|
||||||
|
const char *unit,
|
||||||
|
const char *filename,
|
||||||
|
unsigned line,
|
||||||
|
const char *section,
|
||||||
|
unsigned section_line,
|
||||||
|
const char *lvalue,
|
||||||
|
int ltype,
|
||||||
|
const char *rvalue,
|
||||||
|
void *data,
|
||||||
|
void *userdata) {
|
||||||
|
|
||||||
|
assert(filename);
|
||||||
|
assert(lvalue);
|
||||||
|
assert(rvalue);
|
||||||
|
|
||||||
|
/* This is called for {Runtime,Reboot,KExec}WatchdogSec= where "default" maps to
|
||||||
|
* USEC_INFINITY internally. */
|
||||||
|
|
||||||
|
if (streq(rvalue, "default")) {
|
||||||
|
usec_t *usec = data;
|
||||||
|
|
||||||
|
*usec = USEC_INFINITY;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return config_parse_sec(unit, filename, line, section, section_line, lvalue, ltype, rvalue, data, userdata);
|
||||||
|
}
|
||||||
|
@ -142,6 +142,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_extension_images);
|
|||||||
CONFIG_PARSER_PROTOTYPE(config_parse_bpf_foreign_program);
|
CONFIG_PARSER_PROTOTYPE(config_parse_bpf_foreign_program);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_cgroup_socket_bind);
|
CONFIG_PARSER_PROTOTYPE(config_parse_cgroup_socket_bind);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_restrict_network_interfaces);
|
CONFIG_PARSER_PROTOTYPE(config_parse_restrict_network_interfaces);
|
||||||
|
CONFIG_PARSER_PROTOTYPE(config_parse_watchdog_sec);
|
||||||
|
|
||||||
/* gperf prototypes */
|
/* gperf prototypes */
|
||||||
const struct ConfigPerfItem* load_fragment_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
const struct ConfigPerfItem* load_fragment_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
|
||||||
|
@ -536,11 +536,17 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
|
|||||||
if (proc_cmdline_value_missing(key, value))
|
if (proc_cmdline_value_missing(key, value))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = parse_sec(value, &arg_runtime_watchdog);
|
if (streq(value, "default"))
|
||||||
if (r < 0)
|
arg_runtime_watchdog = USEC_INFINITY;
|
||||||
log_warning_errno(r, "Failed to parse systemd.watchdog_sec= argument '%s', ignoring: %m", value);
|
else {
|
||||||
else
|
r = parse_sec(value, &arg_runtime_watchdog);
|
||||||
arg_kexec_watchdog = arg_reboot_watchdog = arg_runtime_watchdog;
|
if (r < 0) {
|
||||||
|
log_warning_errno(r, "Failed to parse systemd.watchdog_sec= argument '%s', ignoring: %m", value);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
arg_kexec_watchdog = arg_reboot_watchdog = arg_runtime_watchdog;
|
||||||
|
|
||||||
} else if (proc_cmdline_key_streq(key, "systemd.clock_usec")) {
|
} else if (proc_cmdline_key_streq(key, "systemd.clock_usec")) {
|
||||||
|
|
||||||
@ -662,10 +668,10 @@ static int parse_config_file(void) {
|
|||||||
{ "Manager", "NUMAPolicy", config_parse_numa_policy, 0, &arg_numa_policy.type },
|
{ "Manager", "NUMAPolicy", config_parse_numa_policy, 0, &arg_numa_policy.type },
|
||||||
{ "Manager", "NUMAMask", config_parse_numa_mask, 0, &arg_numa_policy },
|
{ "Manager", "NUMAMask", config_parse_numa_mask, 0, &arg_numa_policy },
|
||||||
{ "Manager", "JoinControllers", config_parse_warn_compat, DISABLED_CONFIGURATION, NULL },
|
{ "Manager", "JoinControllers", config_parse_warn_compat, DISABLED_CONFIGURATION, NULL },
|
||||||
{ "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog },
|
{ "Manager", "RuntimeWatchdogSec", config_parse_watchdog_sec, 0, &arg_runtime_watchdog },
|
||||||
{ "Manager", "RebootWatchdogSec", config_parse_sec, 0, &arg_reboot_watchdog },
|
{ "Manager", "RebootWatchdogSec", config_parse_watchdog_sec, 0, &arg_reboot_watchdog },
|
||||||
{ "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_reboot_watchdog }, /* obsolete alias */
|
{ "Manager", "ShutdownWatchdogSec", config_parse_watchdog_sec, 0, &arg_reboot_watchdog }, /* obsolete alias */
|
||||||
{ "Manager", "KExecWatchdogSec", config_parse_sec, 0, &arg_kexec_watchdog },
|
{ "Manager", "KExecWatchdogSec", config_parse_watchdog_sec, 0, &arg_kexec_watchdog },
|
||||||
{ "Manager", "WatchdogDevice", config_parse_path, 0, &arg_watchdog_device },
|
{ "Manager", "WatchdogDevice", config_parse_path, 0, &arg_watchdog_device },
|
||||||
{ "Manager", "CapabilityBoundingSet", config_parse_capability_set, 0, &arg_capability_bounding_set },
|
{ "Manager", "CapabilityBoundingSet", config_parse_capability_set, 0, &arg_capability_bounding_set },
|
||||||
{ "Manager", "NoNewPrivileges", config_parse_bool, 0, &arg_no_new_privs },
|
{ "Manager", "NoNewPrivileges", config_parse_bool, 0, &arg_no_new_privs },
|
||||||
|
Loading…
Reference in New Issue
Block a user