Bug 2915 - sys/sysmacros.h included in sys/types.h - namespace pollution
sys/sysmacros.h included in sys/types.h - namespace pollution
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
6.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Cristian Gafton
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-05-18 15:09 EDT by vgough
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-07-08 22:14:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description vgough 1999-05-18 15:09:11 EDT
sys/types.h includes sys/sysmacros.h which then defines
major() and minor() macros.  Those macros make it impossible
to use variables or functions calls major or minor almost
everywhere because sys/types.h gets included in all sorts
of files and propogates around.

Other systems that I use (like Irix) also have
sys/sysmacros.h which define the same things, but they
do not include it in types.h.

This namespace pollution causes breakage in third party
libraries such at MTL (Math Template Library) that use
those names for internal variables and have nothing to do
with system devices or major/minor numbers.

This isn't a RedHat problem (other then that it first
appears in 6.0), but it's a glibc2.1 problem and I don't
know where to report these kinds of things for glibc2.1.

regards,
Val
Comment 1 Derek Tattersall 1999-05-19 11:04:59 EDT
sysmacros.h is only included by types.h if __USE_BSD is defined.  Are
you explicitly defineing BSD compatability?
Comment 2 vgough 1999-05-24 17:53:59 EDT
USE_BSD gets defined in features.h when BSD_SOURCE is defined - which
is defined when GNU_SOURCE is defined.  I can't figure out where/how
GNU_SOURCE is being defined for my app...
Comment 3 Cristian Gafton 1999-07-08 22:14:59 EDT
You can include the features.h header as the first header, then
#undefine __USE_BSD and include the rest of teh headers.

The normal thing to do will be to test #ifdef major before using it
though. Those are standard BSD defines, so any library stepping on
that territory will be badly broken at least on BSD.

Anyway, there isn't much we can do to take care of this problem, so I
am closing the bug.

Note You need to log in before you can comment on or make changes to this bug.