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