Re: [PATCH] AC_HEADER_MAJOR: port to glibc 2.25

Eric Blake <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 09/14/2016 10:27 AM, Zack Weinberg wrote:
> glibc's sys/sysmacros.h _only_ defines major/minor/makedev.  What I'd
> worry about is whether any other C library has a different header with
> the same name; "sysmacros" is pretty generic.  I don't have any
> evidence either way on that question.
> 

Nor do I; and I also wonder if the fact that we checked mkdev.h first
(which catches BSD systems, if I'm not mistaken) would mask the effect
of a BSD system with both mkdev.h and sysmacros.h.  A quick google found
at least one other vendor with a sysmacros.h, with a lot more contents
than glibc's:
http://opensource.apple.com//source/zfs/zfs-59/zfs_common/sys/sysmacros.h

>> @@ -5977,6 +5977,27 @@ Particular Headers
>>  @code{makedev}, but @file{sys/mkdev.h} does, define
>>  @code{MAJOR_IN_MKDEV}; otherwise, if @file{sys/sysmacros.h} does, define
>>  @code{MAJOR_IN_SYSMACROS}.
> 
> This part of the description should probably be adjusted to match what
> the code does now.
> 
>> +To properly use any of these three functions, your code should contain
>> +something like:
> 
> Also, I think "three functions" here is meant to refer to
> major/minor/makedev, but it tripped me up the first time I read it.  I
> suggest instead
> 
>    Detect the headers required to use @code{makedev}, @code{major}, and
>    @code{minor}.  These functions may be defined by @file{sys/mkdev.h},
>    @code{sys/sysmacros.h}, or @file{sys/types.h}.
> 
>    @code{AC_HEADER_MAJOR} defines @code{MAJOR_IN_MKDEV} if they are in
>    @file{sys/mkdev.h}, or @code{MAJOR_IN_SYSMACROS} if they are in
>    @file{sys/sysmacros.h.}.  If neither macro is defined, they are either
>    in @file{sys/types.h} or they are unavailable.
> 
>    To portably use these functions, your code should contain something
>    like
> 
> and then your @verbatim block.
> 

Thanks for the wordsmithing help.  I'll post a v2.

> (Should AC_HEADER_MAJOR maybe throw an error if none of the possible
> headers we know about defines major/minor/makedev?  I believe this is
> the case on MinGW, for instance.)

If so, it would be a separate patch, as a change in policy.  For now,
compilation failure on mingw when attempting to use major() is no change
in status quo.

> I think we should check sys/types.h last.  That will future-proof
> against C libraries where these functions are in both sys/mkdev.h and
> sys/types.h deciding to do the same deprecation that glibc has done.

Good idea. Will respin to check mkdev.h first (as before), then
sysmacros.h, and sys/types.h last.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 604 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJX2XLIAAoJEKeha0olJ0Nq2W0H/i73rx4JESBEkRaEuUFAcSJn
vL0ZkSW+KkwGOgUKHyOCVgOjQ3AF/cpV5LOiJD3wVqKZ2b+uy2BXpoRZEPULP3hf
X8L2jtMzVLzVEswoac43XFtCEy1FqtnIIsCBAumijSBJ2dyJ3qqkOO1OhMcaipZF
k/kKXsAdfigA388JaJoFGNH4bCiNVENZ5ZH6UgfY0TSxiEGZhC9aY0HDzRbpaEHu
6kU/z4lwWbzmhSVElmuvjVfOIyxPWi4Hvzeqkk3YvQULrInsQGTFKNjyRCzpI35E
RrlKnfR1L+pAahu/nnStKihGv/YYDl0vAAbd6D73df4K3ySh3f+6jhjbF4/WM6c=
=lkDZ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.