Fix compilation on older udev versions
authorHannes Reinecke <hare@suse.de>
Thu, 19 Apr 2012 12:03:47 +0000 (14:03 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Fri, 20 Apr 2012 17:47:58 +0000 (19:47 +0200)
Older udev versions do not export 'udev_monitor_set_receive_buffer_size',
so we need to comment it out on those systems.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath/Makefile
libmultipath/uevent.c

index bacd89e..fd564cf 100644 (file)
@@ -29,6 +29,13 @@ ifneq ($(strip $(LIBDM_API_COOKIE)),0)
        CFLAGS += -DLIBDM_API_COOKIE
 endif
 
+LIBUDEV_API_RECVBUF = $(shell grep -Ecs '^[a-z]*[[:space:]]+udev_monitor_set_resolve_buffer_size' /usr/include/libudev.h)
+
+ifneq ($(strip $(LIBUDEV_API_RECVBUF)),0)
+       CFLAGS += -DLIBUDEV_API_RECVBUF
+endif
+
+
 all: $(LIBS)
 
 $(LIBS): $(OBJS)
index a29a43c..52b8aaf 100644 (file)
@@ -399,8 +399,10 @@ int uevent_listen(void)
                condlog(2, "failed to create udev monitor");
                goto out;
        }
+#ifdef LIBUDEV_API_RECVBUF
        if (udev_monitor_set_receive_buffer_size(monitor, 128 * 1024 * 1024))
                condlog(2, "failed to increase buffer size");
+#endif
        fd = udev_monitor_get_fd(monitor);
        if (fd < 0) {
                condlog(2, "failed to get monitor fd");