static unsigned arg_default_start_limit_burst;
static usec_t arg_runtime_watchdog;
static usec_t arg_shutdown_watchdog;
+static usec_t arg_kexec_watchdog;
static char *arg_early_core_pattern;
static char *arg_watchdog_device;
static char **arg_default_environment;
{ "Manager", "JoinControllers", config_parse_warn_compat, DISABLED_CONFIGURATION, NULL },
{ "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog },
{ "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog },
+ { "Manager", "KExecWatchdogSec", config_parse_sec, 0, &arg_kexec_watchdog },
{ "Manager", "WatchdogDevice", config_parse_path, 0, &arg_watchdog_device },
{ "Manager", "CapabilityBoundingSet", config_parse_capability_set, 0, &arg_capability_bounding_set },
{ "Manager", "NoNewPrivileges", config_parse_bool, 0, &arg_no_new_privs },
m->service_watchdogs = arg_service_watchdogs;
m->runtime_watchdog = arg_runtime_watchdog;
m->shutdown_watchdog = arg_shutdown_watchdog;
+ m->kexec_watchdog = arg_kexec_watchdog;
m->cad_burst_action = arg_cad_burst_action;
manager_set_show_status(m, arg_show_status);
_cleanup_strv_free_ char **env_block = NULL;
size_t pos = 7;
int r;
+ usec_t watchdog_timer = 0;
assert(shutdown_verb);
assert(!command_line[pos]);
assert(pos < ELEMENTSOF(command_line));
- if (STR_IN_SET(shutdown_verb, "reboot", "kexec") &&
- arg_shutdown_watchdog > 0 &&
- arg_shutdown_watchdog != USEC_INFINITY) {
+ if (streq(shutdown_verb, "reboot"))
+ watchdog_timer = arg_shutdown_watchdog;
+ else if (streq(shutdown_verb, "kexec"))
+ watchdog_timer = arg_kexec_watchdog;
+
+ if (watchdog_timer > 0 && watchdog_timer != USEC_INFINITY) {
char *e;
- /* If we reboot let's set the shutdown
+ /* If we reboot or kexec let's set the shutdown
* watchdog and tell the shutdown binary to
* repeatedly ping it */
- r = watchdog_set_timeout(&arg_shutdown_watchdog);
+ r = watchdog_set_timeout(&watchdog_timer);
watchdog_close(r < 0);
/* Tell the binary how often to ping, ignore failure */
- if (asprintf(&e, "WATCHDOG_USEC="USEC_FMT, arg_shutdown_watchdog) > 0)
+ if (asprintf(&e, "WATCHDOG_USEC="USEC_FMT, watchdog_timer) > 0)
(void) strv_consume(&env_block, e);
if (arg_watchdog_device &&
arg_default_start_limit_burst = DEFAULT_START_LIMIT_BURST;
arg_runtime_watchdog = 0;
arg_shutdown_watchdog = 10 * USEC_PER_MINUTE;
+ arg_kexec_watchdog = 0;
arg_early_core_pattern = NULL;
arg_watchdog_device = NULL;
if (m) {
arg_shutdown_watchdog = m->shutdown_watchdog;
+ arg_kexec_watchdog = m->kexec_watchdog;
m = manager_free(m);
}