aboutsummaryrefslogtreecommitdiff
path: root/miscutils/watchdog.c
diff options
context:
space:
mode:
Diffstat (limited to 'miscutils/watchdog.c')
-rw-r--r--miscutils/watchdog.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index 28bd35813..7fb16b861 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -13,8 +13,7 @@
13#define OPT_FOREGROUND 0x01 13#define OPT_FOREGROUND 0x01
14#define OPT_TIMER 0x02 14#define OPT_TIMER 0x02
15 15
16static void watchdog_shutdown(int ATTRIBUTE_UNUSED sig) ATTRIBUTE_NORETURN; 16static void watchdog_shutdown(int sig ATTRIBUTE_UNUSED)
17static void watchdog_shutdown(int ATTRIBUTE_UNUSED sig)
18{ 17{
19 static const char V = 'V'; 18 static const char V = 'V';
20 19
@@ -47,14 +46,19 @@ int watchdog_main(int argc, char **argv)
47 bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv); 46 bb_daemonize_or_rexec(DAEMON_CHDIR_ROOT, argv);
48 } 47 }
49 48
50 bb_signals(0 49 bb_signals(BB_SIGS_FATAL, watchdog_shutdown);
51 + (1 << SIGHUP)
52 + (1 << SIGINT)
53 , watchdog_shutdown);
54 50
55 /* Use known fd # - avoid needing global 'int fd' */ 51 /* Use known fd # - avoid needing global 'int fd' */
56 xmove_fd(xopen(argv[argc - 1], O_WRONLY), 3); 52 xmove_fd(xopen(argv[argc - 1], O_WRONLY), 3);
57 53
54// TODO?
55// if (!(opts & OPT_TIMER)) {
56// if (ioctl(fd, WDIOC_GETTIMEOUT, &timer_duration) == 0)
57// timer_duration *= 500;
58// else
59// timer_duration = 30000;
60// }
61
58 while (1) { 62 while (1) {
59 /* 63 /*
60 * Make sure we clear the counter before sleeping, as the counter value 64 * Make sure we clear the counter before sleeping, as the counter value