[Pkg-libvirt-commits] [libguestfs] 24/116: build: check for UNIX_PATH_MAX, and properly define it if not

Hilko Bengen bengen at moszumanska.debian.org
Wed Nov 26 22:04:52 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag debian/1%1.29.10-1
in repository libguestfs.

commit 8c8e089ad1644a0f43586b43eb476ad6574c7c18
Author: Pino Toscano <ptoscano at redhat.com>
Date:   Mon Oct 27 10:59:43 2014 +0100

    build: check for UNIX_PATH_MAX, and properly define it if not
    
    Do a configure check to see whether UNIX_PATH_MAX is defined; if it is
    not defined, provide it with the size of sun_path in the struct
    sockaddr_un, thus with the proper size for any libc.
---
 configure.ac               | 24 ++++++++++++++++++++++++
 src/guestfs-internal-all.h |  6 ------
 2 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5de624e..dd7a70b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -328,6 +328,30 @@ AC_CHECK_FUNCS([\
     statvfs \
     sync])
 
+dnl Check for UNIX_PATH_MAX, creating a custom one if not available.
+AC_MSG_CHECKING([for UNIX_PATH_MAX])
+AC_COMPILE_IFELSE([
+  AC_LANG_PROGRAM([[
+#include <sys/un.h>
+  ]], [[
+#ifndef UNIX_PATH_MAX
+#error UNIX_PATH_MAX not defined
+#endif
+  ]])], [
+    AC_MSG_RESULT([yes])
+  ], [
+    AC_MSG_RESULT([no])
+    AC_MSG_CHECKING([for size of sockaddr_un.sun_path])
+    AC_COMPUTE_INT(unix_path_max, [sizeof (myaddr.sun_path)], [
+#include <sys/un.h>
+struct sockaddr_un myaddr;
+      ], [
+        AC_MSG_ERROR([cannot get it])
+      ])
+    AC_MSG_RESULT([$unix_path_max])
+    AC_DEFINE_UNQUOTED([UNIX_PATH_MAX], $unix_path_max, [Custom value for UNIX_PATH_MAX])
+  ])
+
 dnl tgetent, tputs and UP [sic] are all required.  They come from libtinfo
 dnl which is pulled in as a dependency of libncurses.
 old_LIBS="$LIBS"
diff --git a/src/guestfs-internal-all.h b/src/guestfs-internal-all.h
index 23c3490..84b8fd6 100644
--- a/src/guestfs-internal-all.h
+++ b/src/guestfs-internal-all.h
@@ -53,12 +53,6 @@
 #define SOCK_CLOEXEC 0
 #endif
 
-#ifdef __APPLE__
-#define UNIX_PATH_MAX 104
-#else
-#define UNIX_PATH_MAX 108
-#endif
-
 #ifndef MAX
 #define MAX(a,b) ((a)>(b)?(a):(b))
 #endif

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list