swh:1:snp:49cd9498d6cccc5e78252c27dcb645bcf7bf0c91
Raw File
Tip revision: 60d4684068ff1eec78f55b5888d0bd2d4cca1520 authored by Linus Torvalds on 28 August 2006, 03:41:48 UTC
Linux v2.6.18-rc5
Tip revision: 60d4684
watchdog-simple.c
#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);
	}
}
back to top