[PATCH v2] Include sysmacros.h where needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So in glibc-2.23 sys/sysmacros.h is no longer included from sys/types.h
and we don't build because of the usage of major/minor/makedev macros.
Autoconf already has AC_HEADER_MAJOR macro that check where exactly
these functions/macros are defined, so let's use that.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
v2:
 - Don't include the file unconditionally, but rather use
   AC_HEADER_MAJOR that exists for exactly this purpose.

v1:
 - https://www.redhat.com/archives/libvir-list/2016-April/msg00851.html

 configure.ac             | 2 ++
 src/conf/domain_audit.c  | 6 ++++++
 src/lxc/lxc_controller.c | 7 +++++++
 src/lxc/lxc_driver.c     | 7 +++++++
 src/util/vircgroup.c     | 7 +++++++
 src/util/virutil.c       | 7 +++++++
 tests/vircgroupmock.c    | 7 +++++++
 7 files changed, 43 insertions(+)

diff --git a/configure.ac b/configure.ac
index b1500f60bc5d..f266484575ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -144,6 +144,8 @@ AC_TYPE_UID_T
 dnl Support building Win32 DLLs (must appear *before* AM_PROG_LIBTOOL)
 AC_LIBTOOL_WIN32_DLL

+AC_HEADER_MAJOR
+
 m4_ifndef([LT_INIT], [
   AM_PROG_LIBTOOL
 ], [
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index bd2eeb6a792d..36a3cf6ba0b4 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -26,6 +26,12 @@
 #include <sys/stat.h>
 #include <sys/types.h>

+#ifdef MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+#elif MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
+
 #include "domain_audit.h"
 #include "viraudit.h"
 #include "viruuid.h"
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 73e57e30ad48..de59775256b5 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -28,6 +28,13 @@
 #include <sys/wait.h>
 #include <sys/socket.h>
 #include <sys/types.h>
+
+#ifdef MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+#elif MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
+
 #include <sys/un.h>
 #include <sys/personality.h>
 #include <unistd.h>
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index ef488123db12..1dfbde333073 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -29,6 +29,13 @@
 #include <sys/utsname.h>
 #include <string.h>
 #include <sys/types.h>
+
+#ifdef MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+#elif MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
+
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/un.h>
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index bffd88f90a44..da5ccff35f8a 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -35,6 +35,13 @@
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+
+#ifdef MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+#elif MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
+
 #include <signal.h>
 #include <dirent.h>
 #include <unistd.h>
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 82051505d258..d80d994327cd 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -36,6 +36,13 @@
 #include <poll.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+
+#ifdef MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+#elif MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
+
 #include <sys/ioctl.h>
 #include <string.h>
 #include <termios.h>
diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c
index 756ac51679b4..cfc51e8f6373 100644
--- a/tests/vircgroupmock.c
+++ b/tests/vircgroupmock.c
@@ -29,6 +29,13 @@
 # include <unistd.h>
 # include <fcntl.h>
 # include <sys/stat.h>
+
+# ifdef MAJOR_IN_MKDEV
+#  include <sys/mkdev.h>
+# elif MAJOR_IN_SYSMACROS
+#  include <sys/sysmacros.h>
+# endif
+
 # include <stdarg.h>
 # include "testutilslxc.h"
 # include "virstring.h"
--
2.8.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]