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

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@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

On Thu, Apr 14, 2016 at 04:14:23PM +0200, Martin Kletzander wrote:
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@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.
sys/sysmacros.h appears to be a glibc invention, so any other platforms would break frm this - eg mingw, *bsd, os-x. I think requiring sys/sysmacros.h is pretty dubious since the man page for major, minor & makedev is saying you should be using sys/types.h to get them. Finally, I think this is the kind of thing that is gnulib's role to address. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Thu, Apr 14, 2016 at 03:30:44PM +0100, Daniel P. Berrange wrote:
On Thu, Apr 14, 2016 at 04:14:23PM +0200, Martin Kletzander wrote:
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@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.
sys/sysmacros.h appears to be a glibc invention, so any other platforms would break frm this - eg mingw, *bsd, os-x.
So it could possibly also break with µClibc and os on. So it's probably the case for using AC_HEADER_MAJOR then.
I think requiring sys/sysmacros.h is pretty dubious since the man page for major, minor & makedev is saying you should be using sys/types.h to get them.
Well, it's probably just not updated. makedev.3 man page comes from kernel man pages project and not glibc.
Finally, I think this is the kind of thing that is gnulib's role to address.
I'm rather thinking that's what AC_HEADER_MAJOR is for and sensible reasons go together even only from this discussion. How would gnulib be able to handle that? By having its own sys/types.h file? I'm not that familiar with how that works.
Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

On Thu, Apr 14, 2016 at 10:08:33PM +0200, Martin Kletzander wrote:
On Thu, Apr 14, 2016 at 03:30:44PM +0100, Daniel P. Berrange wrote:
On Thu, Apr 14, 2016 at 04:14:23PM +0200, Martin Kletzander wrote:
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@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.
sys/sysmacros.h appears to be a glibc invention, so any other platforms would break frm this - eg mingw, *bsd, os-x.
So it could possibly also break with µClibc and os on. So it's probably the case for using AC_HEADER_MAJOR then.
I think requiring sys/sysmacros.h is pretty dubious since the man page for major, minor & makedev is saying you should be using sys/types.h to get them.
Well, it's probably just not updated. makedev.3 man page comes from kernel man pages project and not glibc.
Finally, I think this is the kind of thing that is gnulib's role to address.
I'm rather thinking that's what AC_HEADER_MAJOR is for and sensible reasons go together even only from this discussion. How would gnulib be able to handle that? By having its own sys/types.h file? I'm not that familiar with how that works.
I sent a v2 so you and others can see how that looks like: https://www.redhat.com/archives/libvir-list/2016-April/msg00947.html Martin
participants (2)
-
Daniel P. Berrange
-
Martin Kletzander