From: Sergei Trofimovich Date: Sat, 21 Jan 2017 11:57:13 +0000 (+0000) Subject: Use AC_HEADER_MAJOR to detect major()/minor()/makedev() X-Git-Tag: lxc-1.0.10~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e44a5652bcdb3da98764e1bb94399434c0dfbade;p=thirdparty%2Flxc.git Use AC_HEADER_MAJOR to detect major()/minor()/makedev() 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 from glibc's : 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 --- diff --git a/configure.ac b/configure.ac index 54aaf7880..efcea6efb 100644 --- a/configure.ac +++ b/configure.ac @@ -565,6 +565,9 @@ AC_CHECK_DECLS([PR_CAPBSET_DROP], [], [], [#include ]) # 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]) diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c index c43719d56..1f1fd66a6 100644 --- a/src/lxc/bdev.c +++ b/src/lxc/bdev.c @@ -54,6 +54,14 @@ #include "lxclock.h" #include "lxc-btrfs.h" +/* makedev() */ +#ifdef MAJOR_IN_MKDEV +# include +#endif +#ifdef MAJOR_IN_SYSMACROS +# include +#endif + #ifndef BLKGETSIZE64 #define BLKGETSIZE64 _IOR(0x12,114,size_t) #endif diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 45ff90006..7055a0245 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -36,6 +36,15 @@ #include #include #include + +/* makedev() */ +#ifdef MAJOR_IN_MKDEV +# include +#endif +#ifdef MAJOR_IN_SYSMACROS +# include +#endif + #ifdef HAVE_STATVFS #include #endif diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index c92c616fc..8d31f3961 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -56,6 +56,14 @@ #include "namespace.h" #include "lxclock.h" +/* major()/minor() */ +#ifdef MAJOR_IN_MKDEV +# include +#endif +#ifdef MAJOR_IN_SYSMACROS +# include +#endif + #if HAVE_IFADDRS_H #include #else