httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@locus.apache.org
Subject cvs commit: apache-2.0/src/support apxs.pl
Date Thu, 04 May 2000 19:42:57 GMT
rbb         00/05/04 12:42:57

  Modified:    src/main http_log.c
               src/modules/mpm/dexter dexter.c
               src/modules/mpm/mpmt_pthread mpmt_pthread.c scoreboard.c
                        scoreboard.h
               src/modules/mpm/prefork prefork.c
               src/support apxs.pl
  Log:
  Port reliable piped logs to mpmt_pthread and dexter.  Also a couple of small
  cleanups for reliable piped logs.
  
  Revision  Changes    Path
  1.46      +7 -0      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.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- http_log.c	2000/05/04 04:02:16	1.45
  +++ http_log.c	2000/05/04 19:42:54	1.46
  @@ -636,6 +636,13 @@
   
       switch (reason) {
       case APR_OC_REASON_DEATH:
  +	pl->pid = NULL;
  +	ap_unregister_other_child(pl);
  +	if (pl->program == NULL) {
  +	    /* during a restart */
  +	    break;
  +	}
  +        break;
       case APR_OC_REASON_LOST:
   	pl->pid = NULL;
   	ap_unregister_other_child(pl);
  
  
  
  1.74      +26 -16    apache-2.0/src/modules/mpm/dexter/dexter.c
  
  Index: dexter.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- dexter.c	2000/05/04 04:02:20	1.73
  +++ dexter.c	2000/05/04 19:42:55	1.74
  @@ -275,29 +275,35 @@
   #endif
   static int wait_or_timeout_counter;
   
  -static int wait_or_timeout(ap_wait_t *status)
  +static ap_proc_t *wait_or_timeout(ap_wait_t *status, ap_pool_t *p)
   {
       struct timeval tv;
  -    int ret;
  +    ap_status_t rv;
  +    ap_proc_t *ret = NULL;
   
       ++wait_or_timeout_counter;
       if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) {
  -	wait_or_timeout_counter = 0;
  +        wait_or_timeout_counter = 0;
   #ifdef APR_HAS_OTHER_CHILD
  -	probe_writable_fds();
  +        ap_probe_writable_fds();
   #endif
       }
  -    ret = waitpid(-1, status, WNOHANG);
  -    if (ret == -1 && errno == EINTR) {
  -	return -1;
  +    rv = ap_wait_all_procs(&ret, APR_NOWAIT, p);
  +    if (ap_canonical_error(rv) == APR_EINTR) {
  +        return NULL;
       }
  -    if (ret > 0) {
  -	return ret;
  +    if (rv == APR_CHILD_DONE) {
  +        return ret;
       }
  +#ifdef NEED_WAITPID
  +    if ((ret = reap_children(status)) > 0) {
  +        return ret;
  +    }
  +#endif
       tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000;
       tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000;
       ap_select(0, NULL, NULL, NULL, &tv);
  -    return -1;
  +    return NULL;
   }
   
   /* handle all varieties of core dumping signals */
  @@ -489,8 +495,10 @@
   #endif
   }
   
  -static void process_child_status(int pid, ap_wait_t status)
  +static void process_child_status(ap_proc_t *abs_pid, ap_wait_t status)
   {
  +    int pid;
  +    ap_get_os_proc(&pid, abs_pid);
       /* Child died... if it died due to a fatal error,
   	* we should simply bail out.
   	*/
  @@ -1077,19 +1085,21 @@
   {
       int child_slot;
       ap_wait_t status;
  -    int pid;
  +    ap_proc_t *pid;
       int i;
   
       while (!restart_pending && !shutdown_pending) {
  -        pid = wait_or_timeout(&status);
  +        pid = wait_or_timeout(&status, pconf);
           
  -        if (pid >= 0) {
  +        if (pid != NULL) {
  +            int actual_pid;
  +            ap_get_os_proc(&actual_pid, pid);
               process_child_status(pid, status);
               /* non-fatal death... note that it's gone in the child table and
                * clean out the status table. */
               child_slot = -1;
               for (i = 0; i < max_daemons_limit; ++i) {
  -        	if (child_table[i].pid == pid) {
  +        	if (child_table[i].pid == actual_pid) {
                       int j;
   
                       child_slot = i;
  @@ -1112,7 +1122,7 @@
   		}
   #ifdef APR_HAS_OTHER_CHILD
   	    }
  -	    else if (reap_other_child(pid, status) == 0) {
  +	    else if (ap_reap_other_child(pid, status) == 0) {
   		/* handled */
   #endif
   	    }
  
  
  
  1.68      +24 -15    apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c
  
  Index: mpmt_pthread.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- mpmt_pthread.c	2000/05/04 04:02:26	1.67
  +++ mpmt_pthread.c	2000/05/04 19:42:55	1.68
  @@ -271,29 +271,35 @@
   #endif
   static int wait_or_timeout_counter;
   
  -static int wait_or_timeout(ap_wait_t *status)
  +static ap_proc_t *wait_or_timeout(ap_wait_t *status, ap_pool_t *p)
   {
       struct timeval tv;
  -    int ret;
  +    ap_status_t rv;
  +    ap_proc_t *ret = NULL;
   
       ++wait_or_timeout_counter;
       if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) {
  -	wait_or_timeout_counter = 0;
  +        wait_or_timeout_counter = 0;
   #ifdef APR_HAS_OTHER_CHILD
  -	probe_writable_fds();
  +        ap_probe_writable_fds();
   #endif
       }
  -    ret = waitpid(-1, status, WNOHANG);
  -    if (ret == -1 && errno == EINTR) {
  -	return -1;
  +    rv = ap_wait_all_procs(&ret, APR_NOWAIT, p);
  +    if (ap_canonical_error(rv) == APR_EINTR) {
  +        return NULL;
       }
  -    if (ret > 0) {
  -	return ret;
  +    if (rv == APR_CHILD_DONE) {
  +        return ret;
       }
  +#ifdef NEED_WAITPID
  +    if ((ret = reap_children(status)) > 0) {
  +        return ret;
  +    }
  +#endif
       tv.tv_sec = SCOREBOARD_MAINTENANCE_INTERVAL / 1000000;
       tv.tv_usec = SCOREBOARD_MAINTENANCE_INTERVAL % 1000000;
       ap_select(0, NULL, NULL, NULL, &tv);
  -    return -1;
  +    return NULL;
   }
   
   /* handle all varieties of core dumping signals */
  @@ -486,8 +492,10 @@
   #endif
   }
   
  -static void process_child_status(int pid, ap_wait_t status)
  +static void process_child_status(ap_proc_t *abs_pid, ap_wait_t status)
   {
  +    int pid;
  +    ap_get_os_proc(&pid, abs_pid);
       /* Child died... if it died due to a fatal error,
   	* we should simply bail out.
   	*/
  @@ -1110,13 +1118,14 @@
   {
       int child_slot;
       ap_wait_t status;
  -    int pid;
  +    ap_proc_t *pid;
       int i;
   
       while (!restart_pending && !shutdown_pending) {
  -        pid = wait_or_timeout(&status);
  +        /* this is a memory leak, but I'll fix it later. */
  +        pid = wait_or_timeout(&status, pconf);
           
  -        if (pid >= 0) {
  +        if (pid != NULL) {
               process_child_status(pid, status);
               /* non-fatal death... note that it's gone in the scoreboard. */
               child_slot = find_child_by_pid(pid);
  @@ -1135,7 +1144,7 @@
   		}
   #ifdef APR_HAS_OTHER_CHILD
   	    }
  -	    else if (reap_other_child(pid, status) == 0) {
  +	    else if (ap_reap_other_child(pid, status) == 0) {
   		/* handled */
   #endif
   	    }
  
  
  
  1.22      +5 -2      apache-2.0/src/modules/mpm/mpmt_pthread/scoreboard.c
  
  Index: scoreboard.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/scoreboard.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- scoreboard.c	2000/04/14 15:59:02	1.21
  +++ scoreboard.c	2000/05/04 19:42:56	1.22
  @@ -201,13 +201,16 @@
   
   }
   
  -API_EXPORT(int) find_child_by_pid(int pid)
  +API_EXPORT(int) find_child_by_pid(ap_proc_t *pid)
   {
       int i;
  +    int actual_pid;
  +
       int max_daemons_limit = ap_get_max_daemons();
  +    ap_get_os_proc(&actual_pid, pid);
   
       for (i = 0; i < max_daemons_limit; ++i)
  -	if (ap_scoreboard_image->parent[i].pid == pid)
  +	if (ap_scoreboard_image->parent[i].pid == actual_pid)
   	    return i;
   
       return -1;
  
  
  
  1.14      +1 -1      apache-2.0/src/modules/mpm/mpmt_pthread/scoreboard.h
  
  Index: scoreboard.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/scoreboard.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- scoreboard.h	2000/04/15 01:09:32	1.13
  +++ scoreboard.h	2000/05/04 19:42:56	1.14
  @@ -234,7 +234,7 @@
   ap_inline void ap_sync_scoreboard_image(void);
   void increment_counts(int child_num, int thread_num, request_rec *r);
   void update_scoreboard_global(void);
  -API_EXPORT(int) find_child_by_pid(int pid);
  +API_EXPORT(int) find_child_by_pid(ap_proc_t *pid);
   int ap_update_child_status(int child_num, int thread_num, int status, request_rec *r);
   void ap_time_process_request(int child_num, int thread_num, int status);
   
  
  
  
  1.82      +2 -2      apache-2.0/src/modules/mpm/prefork/prefork.c
  
  Index: prefork.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- prefork.c	2000/05/04 04:02:29	1.81
  +++ prefork.c	2000/05/04 19:42:56	1.82
  @@ -1162,8 +1162,8 @@
   	ap_probe_writable_fds();
   #endif
       }
  -    rv = ap_wait_all_procs(&ret, WNOHANG, p);
  -    if (rv != -1 && rv == APR_CHILD_NOTDONE) {
  +    rv = ap_wait_all_procs(&ret, APR_NOWAIT, p);
  +    if (ap_canonical_error(rv) == APR_EINTR) {
   	return NULL;
       }
       if (rv == APR_CHILD_DONE) {
  
  
  
  1.6       +1 -1      apache-2.0/src/support/apxs.pl
  
  Index: apxs.pl
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/support/apxs.pl,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- apxs.pl	2000/03/31 09:42:55	1.5
  +++ apxs.pl	2000/05/04 19:42:57	1.6
  @@ -1,4 +1,4 @@
  -#!/usr/local/bin/perl
  +#!/usr/bin/perl
   # ====================================================================
   # The Apache Software License, Version 1.1
   #
  
  
  

Mime
View raw message