Re: [hackers] [PATCH] [sbase] Include sysmacros.h directly rather than types.h

From: David Phillips <david_AT_sighup.nz>
Date: Mon, 2 Jul 2018 23:58:54 +1200

On Mon, Jul 02, 2018 at 01:20:42PM +0200, Quentin Rameau wrote:
> Ok, the makedev(3) manpage from the man-pages states this indeed:
>
> The BSDs expose the definitions for these macros via <sys/types.h>.
> Depending on the version, glibc also exposes definitions for these
> macros from that header file if suitable feature test macros are
> defined. However, this behavior was deprecated in glibc 2.25, and since
> glibc 2.28, <sys/types.h> no longer provides these definitions.
>
> musl still includes <sys/sysmacros.h> from <sys/types.h> so maybe we
> would only need an #ifdef __GLIBC__ thereā€¦
>
> Or a more complicated
> #ifdef __GLIBC__
> #if __GLIBC_PREREQ(2, 25)
> #include <sys/sysmacro.h>
> #endif
> #else
> #include <sys/types.h>
> #endif

To simplify things on our side, couldn't we just include
<sys/sysmacros.h> if linking against glibc, regardless of its
version?

It sounds like glibc has defined these in <sys/sysmacros.h>
for a while into the past (citation needed) and all that
is going to change is the inclusion of this file from types.h

I know it's less "correct", but it doesn't seem prone to
breakage if that assumption is correct.

Might not be worth the slight increase in clarity though, not
really sure.

Thanks,
David
Received on Mon Jul 02 2018 - 13:58:54 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 02 2018 - 14:00:26 CEST