]> git.proxmox.com Git - mirror_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)
committerSergei Trofimovich <siarheit@google.com>
Sat, 21 Jan 2017 11:57:13 +0000 (11:57 +0000)
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/lxclvm.c
src/lxc/conf.c
src/lxc/lxccontainer.c

index 46791ddc2e3f2325f32e7d1627608e56f67a480a..9ebcd25c5368c6838b882de478cac48e13a19214 100644 (file)
@@ -640,6 +640,9 @@ AC_CHECK_DECLS([PR_GET_NO_NEW_PRIVS], [], [], [#include <sys/prctl.h>])
 # Check for some headers
 AC_CHECK_HEADERS([sys/signalfd.h pty.h ifaddrs.h sys/capability.h sys/memfd.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 gettid memfd_create])
 
index db0e21cf6ff22b34499dd082cdc67dc7fa526165..75de17f61ad87296a5c9e4caec9c18fa70d5a418 100644 (file)
 #include <sys/wait.h>
 
 #include "bdev.h"
+#include "config.h"
 #include "log.h"
 #include "lxclvm.h"
 #include "utils.h"
 
+/* major()/minor() */
+#ifdef MAJOR_IN_MKDEV
+#    include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+#    include <sys/sysmacros.h>
+#endif
+
 lxc_log_define(lxclvm, lxc);
 
 extern char *dir_new_path(char *src, const char *oldname, const char *name,
index b346219957a6e19417ac2cf1ee587a89bb88421b..53f88b4ba31a2e390da6fa09337b4f7461d9c1ff 100644 (file)
 #include <sys/utsname.h>
 #include <sys/wait.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 2a376eb3c2aa212c4f17cdc09b60fe65e2cc08c0..0dbbf2c113d31bcbed4c70e4e38902b1505069bd 100644 (file)
 #include "utils.h"
 #include "version.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