2006-09-28 15:35:27 +08:00
|
|
|
#include <stdio.h>
|
2006-05-22 11:58:10 +08:00
|
|
|
#include <stdlib.h>
|
2006-09-28 15:35:27 +08:00
|
|
|
#include <unistd.h>
|
2006-05-22 11:58:10 +08:00
|
|
|
#include <fcntl.h>
|
|
|
|
|
2007-10-06 11:17:13 +08:00
|
|
|
int main(void)
|
|
|
|
{
|
2006-05-22 11:58:10 +08:00
|
|
|
int fd = open("/dev/watchdog", O_WRONLY);
|
2007-10-06 11:17:13 +08:00
|
|
|
int ret = 0;
|
2006-05-22 11:58:10 +08:00
|
|
|
if (fd == -1) {
|
|
|
|
perror("watchdog");
|
2007-10-06 11:17:13 +08:00
|
|
|
exit(EXIT_FAILURE);
|
2006-05-22 11:58:10 +08:00
|
|
|
}
|
|
|
|
while (1) {
|
2007-10-06 11:17:13 +08:00
|
|
|
ret = write(fd, "\0", 1);
|
|
|
|
if (ret != 1) {
|
|
|
|
ret = -1;
|
|
|
|
break;
|
|
|
|
}
|
2006-05-22 11:58:10 +08:00
|
|
|
sleep(10);
|
|
|
|
}
|
2007-10-06 11:17:13 +08:00
|
|
|
close(fd);
|
|
|
|
return ret;
|
2006-05-22 11:58:10 +08:00
|
|
|
}
|