Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Aug 2005 14:00:35 -0400
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Dirk GOUDERS <gouders@et.bocholt.fh-ge.de>
Cc:        hackers@freebsd.org
Subject:   Re: Include files that depend on include files
Message-ID:  <p06230930bf1fee5f39ca@[128.113.24.47]>
In-Reply-To: <200508101006.j7AA6VCB037633@musashi.et.bocholt.fh-gelsenkirchen.de>
References:  <200508101006.j7AA6VCB037633@musashi.et.bocholt.fh-gelsenkirchen.de>

next in thread | previous in thread | raw e-mail | index | archive | help
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@gilead.netel.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p06230930bf1fee5f39ca>