summaryrefslogtreecommitdiffhomepage
path: root/contrib/package/freifunk-watchdog/src/watchdog.h
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-07-15 17:25:24 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-07-15 17:25:24 +0000
commit05a16326708a0c7cf6593f8ee75c79ff80c2e1f1 (patch)
treea2ff1f5de4d862763e819dee89d900fe9a930919 /contrib/package/freifunk-watchdog/src/watchdog.h
parentdc7cf4417d7bdaa95227de2e476b8c82ae11be6a (diff)
contrib/package: make freifunk-watchdog more generic
This change is based on a patch by "flyn" from https://dev.openwrt.org/ticket/11868 .
Diffstat (limited to 'contrib/package/freifunk-watchdog/src/watchdog.h')
-rw-r--r--contrib/package/freifunk-watchdog/src/watchdog.h28
1 files changed, 21 insertions, 7 deletions
diff --git a/contrib/package/freifunk-watchdog/src/watchdog.h b/contrib/package/freifunk-watchdog/src/watchdog.h
index 71c10e9c1f..34d616c3a0 100644
--- a/contrib/package/freifunk-watchdog/src/watchdog.h
+++ b/contrib/package/freifunk-watchdog/src/watchdog.h
@@ -52,15 +52,12 @@
/* How to call myself in the logs */
#define SYSLOG_IDENT "Freifunk Watchdog"
+/* Process error action */
+#define PROC_ACTION curr_proc->initscript, curr_proc->initscript, "restart"
+
/* Wifi error action */
#define WIFI_ACTION "/sbin/wifi", "/sbin/wifi"
-/* Crond error action */
-#define CRON_ACTION "/etc/init.d/cron", "/etc/init.d/cron", "restart"
-
-/* SSHd error action */
-#define SSHD_ACTION "/etc/init.d/dropbear", "/etc/init.d/dropbear", "restart"
-
/* Watchdog device */
#define WATCH_DEVICE "/dev/watchdog"
#define WATCH_SHUTDOWN 'V'
@@ -85,7 +82,7 @@ struct wifi_tuple {
};
/* structure to hold tuple-list and uci context during iteration */
-struct uci_itr_ctx {
+struct uci_wifi_iface_itr_ctx {
struct wifi_tuple *list;
struct uci_context *ctx;
};
@@ -93,6 +90,23 @@ struct uci_itr_ctx {
typedef struct wifi_tuple wifi_tuple_t;
+/* process name/exec tuples */
+struct process_tuple {
+ char process[PATH_MAX + 1];
+ char initscript[PATH_MAX + 1];
+ int restart;
+ struct process_tuple *next;
+};
+
+/* structure to hold tuple-list and uci context during iteration */
+struct uci_process_itr_ctx {
+ struct process_tuple *list;
+ struct uci_context *ctx;
+};
+
+typedef struct process_tuple process_tuple_t;
+
+
/* ioctl() helper (stolen from iwlib) */
static inline int
iw_ioctl(int skfd, /* Socket to the kernel */