blob: ba45803a2216a88ff406aca0093c32c9d2d109eb [file] [log] [blame]
Jean Delvare2db02c02006-09-28 09:35:27 +02001#include <stdio.h>
Randy Dunlap56fb9e52006-05-21 20:58:10 -07002#include <stdlib.h>
Jean Delvare2db02c02006-09-28 09:35:27 +02003#include <unistd.h>
Randy Dunlap56fb9e52006-05-21 20:58:10 -07004#include <fcntl.h>
5
WANG Cong06063e22007-10-06 11:17:13 +08006int main(void)
7{
Randy Dunlap56fb9e52006-05-21 20:58:10 -07008 int fd = open("/dev/watchdog", O_WRONLY);
WANG Cong06063e22007-10-06 11:17:13 +08009 int ret = 0;
Randy Dunlap56fb9e52006-05-21 20:58:10 -070010 if (fd == -1) {
11 perror("watchdog");
WANG Cong06063e22007-10-06 11:17:13 +080012 exit(EXIT_FAILURE);
Randy Dunlap56fb9e52006-05-21 20:58:10 -070013 }
14 while (1) {
WANG Cong06063e22007-10-06 11:17:13 +080015 ret = write(fd, "\0", 1);
16 if (ret != 1) {
17 ret = -1;
18 break;
19 }
Randy Dunlap56fb9e52006-05-21 20:58:10 -070020 sleep(10);
21 }
WANG Cong06063e22007-10-06 11:17:13 +080022 close(fd);
23 return ret;
Randy Dunlap56fb9e52006-05-21 20:58:10 -070024}