Commit f8986a77 authored by German Leon's avatar German Leon
Browse files

No sign 2

parent 07458f59
// iisalive.cpp
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h> // for watchdog timer
#include <unistd.h> // needed only if close() is used to close watchdog timer
#include <sys/ioctl.h> // for watchdog timer
#include <linux/watchdog.h> // for watchdog timer
#include <time.h>
int main(int argc, char*argv[]) {
int fd, ret;
/* open WDT0 device (WDT0 enables itself automatically) */
fd = open("/dev/watchdog0", O_RDWR);
if (fd<0) {
fprintf(stderr, "Open watchdog device failed!\r\n");
return -1;
}
ret = ioctl(fd, WDIOC_KEEPALIVE, 0);
if (ret<0) {
fprintf(stderr, "Kick watchdog failed!\r\n");
return -1;
}
close(fd);
if (ret<0) {
fprintf(stderr, "Failed to close watchdog device.");
return -1;
}
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment