Implement a flag to enable fallback always
On some machines we want our watchdog running as long as the
phosphor-watchdog daemon is alive. This patch adds an option to enter
fallback mode any time the watchdog expires or is set to be disabled.
Change-Id: Ic96d2f15c761aeb4e25158c5bd861076cca6497d
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/mainapp.cpp b/mainapp.cpp
index 365fd50..de09ba3 100644
--- a/mainapp.cpp
+++ b/mainapp.cpp
@@ -172,9 +172,21 @@
fallback = Watchdog::Fallback{
.action = action,
.interval = interval,
+ .always = false,
};
}
+ auto fallbackAlwaysParam = (options)["fallback_always"];
+ if (!fallbackAlwaysParam.empty())
+ {
+ if (!fallback)
+ {
+ exitWithError("Specified the fallback should always be enabled but "
+ "no fallback provided.", argv);
+ }
+ fallback->always = true;
+ }
+
sd_event* event = nullptr;
auto r = sd_event_default(&event);
if (r < 0)