You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by gr...@apache.org on 2003/03/06 22:48:59 UTC

cvs commit: httpd-2.0/server mpm_common.c

gregames    2003/03/06 13:48:59

  Modified:    .        CHANGES configure.in
               docs/manual/mod mpm_common.xml
               include  mpm_common.h
               os/unix  unixd.c
               server   mpm_common.c
  Log:
  Linux 2.4+: enable coredumps when Apache is started as root if
              CoreDumpDirectory is explicitly coded
  
  Revision  Changes    Path
  1.1107    +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1106
  retrieving revision 1.1107
  diff -u -r1.1106 -r1.1107
  --- CHANGES	6 Mar 2003 16:30:34 -0000	1.1106
  +++ CHANGES	6 Mar 2003 21:48:57 -0000	1.1107
  @@ -2,6 +2,9 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) Linux 2.4+: enable coredumps when Apache is started as root
  +     if CoreDumpDir is configured [Greg Ames]
  +
     *) you can now specify the compression level for mod_deflate. 
        [Ian Holsman, Stephen Pierzchala <st...@pierzchala.com>, 
        Michael Schroepl <Mi...@telekurs.de>]
  
  
  
  1.245     +2 -0      httpd-2.0/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/configure.in,v
  retrieving revision 1.244
  retrieving revision 1.245
  diff -u -r1.244 -r1.245
  --- configure.in	17 Feb 2003 02:32:20 -0000	1.244
  +++ configure.in	6 Mar 2003 21:48:58 -0000	1.245
  @@ -268,6 +268,7 @@
   pwd.h \
   grp.h \
   strings.h \
  +sys/prctl.h \
   sys/processor.h \
   sys/sem.h
   )
  @@ -289,6 +290,7 @@
   getgrnam \
   initgroups \
   bindprocessor \
  +prctl \
   timegm \
   )
   
  
  
  
  1.23      +2 -0      httpd-2.0/docs/manual/mod/mpm_common.xml
  
  Index: mpm_common.xml
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/docs/manual/mod/mpm_common.xml,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- mpm_common.xml	22 Dec 2002 22:31:24 -0000	1.22
  +++ mpm_common.xml	6 Mar 2003 21:48:58 -0000	1.23
  @@ -110,6 +110,8 @@
       as, core dumps won't normally get written. If you want a core
       dump for debugging, you can use this directive to place it in a
       different location.</p>
  +    <p>Linux 2.4 and beyond: If you start Apache as root and you
  +    explicitly code CoreDumpDirectory, Apache enables core dumps.</p>
   </usage>
   </directivesynopsis>
   
  
  
  
  1.41      +1 -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.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- mpm_common.h	3 Feb 2003 17:52:54 -0000	1.40
  +++ mpm_common.h	6 Mar 2003 21:48:58 -0000	1.41
  @@ -276,6 +276,7 @@
    */
   #ifdef AP_MPM_WANT_SET_COREDUMPDIR
   extern char ap_coredump_dir[MAX_STRING_LEN];
  +extern int ap_coredumpdir_configured;
   const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
                                      const char *arg);
   #endif
  
  
  
  1.57      +15 -0     httpd-2.0/os/unix/unixd.c
  
  Index: unixd.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/os/unix/unixd.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- unixd.c	3 Feb 2003 17:53:17 -0000	1.56
  +++ unixd.c	6 Mar 2003 21:48:58 -0000	1.57
  @@ -89,6 +89,9 @@
   #ifdef HAVE_SYS_SEM_H
   #include <sys/sem.h>
   #endif
  +#ifdef HAVE_SYS_PRCTL_H
  +#include <sys/prctl.h>
  +#endif
   
   unixd_config_rec unixd_config;
   
  @@ -181,6 +184,18 @@
                       (long) unixd_config.user_id);
   	return -1;
       }
  +#if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) 
  +    /* this applies to Linux 2.4+ */
  +#ifdef AP_MPM_WANT_SET_COREDUMPDIR
  +    if (ap_coredumpdir_configured) {
  +        if (prctl(PR_SET_DUMPABLE, 1)) {
  +            ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL,
  +                         "set dumpable failed - this child will not coredump"
  +                         " after software errors");
  +        }
  +    }
  +#endif
  +#endif
   #endif
       return 0;
   }
  
  
  
  1.104     +2 -0      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.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- mpm_common.c	3 Feb 2003 17:53:19 -0000	1.103
  +++ mpm_common.c	6 Mar 2003 21:48:58 -0000	1.104
  @@ -630,6 +630,7 @@
   
   #ifdef AP_MPM_WANT_SET_COREDUMPDIR
   char ap_coredump_dir[MAX_STRING_LEN];
  +int ap_coredumpdir_configured;
   
   const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
                                      const char *arg)
  @@ -656,6 +657,7 @@
                              " is not a directory", NULL);
       }
       apr_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir));
  +    ap_coredumpdir_configured = 1;
       return NULL;
   }
   #endif