> > 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

Reply via email to