// iisalive.cpp #include #include #include #include // for watchdog timer #include // needed only if close() is used to close watchdog timer #include // for watchdog timer #include // for watchdog timer #include 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; }