Hello,
 I've noticed that in several cases when my router was busy, watchdog
forced a reboot on the system. That patch increases the priority of the
watchdog compared to other processes.

regards,
Nikos
From 58b001ee3a728cccf66ec0b8ae3d29d74494d93b Mon Sep 17 00:00:00 2001
From: Nikos Mavrogiannopoulos <[email protected]>
Date: Sat, 27 Sep 2014 12:11:07 +0200
Subject: [PATCH] watchdog: use setpriority() to increase its priority

That will prevent not writing to watchdog in busy systems.

Signed-off-by: Nikos Mavrogiannopoulos <[email protected]>
---
 miscutils/watchdog.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index d3a76ed..ac10595 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -22,6 +22,8 @@
 #include "libbb.h"
 #include "linux/types.h" /* for __u32 */
 #include "linux/watchdog.h"
+#include <sys/time.h> /* for setpriority */
+#include <sys/resource.h> /* for setpriority */
 
 #define OPT_FOREGROUND  (1 << 0)
 #define OPT_STIMER      (1 << 1)
@@ -97,6 +99,7 @@ int watchdog_main(int argc, char **argv)
 #endif
 
 	write_pidfile(CONFIG_PID_FILE_PATH "/watchdog.pid");
+	setpriority(PRIO_PROCESS, 0, -10);
 
 	while (1) {
 		/*
-- 
2.0.0

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to