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