diff --git a/man/org.freedesktop.systemd1.xml b/man/org.freedesktop.systemd1.xml index 476971b4535..38fd7098aa2 100644 --- a/man/org.freedesktop.systemd1.xml +++ b/man/org.freedesktop.systemd1.xml @@ -2573,7 +2573,7 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { @org.freedesktop.DBus.Property.EmitsChangedSignal("const") readonly u RestartSteps = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") - readonly t RestartUSecMax = ...; + readonly t RestartMaxDelayUSec = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("false") readonly t RestartUSecNext = ...; @org.freedesktop.DBus.Property.EmitsChangedSignal("const") @@ -3213,7 +3213,7 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { - + @@ -3787,7 +3787,7 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice { - + diff --git a/man/systemd.service.xml b/man/systemd.service.xml index ba4f4275821..08976a1dd81 100644 --- a/man/systemd.service.xml +++ b/man/systemd.service.xml @@ -550,14 +550,14 @@ RestartSteps= Configures the number of steps to take to increase the interval - of auto-restarts from RestartSec= to RestartSecMax=. + of auto-restarts from RestartSec= to RestartMaxDelaySec=. Takes a positive integer or 0 to disable it. Defaults to 0. - This setting is effective only if RestartSecMax= is also set. + This setting is effective only if RestartMaxDelaySec= is also set. - RestartSecMax= + RestartMaxDelaySec= Configures the longest time to sleep before restarting a service as the interval goes up with RestartSteps=. Takes a value in the same format as RestartSec=, or infinity diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c index e368fcc6ef7..455114d8cad 100644 --- a/src/core/dbus-service.c +++ b/src/core/dbus-service.c @@ -326,7 +326,7 @@ const sd_bus_vtable bus_service_vtable[] = { SD_BUS_PROPERTY("NotifyAccess", "s", property_get_notify_access, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("RestartUSec", "t", bus_property_get_usec, offsetof(Service, restart_usec), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("RestartSteps", "u", bus_property_get_unsigned, offsetof(Service, restart_steps), SD_BUS_VTABLE_PROPERTY_CONST), - SD_BUS_PROPERTY("RestartUSecMax", "t", bus_property_get_usec, offsetof(Service, restart_usec_max), SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("RestartMaxDelayUSec", "t", bus_property_get_usec, offsetof(Service, restart_max_delay_usec), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("RestartUSecNext", "t", property_get_restart_usec_next, 0, 0), SD_BUS_PROPERTY("TimeoutStartUSec", "t", bus_property_get_usec, offsetof(Service, timeout_start_usec), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("TimeoutStopUSec", "t", bus_property_get_usec, offsetof(Service, timeout_stop_usec), SD_BUS_VTABLE_PROPERTY_CONST), @@ -561,8 +561,8 @@ static int bus_service_set_transient_property( if (streq(name, "RestartSteps")) return bus_set_transient_unsigned(u, name, &s->restart_steps, message, flags, error); - if (streq(name, "RestartUSecMax")) - return bus_set_transient_usec(u, name, &s->restart_usec_max, message, flags, error); + if (streq(name, "RestartMaxDelayUSec")) + return bus_set_transient_usec(u, name, &s->restart_max_delay_usec, message, flags, error); if (streq(name, "TimeoutStartUSec")) { r = bus_set_transient_usec(u, name, &s->timeout_start_usec, message, flags, error); diff --git a/src/core/load-fragment-gperf.gperf.in b/src/core/load-fragment-gperf.gperf.in index 2a3c2c2cb8e..83efe844562 100644 --- a/src/core/load-fragment-gperf.gperf.in +++ b/src/core/load-fragment-gperf.gperf.in @@ -405,7 +405,7 @@ Service.ExecStop, config_parse_exec, Service.ExecStopPost, config_parse_exec, SERVICE_EXEC_STOP_POST, offsetof(Service, exec_command) Service.RestartSec, config_parse_sec, 0, offsetof(Service, restart_usec) Service.RestartSteps, config_parse_unsigned, 0, offsetof(Service, restart_steps) -Service.RestartSecMax, config_parse_sec, 0, offsetof(Service, restart_usec_max) +Service.RestartMaxDelaySec, config_parse_sec, 0, offsetof(Service, restart_max_delay_usec) Service.TimeoutSec, config_parse_service_timeout, 0, 0 Service.TimeoutStartSec, config_parse_service_timeout, 0, 0 Service.TimeoutStopSec, config_parse_sec_fix_0, 0, offsetof(Service, timeout_stop_usec) diff --git a/src/core/service.c b/src/core/service.c index 5a06cc8a1d7..5c16a39309e 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -122,7 +122,7 @@ static void service_init(Unit *u) { s->timeout_abort_usec = u->manager->default_timeout_abort_usec; s->timeout_abort_set = u->manager->default_timeout_abort_set; s->restart_usec = u->manager->default_restart_usec; - s->restart_usec_max = USEC_INFINITY; + s->restart_max_delay_usec = USEC_INFINITY; s->runtime_max_usec = USEC_INFINITY; s->type = _SERVICE_TYPE_INVALID; s->socket_fd = -EBADF; @@ -293,18 +293,18 @@ usec_t service_restart_usec_next(Service *s) { if (n_restarts_next <= 1 || s->restart_steps == 0 || - s->restart_usec_max == USEC_INFINITY || - s->restart_usec >= s->restart_usec_max) + s->restart_max_delay_usec == USEC_INFINITY || + s->restart_usec >= s->restart_max_delay_usec) value = s->restart_usec; else if (n_restarts_next > s->restart_steps) - value = s->restart_usec_max; + value = s->restart_max_delay_usec; else { /* Enforced in service_verify() and above */ - assert(s->restart_usec_max > s->restart_usec); + assert(s->restart_max_delay_usec > s->restart_usec); /* ((restart_usec_max - restart_usec)^(1/restart_steps))^(n_restart_next - 1) */ value = usec_add(s->restart_usec, - (usec_t) powl(s->restart_usec_max - s->restart_usec, + (usec_t) powl(s->restart_max_delay_usec - s->restart_usec, (long double) (n_restarts_next - 1) / s->restart_steps)); } @@ -689,15 +689,15 @@ static int service_verify(Service *s) { if (s->exit_type == SERVICE_EXIT_CGROUP && cg_unified() < CGROUP_UNIFIED_SYSTEMD) log_unit_warning(UNIT(s), "Service has ExitType=cgroup set, but we are running with legacy cgroups v1, which might not work correctly. Continuing."); - if (s->restart_usec_max == USEC_INFINITY && s->restart_steps > 0) - log_unit_warning(UNIT(s), "Service has RestartSteps= but no RestartSecMax= setting. Ignoring."); + if (s->restart_max_delay_usec == USEC_INFINITY && s->restart_steps > 0) + log_unit_warning(UNIT(s), "Service has RestartSteps= but no RestartMaxDelaySec= setting. Ignoring."); - if (s->restart_usec_max != USEC_INFINITY && s->restart_steps == 0) - log_unit_warning(UNIT(s), "Service has RestartSecMax= but no RestartSteps= setting. Ignoring."); + if (s->restart_max_delay_usec != USEC_INFINITY && s->restart_steps == 0) + log_unit_warning(UNIT(s), "Service has RestartMaxDelaySec= but no RestartSteps= setting. Ignoring."); - if (s->restart_usec_max < s->restart_usec) { - log_unit_warning(UNIT(s), "RestartSecMax= has a value smaller than RestartSec=, resetting RestartSec= to RestartSecMax=."); - s->restart_usec = s->restart_usec_max; + if (s->restart_max_delay_usec < s->restart_usec) { + log_unit_warning(UNIT(s), "RestartMaxDelaySec= has a value smaller than RestartSec=, resetting RestartSec= to RestartMaxDelaySec=."); + s->restart_usec = s->restart_max_delay_usec; } return 0; @@ -991,14 +991,14 @@ static void service_dump(Unit *u, FILE *f, const char *prefix) { fprintf(f, "%sRestartSec: %s\n" "%sRestartSteps: %u\n" - "%sRestartSecMax: %s\n" + "%sRestartMaxDelaySec: %s\n" "%sTimeoutStartSec: %s\n" "%sTimeoutStopSec: %s\n" "%sTimeoutStartFailureMode: %s\n" "%sTimeoutStopFailureMode: %s\n", prefix, FORMAT_TIMESPAN(s->restart_usec, USEC_PER_SEC), prefix, s->restart_steps, - prefix, FORMAT_TIMESPAN(s->restart_usec_max, USEC_PER_SEC), + prefix, FORMAT_TIMESPAN(s->restart_max_delay_usec, USEC_PER_SEC), prefix, FORMAT_TIMESPAN(s->timeout_start_usec, USEC_PER_SEC), prefix, FORMAT_TIMESPAN(s->timeout_stop_usec, USEC_PER_SEC), prefix, service_timeout_failure_mode_to_string(s->timeout_start_failure_mode), diff --git a/src/core/service.h b/src/core/service.h index 5b7f67457e2..55c4127deed 100644 --- a/src/core/service.h +++ b/src/core/service.h @@ -117,7 +117,7 @@ struct Service { usec_t restart_usec; unsigned restart_steps; - usec_t restart_usec_max; + usec_t restart_max_delay_usec; usec_t timeout_start_usec; usec_t timeout_stop_usec; usec_t timeout_abort_usec;