|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
From bfb4c47dddd3c7aeaa07eb733bb50b62eff2e082 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
From: Michael Chapman <mike@very.puzzling.org>
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Date: Thu, 6 Nov 2014 19:47:02 +1100
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Subject: [PATCH] timer: reenable TIMER_ACTIVE timers when restarted
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
A timer configured with OnActiveSec will start its associated unit again
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
if the timer is stopped, then started. However, if the timer unit is
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
restarted -- with "systemctl restart", say -- this does not occur.
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
This commit ensures that TIMER_ACTIVE timers are re-enabled whenever the
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
timer is started, even if that's within a restart job.
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
(cherry picked from commit 779042e772d2459f7649b34a164902dc456f1bab)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
src/core/timer.c | 6 ++++++
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
1 file changed, 6 insertions(+)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
diff --git a/src/core/timer.c b/src/core/timer.c
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
index a3713e2140..5c4e9f995a 100644
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
--- a/src/core/timer.c
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+++ b/src/core/timer.c
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
@@ -521,6 +521,7 @@ fail:
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
static int timer_start(Unit *u) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
Timer *t = TIMER(u);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ TimerValue *v;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
assert(t);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
assert(t->state == TIMER_DEAD || t->state == TIMER_FAILED);
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
@@ -530,6 +531,11 @@ static int timer_start(Unit *u) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
t->last_trigger = DUAL_TIMESTAMP_NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ /* Reenable all timers that depend on unit activation time */
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ LIST_FOREACH(value, v, t->values)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ if (v->base == TIMER_ACTIVE)
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+ v->disabled = false;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
if (t->stamp_path) {
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
struct stat st;
|
|
Zbigniew Jędrzejewski-Szmek |
ea1976 |
|