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

From: Quentin Rameau <quinq_AT_fifth.space>
Date: Mon, 2 Jul 2018 13:20:42 +0200

> > On glibc, major, minor, and makedev are all defined in
> > sys/sysmacros.h with types.h only including this for historical
> > reasons. A future release of glibc will remove this behaviour,
> > meaning that major, minor, and makedev will no longer be defined
> > for us without including sysmacros.h.
>
> Could you link to the source of that information?

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
Received on Mon Jul 02 2018 - 13:20:42 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 02 2018 - 13:24:25 CEST