]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - samples/watchdog/watchdog-simple.c
powerpc/rfi-flush: Always enable fallback flush on pseries
[mirror_ubuntu-artful-kernel.git] / samples / watchdog / watchdog-simple.c
CommitLineData
2db02c0f 1#include <stdio.h>
56fb9e53 2#include <stdlib.h>
2db02c0f 3#include <unistd.h>
56fb9e53
RD
4#include <fcntl.h>
5
06063e26
WC
6int main(void)
7{
56fb9e53 8 int fd = open("/dev/watchdog", O_WRONLY);
06063e26 9 int ret = 0;
56fb9e53
RD
10 if (fd == -1) {
11 perror("watchdog");
06063e26 12 exit(EXIT_FAILURE);
56fb9e53
RD
13 }
14 while (1) {
06063e26
WC
15 ret = write(fd, "\0", 1);
16 if (ret != 1) {
17 ret = -1;
18 break;
19 }
56fb9e53
RD
20 sleep(10);
21 }
06063e26
WC
22 close(fd);
23 return ret;
56fb9e53 24}