]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
fixup watchdog to cleanly compile with systemd
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 9 Mar 2015 08:58:16 +0000 (09:58 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 9 Mar 2015 08:58:56 +0000 (09:58 +0100)
Makefile
watchdog-mux.c

index 82af856abc23a4deff01358165f5c38a7f4f2625..db5605f727c14e502a4f1ca5834939db05b4f835 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -39,6 +39,9 @@ pve-ha-crm.1.pod: pve-ha-crm
 pve-ha-lrm.1.pod: pve-ha-lrm
        perl -I. ./pve-ha-lrm printmanpod >$@
 
+watchdog-mux: watchdog-mux.c
+       gcc watchdog-mux.c -o watchdog-mux -Wall $$(pkg-config --libs --cflags libsystemd-daemon)
+
 .PHONY: install
 install: pve-ha-crm pve-ha-lrm pve-ha-crm.1.pod pve-ha-crm.1.gz pve-ha-lrm.1.pod pve-ha-lrm.1.gz
        install -d ${DESTDIR}${SBINDIR}
index 1f83368eb4e20ab85979630228d670abcac7a32a..c2cdda4de0bc046b7dc2698926fd06f4d8cda745 100644 (file)
@@ -4,7 +4,8 @@
 #include <fcntl.h>
 #include <string.h>
 #include <sys/ioctl.h>
-#include <sys/types.h> 
+#include <sys/types.h>
+#include <sys/stat.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/epoll.h>
@@ -12,7 +13,7 @@
 #include <linux/types.h>
 #include <linux/watchdog.h>
 
-#include "sd-daemon.h"
+#include <systemd/sd-daemon.h>
 
 #define MY_SOCK_PATH "/var/run/pve_watchdog"
 #define LISTEN_BACKLOG 50
@@ -41,11 +42,10 @@ watchdog_close(void)
 int 
 main(void)
 {
-
     struct sockaddr_un my_addr, peer_addr;
     socklen_t peer_addr_size;
     struct epoll_event ev, events[MAX_EVENTS];
-    int socket_count, listen_sock, conn_sock, nfds, epollfd;
+    int socket_count, listen_sock, nfds, epollfd;
 
     struct stat fs;
     if (stat(WATCHDOG_DEV, &fs) == -1) {
@@ -160,7 +160,7 @@ main(void)
                     perror("read");
                     goto err; // fixme                   
                 } else if (bytes > 0) {
-                    printf("GOT %d bytes\n", bytes);
+                    printf("GOT %zd bytes\n", bytes);
                 } else {
                     if (events[n].events & EPOLLHUP || events[n].events & EPOLLERR) {
                         printf("GOT %016x event\n", events[n].events);
@@ -180,7 +180,7 @@ main(void)
 
     printf("DONE\n");
 
-out:
+// out:
 
     watchdog_close();
     unlink(MY_SOCK_PATH);