qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] build: include sys/sysmacros.h for major() a


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v2] build: include sys/sysmacros.h for major() and minor()
Date: Thu, 29 Dec 2016 07:48:49 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

On 12/28/2016 11:07 AM, Peter Maydell wrote:
> On 28 December 2016 at 16:10, Eric Blake <address@hidden> wrote:
>> On 12/28/2016 08:53 AM, Christopher Covington wrote:
>>> The definition of the major() and minor() macros are moving within glibc to
>>> <sys/sysmacros.h>. Include this header to avoid the following sorts of
>>> build-stopping messages:

>> Works for glibc; but <sys/sysmacros.h> is non-standard and not present
>> on some other systems, so this may fail to build elsewhere.  You'll
>> probably need a configure probe.  Autoconf also says that some platforms
>> have <sys/mkdev.h> instead of <sys/sysmacros.h> (per its AC_HEADER_MAJOR
>> macro).
> 
> Also this seems straightforwardly like a bug in glibc: it shouldn't
> be making this kind of breaking change. makedev(3) on my Linux box
> says nothing about needing sysmacros.h for these.

Here's the bug explaining the rationale behind the change:

https://sourceware.org/bugzilla/show_bug.cgi?id=19239

It IS a bug fix, but in the other direction - it is fixing namespace
pollution that was present in <sys/types.h> and breaking certain
standard-required idioms.  There HAS been warning, but system man pages
have not always been updated to track upstream development, and the plan
was that glibc 2.25 only causes a warning rather than outright failure
to compile (although with -Werror, you have to adjust right away, rather
than when the future glibc actually changes <sys/types.h> again to
completely drop the pollution).

It is CORRECT to fix any software relying on makedev() to use the
CORRECT headers for that declaration, rather than getting it for free
from <sys/types.h> pollution - the problem is that makedev() is not
portable, and therefore the spelling of the correct header is not
trivial - it requires some configure-time probing.

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]