summaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorMike Frysinger2006-06-26 21:31:17 +0000
committerMike Frysinger2006-06-26 21:31:17 +0000
commitcd68a2e1a891843d8b437a323f1155a3b42d5a72 (patch)
treead4802094c0f43ad6f7772b790cb8a996eb066e5 /miscutils
parent42705abc2840b5472bf2c7846d83c75cfc695c1a (diff)
downloadbusybox-cd68a2e1a891843d8b437a323f1155a3b42d5a72.zip
busybox-cd68a2e1a891843d8b437a323f1155a3b42d5a72.tar.gz
fix watchdog on no-mmu systems by adding -F option for rexec
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/watchdog.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index e8275e6..ddd349d 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -15,6 +15,9 @@
#include <stdlib.h>
#include <signal.h>
+#define OPT_FOREGROUND 0x01
+#define OPT_TIMER 0x02
+
/* Watchdog file descriptor */
static int fd;
@@ -27,10 +30,13 @@ static void watchdog_shutdown(int ATTRIBUTE_UNUSED unused)
int watchdog_main(int argc, char **argv)
{
+ unsigned long opts;
unsigned long timer_duration = 30; /* Userspace timer duration, in seconds */
char *t_arg;
- if (bb_getopt_ulflags(argc, argv, "t:", &t_arg))
+ opts = bb_getopt_ulflags(argc, argv, "Ft:", &t_arg);
+
+ if (opts & OPT_TIMER)
timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX);
/* We're only interested in the watchdog device .. */
@@ -38,7 +44,8 @@ int watchdog_main(int argc, char **argv)
bb_show_usage();
#ifdef BB_NOMMU
- vfork_daemon(0, 1);
+ if (!(opts & OPT_FOREGROUND))
+ vfork_daemon_rexec(0, 1, argc, argv, "-F");
#else
bb_xdaemon(0, 1);
#endif