aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/watchdog/src/watchdog-simple.c
blob: 47801bc7e742dd44a650322e2e8b79bbf463adcf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
#include <stdlib.h>
#include <unistd.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);
	}
}