Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 72309
b: refs/heads/master
c: 06063e2
h: refs/heads/master
i:
  72307: 9d9965c
v: v3
  • Loading branch information
WANG Cong authored and Wim Van Sebroeck committed Oct 23, 2007
1 parent 5695071 commit 738e306
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c283cf2c09ca1b7f1e7677bde384a8f92b1b7584
refs/heads/master: 06063e26bc3ab62aa7aca874c6ce9e7638673838
18 changes: 14 additions & 4 deletions trunk/Documentation/watchdog/src/watchdog-simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,25 @@
#include <unistd.h>
#include <fcntl.h>

int main(int argc, const char *argv[]) {
int main(void)
{
int fd = open("/dev/watchdog", O_WRONLY);
int ret = 0;
if (fd == -1) {
perror("watchdog");
exit(1);
exit(EXIT_FAILURE);
}
while (1) {
write(fd, "\0", 1);
fsync(fd);
ret = write(fd, "\0", 1);
if (ret != 1) {
ret = -1;
break;
}
ret = fsync(fd);
if (ret)
break;
sleep(10);
}
close(fd);
return ret;
}

0 comments on commit 738e306

Please sign in to comment.