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