[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    increase watchdog's priority
From:       Nikos Mavrogiannopoulos <n.mavrogiannopoulos () gmail ! com>
Date:       2014-09-27 10:37:17
Message-ID: CAJU7zaJrn3iM=iKtLpySm-y+z=k2fB-RnDZDUznqk+ec+k_MUQ () mail ! gmail ! com
[Download RAW message or body]

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

["0001-watchdog-use-setpriority-to-increase-its-priority.patch" (text/x-patch)]

From 58b001ee3a728cccf66ec0b8ae3d29d74494d93b Mon Sep 17 00:00:00 2001
From: Nikos Mavrogiannopoulos <nmav@gnutls.org>
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 <nmav@gnutls.org>
---
 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
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic