aboutsummaryrefslogtreecommitdiff
path: root/Documentation/watchdog/src/watchdog-simple.c
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/watchdog/src/watchdog-simple.c')
-rw-r--r--Documentation/watchdog/src/watchdog-simple.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/Documentation/watchdog/src/watchdog-simple.c b/Documentation/watchdog/src/watchdog-simple.c
new file mode 100644
index 00000000000..85cf17c4866
--- /dev/null
+++ b/Documentation/watchdog/src/watchdog-simple.c
@@ -0,0 +1,15 @@
+#include <stdlib.h>
+#include <fcntl.h>
+
+int main(int argc, const char *argv[]) {
+ int fd = open("/dev/watchdog", O_WRONLY);
+ if (fd == -1) {
+ perror("watchdog");
+ exit(1);
+ }
+ while (1) {
+ write(fd, "\0", 1);
+ fsync(fd);
+ sleep(10);
+ }
+}