You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@locus.apache.org on 2000/04/17 21:57:32 UTC

cvs commit: apache-2.0/src/main http_log.c

rbb         00/04/17 12:57:31

  Modified:    src      CHANGES
               src/lib/apr/file_io/unix filedup.c
               src/lib/apr/include apr_file_io.h
               src/lib/apr/threadproc/unix proc.c
               src/main http_log.c
  Log:
  Add a pool to dupfile.  There is no reason that when we duplicate a file,       we would want to use the same pool for the duplicated file as we used for
  the original file.  This should solve a problem we were having with
  dieing quietly on startup, because we are no longer closing stderr in the
  original process and then opening the config file as file descriptor 2.
  
  The original problem report can be found in the message
  <20...@sanguine.linuxcare.com.au>
  
  Revision  Changes    Path
  1.71      +6 -0      apache-2.0/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/CHANGES,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- CHANGES	2000/04/17 13:56:38	1.70
  +++ CHANGES	2000/04/17 19:57:27	1.71
  @@ -1,4 +1,10 @@
   Changes with Apache 2.0a3-dev
  +
  +  *) Fix the problem with dieing quietly.  dupfile now takes a pool which
  +     is used by the new apr file.  There is no reason to create a new file
  +     with the same lifetime as the original file.
  +     [Ryan Bloom] 
  +
     *) Win32: Attempt to eliminate dll relocation at start-up by specifying
        module base addresses. This will help shooting seg faults
        in the field. [William Rowe <wr...@lnd.com>]
  
  
  
  1.20      +5 -6      apache-2.0/src/lib/apr/file_io/unix/filedup.c
  
  Index: filedup.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/filedup.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- filedup.c	2000/04/15 14:08:53	1.19
  +++ filedup.c	2000/04/17 19:57:27	1.20
  @@ -55,7 +55,7 @@
   #include "fileio.h"
   #include "apr_portable.h"
   
  -ap_status_t ap_dupfile(ap_file_t **new_file, ap_file_t *old_file)
  +ap_status_t ap_dupfile(ap_file_t **new_file, ap_file_t *old_file, ap_pool_t *p)
   {
       int have_file = 0;
   
  @@ -63,8 +63,7 @@
           return APR_EBADARG;
   
       if ((*new_file) == NULL) {
  -        (*new_file) = (ap_file_t *)ap_pcalloc(old_file->cntxt,
  -                                   sizeof(ap_file_t));
  +        (*new_file) = (ap_file_t *)ap_pcalloc(p, sizeof(ap_file_t));
           if ((*new_file) == NULL) {
               return APR_ENOMEM;
           }
  @@ -72,7 +71,7 @@
           have_file = 1;
       }
       
  -    (*new_file)->cntxt = old_file->cntxt; 
  +    (*new_file)->cntxt = p; 
       if (have_file) {
           dup2(old_file->filedes, (*new_file)->filedes);
       }
  @@ -81,9 +80,9 @@
       }
   #if APR_HAS_THREADS
       ap_create_lock(&((*new_file)->thlock), APR_MUTEX, APR_INTRAPROCESS, NULL, 
  -                   old_file->cntxt);
  +                   p);
   #endif
  -    (*new_file)->fname = ap_pstrdup(old_file->cntxt, old_file->fname);
  +    (*new_file)->fname = ap_pstrdup(p, old_file->fname);
       (*new_file)->buffered = old_file->buffered;
       ap_register_cleanup((*new_file)->cntxt, (void *)(*new_file), ap_unix_file_cleanup,
                           ap_null_cleanup);
  
  
  
  1.45      +3 -2      apache-2.0/src/lib/apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_file_io.h,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- apr_file_io.h	2000/04/16 04:46:53	1.44
  +++ apr_file_io.h	2000/04/17 19:57:28	1.45
  @@ -384,18 +384,19 @@
   
   /*
   
  -=head1 ap_status_t ap_dupfile(ap_file_t **new_file, ap_file_t *old_file)
  +=head1 ap_status_t ap_dupfile(ap_file_t **new_file, ap_file_t *old_file, ap_pool_t *p)
   
   B<duplicate the specified file descriptor.>
   
       arg 1) The structure to duplicate into. 
       arg 2) The file to duplicate.
  +    arg 3) The pool to use for the new file.
   
   B<NOTE>: *arg1 must point to a valid ap_file_t, or point to NULL
   
   =cut
    */         
  -ap_status_t ap_dupfile(ap_file_t **new_file, ap_file_t *old_file);
  +ap_status_t ap_dupfile(ap_file_t **new_file, ap_file_t *old_file, ap_pool_t *p);
   
   /*
   
  
  
  
  1.23      +6 -6      apache-2.0/src/lib/apr/threadproc/unix/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/unix/proc.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- proc.c	2000/04/14 15:58:50	1.22
  +++ proc.c	2000/04/17 19:57:29	1.23
  @@ -136,10 +136,10 @@
           ap_create_pipe(&attr->child_in, &attr->parent_in, attr->cntxt);
   
       if (child_in != NULL)
  -        ap_dupfile(&attr->child_in, child_in);
  +        ap_dupfile(&attr->child_in, child_in, attr->cntxt);
   
       if (parent_in != NULL)
  -        ap_dupfile(&attr->parent_in, parent_in);
  +        ap_dupfile(&attr->parent_in, parent_in, attr->cntxt);
   
       return APR_SUCCESS;
   }
  @@ -152,10 +152,10 @@
           ap_create_pipe(&attr->child_out, &attr->parent_out, attr->cntxt);
   
       if (child_out != NULL)
  -        ap_dupfile(&attr->child_out, child_out);
  +        ap_dupfile(&attr->child_out, child_out, attr->cntxt);
   
       if (parent_out != NULL)
  -        ap_dupfile(&attr->parent_out, parent_out);
  +        ap_dupfile(&attr->parent_out, parent_out, attr->cntxt);
   
       return APR_SUCCESS;
   }
  @@ -168,10 +168,10 @@
           ap_create_pipe(&attr->child_err, &attr->parent_err, attr->cntxt);
   
       if (child_err != NULL)
  -        ap_dupfile(&attr->child_err, child_err);
  +        ap_dupfile(&attr->child_err, child_err, attr->cntxt);
   
       if (parent_err != NULL)
  -        ap_dupfile(&attr->parent_err, parent_err);
  +        ap_dupfile(&attr->parent_err, parent_err, attr->cntxt);
   
       return APR_SUCCESS;
   }
  
  
  
  1.40      +2 -2      apache-2.0/src/main/http_log.c
  
  Index: http_log.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- http_log.c	2000/04/14 15:58:55	1.39
  +++ http_log.c	2000/04/17 19:57:30	1.40
  @@ -269,7 +269,7 @@
           /* replace stderr with this new log */
           ap_flush(s_main->error_log);
           ap_open_stderr(&errfile, p);        
  -        if ((rc = ap_dupfile(&errfile, s_main->error_log)) != APR_SUCCESS) {
  +        if ((rc = ap_dupfile(&errfile, s_main->error_log, NULL)) != APR_SUCCESS) {
               ap_log_error(APLOG_MARK, APLOG_CRIT, rc, s_main,
                            "unable to replace stderr with error_log");
           } else {
  @@ -306,7 +306,7 @@
   
       ap_open_stderr(&errfile, s->process->pool);        
       if (s->error_log != NULL) {
  -        ap_dupfile(&(s->error_log), errfile);
  +        ap_dupfile(&(s->error_log), errfile, s->process->pool);
       }
   }