Include files that depend on include files
Garance A Drosihn
drosih at rpi.edu
Wed Aug 10 18:00:42 GMT 2005
At 12:06 PM +0200 8/10/05, Dirk GOUDERS wrote:
> > To get around this in user-space, we do things like create
> > /usr/include/sys/_types.h
> >
> > And then our include files include *that* file, and do not include
> > the standard <sys/types.h>. This <sys/_types.h> file, in turn, does
> > not define any of the actual symbols. Let's say that some include
> > file needs to know what typedef for 'off_t' is. The sys/_types.h
> > file defines __off_t, and then the include file which needs off_t
> > will do something like:
> >
> > #include <sys/_types.h>
> > #ifndef _OFF_T_DECLARED
> > typedef __off_t off_t;
> > #define _OFF_T_DECLARED
> > #endif
> >
> > Thus, it has only defined the one name it actually needs, instead
> > of defining all of the standard symbols in the real sys/types.h.
>
>Can you point me to a real-life example where such a mechanism is
>used? I'd like to have a closer look at it.
The above lines came from FreeBSD's /usr/include/sys/stat.h
Note that it includes <sys/_types.h> and not <sys/types.h>
There are many other examples in the FreeBSD system includes, at
least once you get to the 5.x-series of FreeBSD. I don't remember
if we were doing that in the 4.x-series.
--
Garance Alistair Drosehn = gad at gilead.netel.rpi.edu
Senior Systems Programmer or gad at freebsd.org
Rensselaer Polytechnic Institute or drosih at rpi.edu
More information about the freebsd-hackers
mailing list