httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <>
Subject Re: cvs commit: apache-2.0 STATUS
Date Sun, 11 Jun 2000 06:34:37 GMT
On Sun, Jun 11, 2000 at 01:20:25AM -0500, William A. Rowe, Jr. wrote:
> > Wow. There is a ton of crap in there. For example, if HAVE_SYS_RESOURCE_H is
> > defined, then it just includes the header. Why? 
> > Whothehellknows. It just does.
> > 
> > Feh... all that should disappear. The modules that need a header should
> > include it themselves. ap_config.h (and httpd.h in turn) should not be an
> > "include the world" header.
> Agreed here too... ap_config.h should be the root of all apache sources,
> defining (but not including) what we aught to be doing.  So I included
> ap_config from those headers under the (mistaken) belief that ap_config
> represents the cornerstone of apache sources, not (as it turns out) the 
> ultimate bag of tricks and traps.
> likewise, httpd.h should tell us what and how we go about compiling a server,
> but not doing it all itself :-)  It (by default) is based on how we compile
> our sources (ap_config) and aught to include that, but not the rest of all
> headers we ever invent.
> Would you like to suggest the rules of engagement, Greg, for how and why
> headers are included, and what aught to include what else?

A header file, FOO.H, should only include other headers when those headers
define a TYPE that is needed by FOO [for successful compilation]. In many
cases, it is also convenient to include another header, BAR.H, when FOO
builds upon BAR and a client is going to need some macros defined in BAR.

For example, let's say you have a structure that uses off_t. Well, the
header defining that structure (FOO) should include the header which defines
off_t (typically sys/types.h). That allows somebody who includes FOO to
successfully compile.

For the second case, let's say you have a layer over the "seek" concept.
Your clients are going to need SEEK_END to operate your layer. Your header
should probably include fcntl.h to assist the clients.
(of course, SEEK_END is also defined in stdio.h and unistd.h just to confuse

By these "rules", ap_config.h has no business include sys/resource.h --
there is nothing in there that the ap_config.h header relies on. ap_config.h
is including *merely* for the convenience of people who include ap_config
(so they can minimize the number of files include from that source file).

And yes, you may note that APR has files such as "networkio.h" that do not
follow the pattern that I suggest above. I haven't raised a stink about it
because that would be unfair on others, unless I had my own time to go and
make the corrections myself. [assuming consensus agreed to alter the general


Greg Stein,

View raw message