]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Use AC_HEADER_MAJOR to detect major()/minor()/makedev()
authorSergei Trofimovich <siarheit@google.com>
Sat, 21 Jan 2017 11:57:13 +0000 (11:57 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 23 Jan 2017 04:50:10 +0000 (23:50 -0500)
Before the change build failed on Gentoo as:

  bdev/lxclvm.c: In function 'lvm_detect':
  bdev/lxclvm.c:140:4: error: implicit declaration of function 'major' [-Werror=implicit-function-declaration]
    major(statbuf.st_rdev), minor(statbuf.st_rdev));
    ^~~~~
  bdev/lxclvm.c:140:28: error: implicit declaration of function 'minor' [-Werror=implicit-function-declaration]
    major(statbuf.st_rdev), minor(statbuf.st_rdev));
                            ^~~~~

glibc plans to remove <sys/sysmacros.h> from glibc's <sys/types.h>:
    https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html

Gentoo already applied glibc patch to experimental glibc-2.24
to start preparingfor the change.

Autoconf has AC_HEADER_MAJOR to find out which header defines
reqiured macros:
    https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Headers.html

This change should also increase portability across other libcs.

Bug: https://bugs.gentoo.org/604360
Signed-off-by: Sergei Trofimovich <siarheit@google.com>
configure.ac
src/lxc/bdev.c
src/lxc/conf.c
src/lxc/lxccontainer.c

index 54aaf7880e0aeb1cc9c4be1e6264f220992f3684..efcea6efbb548b6dd7ea767982787affb6141801 100644 (file)
@@ -565,6 +565,9 @@ AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include <sys/prctl.h>])
 # Check for some headers
 AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/personality.h utmpx.h sys/timerfd.h])
 
+# lookup major()/minor()/makedev()
+AC_HEADER_MAJOR
+
 # Check for some syscalls functions
 AC_CHECK_FUNCS([setns pivot_root sethostname unshare rand_r confstr faccessat])
 
index c43719d5673bb0c9f0905dc49d4d42e3575e9f09..1f1fd66a61bc53d8734221ff0c889f7d444b1094 100644 (file)
 #include "lxclock.h"
 #include "lxc-btrfs.h"
 
+/* makedev() */
+#ifdef MAJOR_IN_MKDEV
+#    include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+#    include <sys/sysmacros.h>
+#endif
+
 #ifndef BLKGETSIZE64
 #define BLKGETSIZE64 _IOR(0x12,114,size_t)
 #endif
index 45ff900068d9f0e7fae02c9b5956b3074147eb51..7055a0245187ee9bee2739c44b1c26744a28d776 100644 (file)
 #include <pwd.h>
 #include <grp.h>
 #include <time.h>
+
+/* makedev() */
+#ifdef MAJOR_IN_MKDEV
+#    include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+#    include <sys/sysmacros.h>
+#endif
+
 #ifdef HAVE_STATVFS
 #include <sys/statvfs.h>
 #endif
index c92c616fcd82da95191b77ff915b987e9309f72b..8d31f396190dda042c8d3fce08d220cff5439cc7 100644 (file)
 #include "namespace.h"
 #include "lxclock.h"
 
+/* major()/minor() */
+#ifdef MAJOR_IN_MKDEV
+#    include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+#    include <sys/sysmacros.h>
+#endif
+
 #if HAVE_IFADDRS_H
 #include <ifaddrs.h>
 #else