You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Martin Kraemer <Ma...@mch.sni.de> on 1997/11/07 10:36:17 UTC

[PATCH] Show compile time switches for server

Here's a patch which lets a user query (many of) the compile-time
switches of apache,

as in:
    > ./httpd -V
    Server base version: "Apache/1.3b3-dev"
    Server sub-version:  "PHP/FI-2.0b12"
    Server built:  Fr 07.Nov.1997, 10:24:14 MET
    Server compiled with....
     -D HTTPD_ROOT="/usr/local/apache"
     -D HAVE_SHMGET
     -D USE_MMAP_FILES           <-- hello, Dean: it works without HAVE_MMAP!
     -D USE_SYSVSEM_SERIALIZED_ACCEPT

Plus it adds the build date to the '-v' switch:
    > ./httpd -v
    Server version Apache/1.3b3-dev PHP/FI-2.0b12.
    Server built:  Fr 07.Nov.1997, 10:24:14 MET

For getting _only_ the latter (which usually can only be queried by
requesting /server-info?server) there is a second patch. The first patch
incorporates both.

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: [PATCH] Show compile time switches for server

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Fri, Nov 07, 1997 at 02:48:07AM -0800, Dean Gaudet wrote:
> Right now I say
> things like "find the section for your architecture in conf.h and see if
> it says..." blah blah.

Oh yeah I forgot to ask: It's certainly useful to include the various OS
special switches as well into the output, no? (-DSOLARIS=260 / -DLYNXOS /...)
But that would blow up the code quite a bit.

Documentation I consulted for finding settings was the PORTING file and
the perf-tuning.html paper, plus the BIG_SECURITY_HOLE thingie (are
there more like that?). If you find more #defines worthwhile of seeing
in the -V output, please tell!

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: [PATCH] Take2: Show compile time switches for server

Posted by Dean Gaudet <dg...@arctic.org>.
Yeah I guess you'll have to be defensive ... ah well.

Dean

On Sun, 9 Nov 1997, Martin Kraemer wrote:

> On Fri, Nov 07, 1997 at 04:11:57PM -0800, Dean Gaudet wrote:
> > #define X 1
> > 
> > #define S(x) S1(x)
> > #define S1(x) #x
> > 
> > char *foo = S(X);
> 
> Oh, now I see why I had a problem... I tried it in a very similar
> approach. But look at my compiler's output (the first is "almost ANSI",
> the second "ANSI"):
> 
>     > cc -E deans-mac.c | tail -2
>     char *foo = "X";
>     #line 7
> 
>    > cc -kansi -E deans-mac.c | tail -2
>     char *foo = "1";
>     #line 7
> 
> Guess some compilers are on.y "conditionally compliant". Do you think
> it's woth taking the risk and changing the function to pure ANSI? I have
> the feeling that a more defensive approach would be better. :-(
> 
>     Martin
> -- 
> | S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
> | ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
> | N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
> ~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request
> 


Re: [PATCH] Take2: Show compile time switches for server

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Fri, Nov 07, 1997 at 04:11:57PM -0800, Dean Gaudet wrote:
> #define X 1
> 
> #define S(x) S1(x)
> #define S1(x) #x
> 
> char *foo = S(X);

Oh, now I see why I had a problem... I tried it in a very similar
approach. But look at my compiler's output (the first is "almost ANSI",
the second "ANSI"):

    > cc -E deans-mac.c | tail -2
    char *foo = "X";
    #line 7

   > cc -kansi -E deans-mac.c | tail -2
    char *foo = "1";
    #line 7

Guess some compilers are on.y "conditionally compliant". Do you think
it's woth taking the risk and changing the function to pure ANSI? I have
the feeling that a more defensive approach would be better. :-(

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: [PATCH] Take2: Show compile time switches for server

Posted by Dean Gaudet <dg...@arctic.org>.
#define X 1

#define S(x) S1(x)
#define S1(x) #x

char *foo = S(X);

I thought that was an example in the standard ... interesting.  It's the
way to do it though... every level of indirection adds another layer of
expansion. 

Dean

On Fri, 7 Nov 1997, Martin Kraemer wrote:

> On Fri, Nov 07, 1997 at 02:48:07AM -0800, Dean Gaudet wrote:
> > +1 on -V, but it looks like you put NO_WRITEV inside the USE_MMAP_FILES
> > section, which is wrong ... NO_WRITEV isn't related to USE_MMAP_FILES. 
> 
> 
> Ok, moved to behind the "#ifdef USE_MMAP_FILES" block.
> 
> BTW: I was thinking of reducing the code bloat a bit by using string
> concatenation to collect all the strings into one printf() by writing...
> 
>     printf("Server compiled with....\n"
> #ifdef BIG_SECURITY_HOLE
> 	   " -D BIG_SECURITY_HOLE\n"
> #endif
> #ifdef HTTPD_ROOT
> 	   " -D HTTPD_ROOT=\"" HTTPD_ROOT "\"\n"
> #endif
> ....
> 	   "\n");
> 
> But then I'd need a (portable) ANSI-Stringizing Macro which converts
> the _value_ of the num-valued macros into a string, like...
> 
> #define NUMSTR(n)   some_#_magic_i_couldnt_find_out
> #ifdef MMAP_SEGMENT_SIZE
>        " -D MMAP_SEGMENT_SIZE=" NUMSTR(MMAP_SEGMENT_SIZE) "\n"
> #endif
> 
> Somehow I couldn't get it to work. The X3J11 standard doesn't give an
> example either. Thus still Take 2: the printf() version (corrected re
> NO_WRITEV).
> 
>     Martin
> -- 
> | S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
> | ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
> | N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
> ~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request
> 

[PATCH] Take2: Show compile time switches for server

Posted by Martin Kraemer <Ma...@mch.sni.de>.
On Fri, Nov 07, 1997 at 02:48:07AM -0800, Dean Gaudet wrote:
> +1 on -V, but it looks like you put NO_WRITEV inside the USE_MMAP_FILES
> section, which is wrong ... NO_WRITEV isn't related to USE_MMAP_FILES. 


Ok, moved to behind the "#ifdef USE_MMAP_FILES" block.

BTW: I was thinking of reducing the code bloat a bit by using string
concatenation to collect all the strings into one printf() by writing...

    printf("Server compiled with....\n"
#ifdef BIG_SECURITY_HOLE
	   " -D BIG_SECURITY_HOLE\n"
#endif
#ifdef HTTPD_ROOT
	   " -D HTTPD_ROOT=\"" HTTPD_ROOT "\"\n"
#endif
....
	   "\n");

But then I'd need a (portable) ANSI-Stringizing Macro which converts
the _value_ of the num-valued macros into a string, like...

#define NUMSTR(n)   some_#_magic_i_couldnt_find_out
#ifdef MMAP_SEGMENT_SIZE
       " -D MMAP_SEGMENT_SIZE=" NUMSTR(MMAP_SEGMENT_SIZE) "\n"
#endif

Somehow I couldn't get it to work. The X3J11 standard doesn't give an
example either. Thus still Take 2: the printf() version (corrected re
NO_WRITEV).

    Martin
-- 
| S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
| ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
| N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request

Re: [PATCH] Show compile time switches for server

Posted by Dean Gaudet <dg...@arctic.org>.
+1 on -V, but it looks like you put NO_WRITEV inside the USE_MMAP_FILES
section, which is wrong ... NO_WRITEV isn't related to USE_MMAP_FILES. 

This is a feature I've been wanting for a long time so we can ask users to
run "./httpd -V" when trying to explain things like scoreboards, and lock
files, and so on in documentation and PR responses.  Right now I say
things like "find the section for your architecture in conf.h and see if
it says..." blah blah.

Dean

On Fri, 7 Nov 1997, Martin Kraemer wrote:

> Here's a patch which lets a user query (many of) the compile-time
> switches of apache,
> 
> as in:
>     > ./httpd -V
>     Server base version: "Apache/1.3b3-dev"
>     Server sub-version:  "PHP/FI-2.0b12"
>     Server built:  Fr 07.Nov.1997, 10:24:14 MET
>     Server compiled with....
>      -D HTTPD_ROOT="/usr/local/apache"
>      -D HAVE_SHMGET
>      -D USE_MMAP_FILES           <-- hello, Dean: it works without HAVE_MMAP!
>      -D USE_SYSVSEM_SERIALIZED_ACCEPT
> 
> Plus it adds the build date to the '-v' switch:
>     > ./httpd -v
>     Server version Apache/1.3b3-dev PHP/FI-2.0b12.
>     Server built:  Fr 07.Nov.1997, 10:24:14 MET
> 
> For getting _only_ the latter (which usually can only be queried by
> requesting /server-info?server) there is a second patch. The first patch
> incorporates both.
> 
>     Martin
> -- 
> | S I E M E N S |  <Ma...@mch.sni.de>  |      Siemens Nixdorf
> | ------------- |   Voice: +49-89-636-46021     |  Informationssysteme AG
> | N I X D O R F |   FAX:   +49-89-636-44994     |   81730 Munich, Germany
> ~~~~~~~~~~~~~~~~My opinions only, of course; pgp key available on request
>