mirror of
https://github.com/systemd/systemd.git
synced 2024-11-02 02:21:44 +03:00
service: explicit stop the watchdog when we shall not use it
This is useful so that WATCHDOG_USEC=0 sent from a process does the right thing if turning off the watchdog logic.
This commit is contained in:
parent
2a1e0f2228
commit
9fb1cdb480
@ -195,19 +195,21 @@ static usec_t service_get_watchdog_usec(Service *s) {
|
|||||||
|
|
||||||
if (s->watchdog_override_enable)
|
if (s->watchdog_override_enable)
|
||||||
return s->watchdog_override_usec;
|
return s->watchdog_override_usec;
|
||||||
else
|
|
||||||
return s->watchdog_usec;
|
return s->watchdog_original_usec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void service_start_watchdog(Service *s) {
|
static void service_start_watchdog(Service *s) {
|
||||||
int r;
|
|
||||||
usec_t watchdog_usec;
|
usec_t watchdog_usec;
|
||||||
|
int r;
|
||||||
|
|
||||||
assert(s);
|
assert(s);
|
||||||
|
|
||||||
watchdog_usec = service_get_watchdog_usec(s);
|
watchdog_usec = service_get_watchdog_usec(s);
|
||||||
if (IN_SET(watchdog_usec, 0, USEC_INFINITY))
|
if (IN_SET(watchdog_usec, 0, USEC_INFINITY)) {
|
||||||
|
service_stop_watchdog(s);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (s->watchdog_event_source) {
|
if (s->watchdog_event_source) {
|
||||||
r = sd_event_source_set_time(s->watchdog_event_source, usec_add(s->watchdog_timestamp.monotonic, watchdog_usec));
|
r = sd_event_source_set_time(s->watchdog_event_source, usec_add(s->watchdog_timestamp.monotonic, watchdog_usec));
|
||||||
|
Loading…
Reference in New Issue
Block a user