assert(s);
- if (s->will_auto_restart)
- return true;
if (IN_SET(s->state, SERVICE_DEAD_BEFORE_AUTO_RESTART, SERVICE_FAILED_BEFORE_AUTO_RESTART, SERVICE_AUTO_RESTART))
return true;
log_unit_debug(UNIT(s), "Service restart not allowed.");
else {
const char *reason;
- bool shall_restart;
- shall_restart = service_shall_restart(s, &reason);
+ allow_restart = service_shall_restart(s, &reason);
log_unit_debug(UNIT(s), "Service will %srestart (%s)",
- shall_restart ? "" : "not ",
+ allow_restart ? "" : "not ",
reason);
- if (shall_restart)
- s->will_auto_restart = true;
}
- if (s->will_auto_restart) {
- s->will_auto_restart = false;
-
+ if (allow_restart) {
/* We make two state changes here: one that maps to the high-level UNIT_INACTIVE/UNIT_FAILED
* state (i.e. a state indicating deactivation), and then one that that maps to the
* high-level UNIT_STARTING state (i.e. a state indicating activation). We do this so that
bool main_pid_alien:1;
bool bus_name_good:1;
bool forbid_restart:1;
- /* Keep restart intention between UNIT_FAILED and UNIT_ACTIVATING */
- bool will_auto_restart:1;
bool start_timeout_defined:1;
bool exec_fd_hot:1;
if (ns != os && ns == UNIT_FAILED) {
log_unit_debug(u, "Unit entered failed state.");
-
- if (!(flags & UNIT_NOTIFY_WILL_AUTO_RESTART))
- unit_start_on_failure(u, "OnFailure=", UNIT_ATOM_ON_FAILURE, u->on_failure_job_mode);
+ unit_start_on_failure(u, "OnFailure=", UNIT_ATOM_ON_FAILURE, u->on_failure_job_mode);
}
if (UNIT_IS_ACTIVE_OR_RELOADING(ns) && !UNIT_IS_ACTIVE_OR_RELOADING(os)) {
unit_log_resources(u);
}
- if (ns == UNIT_INACTIVE && !IN_SET(os, UNIT_FAILED, UNIT_INACTIVE, UNIT_MAINTENANCE) &&
- !(flags & UNIT_NOTIFY_WILL_AUTO_RESTART))
+ if (ns == UNIT_INACTIVE && !IN_SET(os, UNIT_FAILED, UNIT_INACTIVE, UNIT_MAINTENANCE))
unit_start_on_failure(u, "OnSuccess=", UNIT_ATOM_ON_SUCCESS, u->on_success_job_mode);
}
typedef enum UnitNotifyFlags {
UNIT_NOTIFY_RELOAD_FAILURE = 1 << 0,
- UNIT_NOTIFY_WILL_AUTO_RESTART = 1 << 1,
} UnitNotifyFlags;
void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, UnitNotifyFlags flags);