watchdog: Add simple built-in watchdog daemon

This patch adds a simple but effective watchdog daemon with support for
handover to an external daemon, should one register using the API.

Disabled by default, enable by:

    configure --enable-watchdog

The watchdog forks to the background, opening /dev/watchdog setting a
three second timeout, and kicking every second.  At shutdown/reboot the
daemon will receive SIGPWR from Finit to exit and cause a WDT reboot.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2016-10-24 00:06:04 +02:00
1 parent 88f9458c6e
commit b674aad802
5 files changed
+193 -2

No files matched your search

+6
View File
@@ -46,6 +46,7 @@
#include "sm.h"
#include "tty.h"
#include "utmp-api.h"
#include "watchdog.h"
int debug = 0;
int quiet = QUIET_MODE; /* Delayed disable of silent mode. */
@@ -343,6 +344,11 @@ int main(int argc, char* argv[])
*/
conf_parse_config();
/*
* Start built-in watchdog as soon as possible, if enabled
*/
watchdog(argv[0]);
/* Set hostname as soon as possible, for syslog et al. */
set_hostname(&hostname);