This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: remove <sys/sysmacros.h> from <sys/types.h>


On Fri, Nov 13, 2015 at 09:21:46AM -0500, Zack Weinberg wrote:
> sys/sysmacros.h defines three macros - major, minor, makedev - that
> are likely to collide with user symbols.  That would be fine, since
> it's off by itself, but sys/types.h includes sys/sysmacros.h under
> __USE_BSD, which means anyone who defines _BSD_SOURCE or _GNU_SOURCE
> and includes sys/types.h gets the macros.  Moreover, under _GNU_SOURCE
> stdlib.h includes sys/types.h, and g++ defines _GNU_SOURCE by default
> (this is agreed to be suboptimal, but apparently libstdc++'s headers
> need it).  This all adds up to what might not technically be a
> conformance violation but sure *looks* like it from the end-user
> perspective.
> 
> At least two bug reports have been filed on this behavior:
> https://sourceware.org/bugzilla/show_bug.cgi?id=19239 and
> https://bugzilla.redhat.com/show_bug.cgi?id=130601 .
> 
> These macros are potentially relevant to anything that wants to take
> apart an st_dev value in detail, but I have not personally encountered
> a piece of software that needs them in many years.

These macros are still widely used.
See e.g. ls(1) and stat(1) from coreutils.

> Since sys/types.h
> does not provide these macros on SysV-derived systems, I would expect
> that portable software that needs them is prepared to include
> sys/sysmacros.h itself.

Portable software already uses autoconf AC_HEADER_MAJOR macro or analogs.


-- 
ldv

Attachment: pgptHDuqpV8mz.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]