You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2004/02/19 12:19:44 UTC

cvs commit: httpd-2.0/server core.c mpm_common.c

trawick     2004/02/19 03:19:44

  Modified:    .        CHANGES
               include  mpm_common.h
               server   core.c mpm_common.c
  Log:
  Add a new directive EnableExceptionHook that must be specified for
  exception hooks to be called (in addition to the build time
  requirements).
  
  The 2.1-dev feature is now more aligned with the 1.3.30-dev feature,
  in that there is a build-time requirement as well as a configuration
  requirement.
  
  Revision  Changes    Path
  1.1406    +4 -3      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1405
  retrieving revision 1.1406
  diff -u -r1.1405 -r1.1406
  --- CHANGES	18 Feb 2004 15:44:47 -0000	1.1405
  +++ CHANGES	19 Feb 2004 11:19:43 -0000	1.1406
  @@ -97,9 +97,10 @@
        directory, display the MPM name and some MPM properties.
        [Geoffrey Young <geoff apache.org>]
   
  -  *) Add fatal exception hook for use by debug modules.  The hook is only
  -     available if the --enable-exception-hook configure parm is used.
  -     [Jeff Trawick]
  +  *) Add fatal exception hook for use by diagnostic modules.  The hook
  +     is only available if the --enable-exception-hook configure parm 
  +     is used and the EnableExceptionHook directive has been set to 
  +     "on".  [Jeff Trawick]
   
     *) mod_ssl/mod_status: Re-enable support for output of SSL session
        cache information in server-status page.  [Joe Orton]
  
  
  
  1.46      +5 -0      httpd-2.0/include/mpm_common.h
  
  Index: mpm_common.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/mpm_common.h,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- mpm_common.h	9 Feb 2004 20:38:21 -0000	1.45
  +++ mpm_common.h	19 Feb 2004 11:19:43 -0000	1.46
  @@ -254,6 +254,11 @@
   extern apr_status_t ap_fatal_signal_child_setup(server_rec *s);
   #endif
   
  +#if AP_ENABLE_EXCEPTION_HOOK
  +extern const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy,
  +                                             const char *arg);
  +#endif
  +
   #ifdef __cplusplus
   }
   #endif
  
  
  
  1.261     +4 -0      httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.260
  retrieving revision 1.261
  diff -u -r1.260 -r1.261
  --- core.c	9 Feb 2004 20:40:49 -0000	1.260
  +++ core.c	19 Feb 2004 11:19:43 -0000	1.261
  @@ -3231,6 +3231,10 @@
   AP_INIT_TAKE1("MaxMemFree", ap_mpm_set_max_mem_free, NULL, RSRC_CONF,
                 "Maximum number of 1k blocks a particular childs allocator may hold."),
   #endif
  +#if AP_ENABLE_EXCEPTION_HOOK
  +AP_INIT_TAKE1("EnableExceptionHook", ap_mpm_set_exception_hook, NULL, RSRC_CONF,
  +              "Controls whether exception hook may be called after a crash"),
  +#endif
   { NULL }
   };
   
  
  
  
  1.116     +30 -1     httpd-2.0/server/mpm_common.c
  
  Index: mpm_common.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm_common.c,v
  retrieving revision 1.115
  retrieving revision 1.116
  diff -u -r1.115 -r1.116
  --- mpm_common.c	9 Feb 2004 20:40:49 -0000	1.115
  +++ mpm_common.c	19 Feb 2004 11:19:43 -0000	1.116
  @@ -879,6 +879,34 @@
   apr_pool_t *pconf;
   
   #if AP_ENABLE_EXCEPTION_HOOK
  +
  +static int exception_hook_enabled;
  +
  +const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy,
  +                                      const char *arg)
  +{
  +    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
  +    if (err != NULL) {
  +        return err;
  +    }
  +
  +    if (cmd->server->is_virtual) {
  +	return "EnableExceptionHook directive not allowed in <VirtualHost>";
  +    }
  +
  +    if (strcasecmp(arg, "on") == 0) {
  +        exception_hook_enabled = 1;
  +    }
  +    else if (strcasecmp(arg, "off") == 0) {
  +        exception_hook_enabled = 0;
  +    }
  +    else {
  +        return "parameter must be 'on' or 'off'";
  +    }
  +
  +    return NULL;
  +}
  +
   APR_HOOK_STRUCT(
       APR_HOOK_LINK(fatal_exception)
   )
  @@ -890,7 +918,8 @@
   {
       ap_exception_info_t ei = {0};
   
  -    if (geteuid() != 0 && 
  +    if (exception_hook_enabled &&
  +        geteuid() != 0 && 
           my_pid != parent_pid) {
           ei.sig = sig;
           ei.pid = my_pid;