#include <unistd.h>
#include <fcntl.h>
#include <string.h>
+#include <errno.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
}
for (;;) {
- nfds = epoll_wait(epollfd, events, MAX_EVENTS, -1); //fixme: timeout
+ nfds = epoll_wait(epollfd, events, MAX_EVENTS, 1000);
if (nfds == -1) {
+ if (errno == EINTR)
+ continue;
+
perror("epoll_pwait");
goto err;
}
+ if (nfds == 0) { // timeout
+
+ if (ioctl(watchdog_fd, WDIOC_KEEPALIVE, 0) == -1) {
+ perror("watchdog update failed");
+ }
+
+ continue;
+ }
+
int n;
for (n = 0; n < nfds; ++n) {
if (events[n].data.fd == listen_sock) {