[libvirt] [PATCH] Include sysmacros.h where needed

Martin Kletzander mkletzan at redhat.com
Thu Apr 14 14:14:23 UTC 2016


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.
Simply add sys/sysmacros.h into files that are using any of these
macros.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
I noticed this after update to glibc-2.23 and don't worry, there are
more project that fail compiling due to the same issue.

I can't find it in their repository, but I think it's safe to assume
that stuff will break sooner or later if we don't fix it.  The closest
thing I've found is this thread:

  https://marc.info/?l=glibc-alpha&m=144790641508520

>From that mailing list thread (actually just one mesage I've found out,
I haven't read the whole thread) there should've been some deprecation
warning for few releases, but apparently there isn't.

Technically it's a build-breaker fix, but I'm sending it for review in
case there is a system that does not have sys/sysmacros.h installed
for some reason.  Then we'd have to resort to using AC_HEADER_MAJOR.

 src/conf/domain_audit.c  | 1 +
 src/lxc/lxc_controller.c | 1 +
 src/lxc/lxc_driver.c     | 1 +
 src/util/vircgroup.c     | 1 +
 src/util/virutil.c       | 1 +
 tests/vircgroupmock.c    | 1 +
 6 files changed, 6 insertions(+)

diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index bd2eeb6a792d..541cf27e44f7 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -25,6 +25,7 @@

 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/sysmacros.h>

 #include "domain_audit.h"
 #include "viraudit.h"
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 8b5ec4c840c6..43fc2479b5f0 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -28,6 +28,7 @@
 #include <sys/wait.h>
 #include <sys/socket.h>
 #include <sys/types.h>
+#include <sys/sysmacros.h>
 #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..5ce3ceccc601 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -29,6 +29,7 @@
 #include <sys/utsname.h>
 #include <string.h>
 #include <sys/types.h>
+#include <sys/sysmacros.h>
 #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..5258526bf77a 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -35,6 +35,7 @@
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/sysmacros.h>
 #include <signal.h>
 #include <dirent.h>
 #include <unistd.h>
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 82051505d258..730a24fcb0fe 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -36,6 +36,7 @@
 #include <poll.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/sysmacros.h>
 #include <sys/ioctl.h>
 #include <string.h>
 #include <termios.h>
diff --git a/tests/vircgroupmock.c b/tests/vircgroupmock.c
index 756ac51679b4..2ca02f360556 100644
--- a/tests/vircgroupmock.c
+++ b/tests/vircgroupmock.c
@@ -29,6 +29,7 @@
 # include <unistd.h>
 # include <fcntl.h>
 # include <sys/stat.h>
+# include <sys/sysmacros.h>
 # include <stdarg.h>
 # include "testutilslxc.h"
 # include "virstring.h"
--
2.8.1




More information about the libvir-list mailing list