Include files that depend on include files

Dirk GOUDERS gouders at et.bocholt.fh-ge.de
Wed Aug 10 10:06:36 GMT 2005


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

Dirk


More information about the freebsd-hackers mailing list