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]

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


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

Therefore, I propose we remove the inclusion of sys/sysmacros.h from
sys/types.h.  It's risky enough that I think it's worth doing a distro
rebuild with that change to find out what, if anything, breaks - who
do I talk to to make that happen?

zw


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