httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject cvs commit: httpd-2.0/server main.c
Date Sat, 10 Jul 2004 03:38:02 GMT
pquerna     2004/07/09 20:38:02

  Modified:    .        CHANGES
               docs/manual/programs httpd.xml
               include  http_main.h
               modules/mappers mod_so.c mod_so.h
               server   main.c
  Log:
  Add DUMP_MODULES
  
  Revision  Changes    Path
  1.1533    +5 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1532
  retrieving revision 1.1533
  diff -u -r1.1532 -r1.1533
  --- CHANGES	10 Jul 2004 02:25:55 -0000	1.1532
  +++ CHANGES	10 Jul 2004 03:38:01 -0000	1.1533
  @@ -2,6 +2,11 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) mod_so, core: Add new command line options to print all loaded
  +     modules. '-t -D DUMP_MODULES' and '-M' will show all static 
  +     and shared modules as loaded from the configuration file.
  +     [Paul Querna]
  +
     *) mod_autoindex: Add ShowForbidden to IndexOptions to list files
        that are not shown because the subrequest returned 401 or 403. 
        PR 10575.  [Paul Querna]
  
  
  
  1.11      +8 -3      httpd-2.0/docs/manual/programs/httpd.xml
  
  Index: httpd.xml
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/docs/manual/programs/httpd.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- httpd.xml	17 Apr 2004 11:18:05 -0000	1.10
  +++ httpd.xml	10 Jul 2004 03:38:02 -0000	1.11
  @@ -54,7 +54,7 @@
        [ -<strong>R</strong> <var>directory</var> ] [ -<strong>h</strong>
]
        [ -<strong>l</strong> ] [ -<strong>L</strong> ] [ -<strong>S</strong>
]
        [ -<strong>t</strong> ] [ -<strong>v</strong> ] [ -<strong>V</strong>
]
  -     [ -<strong>X</strong> ]</code></p>
  +     [ -<strong>X</strong> ] [ -<strong>M</strong> ]</code></p>
   
        <p>On <a href="../platform/windows.html">Windows systems</a>, the
        following additional arguments are available:</p>
  @@ -138,6 +138,10 @@
   <dd>Output a list of directives together with expected arguments and
   places where the directive is valid.</dd>
   
  +<dt><code>-M</code></dt>
  +
  +<dd>Dump a list of loaded Static and Shared Modules.</dd>
  +
   <dt><code>-S</code></dt>
   
   <dd>Show the settings as parsed from the config file (currently only
  @@ -149,7 +153,8 @@
   immediately exits after these syntax parsing tests with either a return code
   of 0 (Syntax OK) or return code not equal to 0 (Syntax Error).  If -D
   <var>DUMP</var>_<var>VHOSTS </var>is also set, details of the virtual
host
  -configuration will be printed.</dd>
  +configuration will be printed. If -D <var>DUMP</var>_<var>MODULES </var>
is
  +set, all loaded modules will be printed.</dd>
   
   <dt><code>-v</code></dt>
   
  
  
  
  1.31      +1 -1      httpd-2.0/include/http_main.h
  
  Index: http_main.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_main.h,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- http_main.h	9 Feb 2004 20:38:21 -0000	1.30
  +++ http_main.h	10 Jul 2004 03:38:02 -0000	1.31
  @@ -22,7 +22,7 @@
    * in apr_getopt() format.  Use this for default'ing args that the MPM
    * can safely ignore and pass on from its rewrite_args() handler.
    */
  -#define AP_SERVER_BASEARGS "C:c:D:d:E:e:f:vVlLtSh?X"
  +#define AP_SERVER_BASEARGS "C:c:D:d:E:e:f:vVlLtSMh?X"
   
   #ifdef __cplusplus
   extern "C" {
  
  
  
  1.58      +34 -0     httpd-2.0/modules/mappers/mod_so.c
  
  Index: mod_so.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_so.c,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- mod_so.c	4 Jun 2004 22:40:46 -0000	1.57
  +++ mod_so.c	10 Jul 2004 03:38:02 -0000	1.58
  @@ -347,6 +347,39 @@
       return NULL;
   }
   
  +static void ap_dump_loaded_modules(apr_pool_t* p, server_rec* s)
  +{
  +    ap_module_symbol_t *modie;
  +    ap_module_symbol_t *modi;
  +    so_server_conf *sconf;
  +    module *modp;
  +    int i;
  +    apr_file_t *out = NULL;
  +    apr_file_open_stderr(&out, p);
  +
  +    apr_file_printf(out, "Loaded Modules:\n");
  +
  +    sconf = (so_server_conf *)ap_get_module_config(s->module_config, 
  +                                                   &so_module);
  +    for (i = 0; ; i++) {
  +        modi = &ap_prelinked_module_symbols[i];
  +        if (modi->name != NULL) {
  +            apr_file_printf(out, " %s (static)\n", modi->name);
  +        }
  +        else {
  +            break;
  +        }
  +    }
  +
  +    modie = (ap_module_symbol_t *)sconf->loaded_modules->elts;
  +    for (i = 0; i < sconf->loaded_modules->nelts; i++) {
  +        modi = &modie[i];
  +        if (modi->name != NULL) {
  +            apr_file_printf(out, " %s (shared)\n", modi->name);
  +        }
  +    }
  +}
  +
   #else /* not NO_DLOPEN */
   
   static const char *load_file(cmd_parms *cmd, void *dummy, const char *filename)
  @@ -370,6 +403,7 @@
   {
   #ifndef NO_DLOPEN
       APR_REGISTER_OPTIONAL_FN(ap_find_loaded_module_symbol);
  +    APR_REGISTER_OPTIONAL_FN(ap_dump_loaded_modules);
   #endif
   }
   
  
  
  
  1.2       +2 -0      httpd-2.0/modules/mappers/mod_so.h
  
  Index: mod_so.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_so.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mod_so.h	4 Jun 2004 22:40:47 -0000	1.1
  +++ mod_so.h	10 Jul 2004 03:38:02 -0000	1.2
  @@ -22,6 +22,8 @@
   /* optional function declaration */
   APR_DECLARE_OPTIONAL_FN(module *, ap_find_loaded_module_symbol,
                           (server_rec *s, const char *modname));
  +APR_DECLARE_OPTIONAL_FN(void, ap_dump_loaded_modules,
  +                        (apr_pool_t* p, server_rec *s));
   
   #endif /* MOD_SO_H */
   
  
  
  
  1.160     +48 -25    httpd-2.0/server/main.c
  
  Index: main.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/main.c,v
  retrieving revision 1.159
  retrieving revision 1.160
  diff -u -r1.159 -r1.160
  --- main.c	29 Jun 2004 14:08:17 -0000	1.159
  +++ main.c	10 Jul 2004 03:38:02 -0000	1.160
  @@ -36,6 +36,8 @@
   #include "ap_mpm.h"
   #include "mpm_common.h"
   
  +#include "mod_so.h" /* for dumping loaded modules */
  +
   /* WARNING: Win32 binds http_main.c dynamically to the server. Please place
    *          extern functions and global data in another appropriate module.
    *
  @@ -327,75 +329,79 @@
   
   #ifdef SHARED_CORE
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -R directory      : specify an alternate location for "
  +                 "  -R directory       : specify an alternate location for "
                    "shared object files");
   #endif
   
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -D name           : define a name for use in "
  +                 "  -D name            : define a name for use in "
                    "<IfDefine name> directives");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -d directory      : specify an alternate initial "
  +                 "  -d directory       : specify an alternate initial "
                    "ServerRoot");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -f file           : specify an alternate ServerConfigFile");
  +                 "  -f file            : specify an alternate ServerConfigFile");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -C \"directive\"    : process directive before reading "
  +                 "  -C \"directive\"     : process directive before reading "
                    "config files");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -c \"directive\"    : process directive after reading "
  +                 "  -c \"directive\"     : process directive after reading "
                    "config files");
   
   #ifdef NETWARE
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -n name           : set screen name");
  +                 "  -n name            : set screen name");
   #endif
   #ifdef WIN32
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -n name           : set service name and use its "
  +                 "  -n name            : set service name and use its "
                    "ServerConfigFile");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -k start          : tell Apache to start");
  +                 "  -k start           : tell Apache to start");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -k restart        : tell running Apache to do a graceful "
  +                 "  -k restart         : tell running Apache to do a graceful "
                    "restart");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -k stop|shutdown  : tell running Apache to shutdown");
  +                 "  -k stop|shutdown   : tell running Apache to shutdown");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -k install        : install an Apache service");
  +                 "  -k install         : install an Apache service");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -k config         : change startup Options of an Apache "
  +                 "  -k config          : change startup Options of an Apache "
                    "service");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -k uninstall      : uninstall an Apache service");
  +                 "  -k uninstall       : uninstall an Apache service");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -w                : hold open the console window on error");
  +                 "  -w                 : hold open the console window on error");
   #endif
   
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -e level          : show startup errors of level "
  +                 "  -e level           : show startup errors of level "
                    "(see LogLevel)");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -E file           : log startup errors to file");
  +                 "  -E file            : log startup errors to file");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -v                : show version number");
  +                 "  -v                 : show version number");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -V                : show compile settings");
  +                 "  -V                 : show compile settings");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -h                : list available command line options "
  +                 "  -h                 : list available command line options "
                    "(this page)");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -l                : list compiled in modules");
  +                 "  -l                 : list compiled in modules");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -L                : list available configuration "
  +                 "  -L                 : list available configuration "
                    "directives");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -t -D DUMP_VHOSTS : show parsed settings (currently only "
  +                 "  -t -D DUMP_VHOSTS  : show parsed settings (currently only "
                    "vhost settings)");
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -S                : a synonym for -t -D DUMP_VHOSTS");   
  +                 "  -S                 : a synonym for -t -D DUMP_VHOSTS");   
  +    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  +                 "  -t -D DUMP_MODULES : show all loaded modules ");
  +    ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  +                 "  -M                 : a synonym for -t -D DUMP_MODULES");   
       ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  -                 "  -t                : run syntax check for config files");
  +                 "  -t                 : run syntax check for config files");
   
       destroy_and_exit_process(process, 1);
   }
  @@ -481,6 +487,9 @@
               /* Setting -D DUMP_VHOSTS is equivalent to setting -S */
               if (strcmp(optarg, "DUMP_VHOSTS") == 0)
                   configtestonly = 1;
  +            /* Setting -D DUMP_MODULES is equivalent to setting -M */
  +            if (strcmp(optarg, "DUMP_MODULES") == 0)
  +                configtestonly = 1;
               break;
   
           case 'e':
  @@ -552,6 +561,12 @@
               new = (char **)apr_array_push(ap_server_config_defines);
               *new = "DUMP_VHOSTS";
               break;
  +
  +        case 'M':
  +            configtestonly = 1;
  +            new = (char **)apr_array_push(ap_server_config_defines);
  +            *new = "DUMP_MODULES";
  +            break;
               
           case 'h':
           case '?':
  @@ -593,9 +608,17 @@
       rv = ap_process_config_tree(server_conf, ap_conftree,
                                   process->pconf, ptemp);
       if (rv == OK) {
  +        APR_OPTIONAL_FN_TYPE(ap_dump_loaded_modules) *dump_modules =
  +            APR_RETRIEVE_OPTIONAL_FN(ap_dump_loaded_modules);
  +        
           ap_fixup_virtual_hosts(pconf, server_conf);
           ap_fini_vhost_config(pconf, server_conf);
           apr_hook_sort_all();
  +
  +        if (dump_modules && ap_exists_config_define("DUMP_MODULES")) {
  +            dump_modules(pconf, server_conf);
  +        }
  +
           if (configtestonly) {
               ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, "Syntax OK");
               destroy_and_exit_process(process, 0);
  
  
  

Mime
View raw message