aboutsummaryrefslogtreecommitdiff
path: root/miscutils/watchdog.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2006-06-26 21:31:17 +0000
committerMike Frysinger <vapier@gentoo.org>2006-06-26 21:31:17 +0000
commitcd68a2e1a891843d8b437a323f1155a3b42d5a72 (patch)
treead4802094c0f43ad6f7772b790cb8a996eb066e5 /miscutils/watchdog.c
parent42705abc2840b5472bf2c7846d83c75cfc695c1a (diff)
downloadbusybox-w32-cd68a2e1a891843d8b437a323f1155a3b42d5a72.tar.gz
busybox-w32-cd68a2e1a891843d8b437a323f1155a3b42d5a72.tar.bz2
busybox-w32-cd68a2e1a891843d8b437a323f1155a3b42d5a72.zip
fix watchdog on no-mmu systems by adding -F option for rexec
Diffstat (limited to 'miscutils/watchdog.c')
-rw-r--r--miscutils/watchdog.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index e8275e68e..ddd349d9b 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -15,6 +15,9 @@
15#include <stdlib.h> 15#include <stdlib.h>
16#include <signal.h> 16#include <signal.h>
17 17
18#define OPT_FOREGROUND 0x01
19#define OPT_TIMER 0x02
20
18/* Watchdog file descriptor */ 21/* Watchdog file descriptor */
19static int fd; 22static int fd;
20 23
@@ -27,10 +30,13 @@ static void watchdog_shutdown(int ATTRIBUTE_UNUSED unused)
27 30
28int watchdog_main(int argc, char **argv) 31int watchdog_main(int argc, char **argv)
29{ 32{
33 unsigned long opts;
30 unsigned long timer_duration = 30; /* Userspace timer duration, in seconds */ 34 unsigned long timer_duration = 30; /* Userspace timer duration, in seconds */
31 char *t_arg; 35 char *t_arg;
32 36
33 if (bb_getopt_ulflags(argc, argv, "t:", &t_arg)) 37 opts = bb_getopt_ulflags(argc, argv, "Ft:", &t_arg);
38
39 if (opts & OPT_TIMER)
34 timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX); 40 timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX);
35 41
36 /* We're only interested in the watchdog device .. */ 42 /* We're only interested in the watchdog device .. */
@@ -38,7 +44,8 @@ int watchdog_main(int argc, char **argv)
38 bb_show_usage(); 44 bb_show_usage();
39 45
40#ifdef BB_NOMMU 46#ifdef BB_NOMMU
41 vfork_daemon(0, 1); 47 if (!(opts & OPT_FOREGROUND))
48 vfork_daemon_rexec(0, 1, argc, argv, "-F");
42#else 49#else
43 bb_xdaemon(0, 1); 50 bb_xdaemon(0, 1);
44#endif 51#endif