]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
update watchdog timer each second
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 9 Mar 2015 15:20:20 +0000 (16:20 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 9 Mar 2015 15:20:20 +0000 (16:20 +0100)
src/watchdog-mux.c

index 142474afa4751be71fcab9b0c595df74b8a59190..9eb10a152c7cb79db416b87fe7a61c112493be3a 100644 (file)
@@ -3,6 +3,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <string.h>
+#include <errno.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -126,12 +127,24 @@ main(void)
     }
 
     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) {