summaryrefslogtreecommitdiff
path: root/service/instance.h
diff options
context:
space:
mode:
authorDaniel Bailey <danielb@meshplusplus.com>2020-07-13 15:05:31 -0700
committerDaniel Golle <daniel@makrotopia.org>2020-07-14 00:16:09 +0100
commitb2230e4ff28b29472d0a232fee5d9f4168390b52 (patch)
tree69745db88e4eaca96c1143a7b188db8d88c6796b /service/instance.h
parent639df57cec10c7edeb585444c23f8a4565e46f4a (diff)
downloadprocd-b2230e4ff28b29472d0a232fee5d9f4168390b52.tar.gz
procd: add service instance watchdog
Added instance watchdog which will eventually either terminate or respawn an instance depending on the instance respawn setting. Added service ubus method 'watchdog' which services the watchdog timer and allows update of the instance watchdog mode instance. Two modes: disabled or passive. Disabled: cancels watchdog timer set for a given instance. Passive: sets a instance timer which must be serviced or the instance will be stopped/restarted (dependent upon the instance respawn value) when the timer expires. Signed-off-by: Daniel Bailey <danielb@meshplusplus.com>
Diffstat (limited to 'service/instance.h')
-rw-r--r--service/instance.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/service/instance.h b/service/instance.h
index e8ee15c..bb8a0c4 100644
--- a/service/instance.h
+++ b/service/instance.h
@@ -39,6 +39,19 @@ struct jail {
int argc;
};
+typedef enum instance_watchdog {
+ INSTANCE_WATCHDOG_MODE_DISABLED,
+ INSTANCE_WATCHDOG_MODE_PASSIVE,
+ INSTANCE_WATCHDOG_MODE_ACTIVE,
+ __INSTANCE_WATCHDOG_MODE_MAX,
+} instance_watchdog_mode_t;
+
+struct watchdog {
+ instance_watchdog_mode_t mode;
+ uint32_t freq;
+ struct uloop_timeout timeout;
+};
+
struct service_instance {
struct vlist_node node;
struct service *srv;
@@ -95,6 +108,8 @@ struct service_instance {
struct blobmsg_list file;
struct blobmsg_list limits;
struct blobmsg_list errors;
+
+ struct watchdog watchdog;
};
void instance_start(struct service_instance *in);