[libvirt] [PATCH] Make sure sys/types.h is included after sys/sysmacros.h

Eric Blake eblake at redhat.com
Tue Sep 6 16:04:01 UTC 2016


On 09/06/2016 08:46 AM, Michal Privoznik wrote:
> In the latest glibc, major() and minor() functions are marked as
> deprecated (glibc commit dbab6577):

Not only that, but there's a thread on the autoconf list about how to
fix AC_HEADER_MAJOR to work.  I may be releasing autoconf 2.70 in the
near future because of this glibc change, although there is still the
issue that it will only benefit programs that are configured with
new-enough autoconf with the fixed macro.  Gnulib, of course, will
backport any autoconf fix, and we'll at least pick it up via gnulib if
we update the submodule, once everything settles upstream in autoconf,
but it may be a few days before I know how best to tackle it among all
the related projects.

> 
> This still won't solve the build issue completely as AC_HEADER_MAJOR still
> reports that major() is defined by sys/types.h instead of sys/sysmacros.h.
> But once they fix it, we are good too. Or we can use the following
> workaround in configure.ac:
> 
>   +old_CFLAGS=$CFLAGS
>   +CFLAGS+=" -Werror "
>    AC_HEADER_MAJOR
>   +CFLAGS=$old_CFLAGS
> 

I don't think we need to worry about working around it in our
configure.ac; once upstream autoconf and gnulib figure out what they
want to do, we can inherit that.

> +++ b/src/conf/domain_audit.c
> @@ -24,7 +24,6 @@
>  #include <config.h>
>  
>  #include <sys/stat.h>
> -#include <sys/types.h>
>  
>  #ifdef MAJOR_IN_MKDEV
>  # include <sys/mkdev.h>
> @@ -32,6 +31,8 @@
>  # include <sys/sysmacros.h>
>  #endif
>  
> +#include <sys/types.h>
> +

For the purposes of immediate compilation, this looks correct to me, so
you have my ACK.


-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160906/56825686/attachment-0001.sig>


More information about the libvir-list mailing list