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