Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 20544 invoked by uid 500); 23 Oct 2001 17:37:53 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 20344 invoked from network); 23 Oct 2001 17:37:47 -0000 Date: 23 Oct 2001 17:30:08 -0000 Message-ID: <20011023173008.13290.qmail@icarus.apache.org> From: rbb@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/threadproc/win32 proc.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N rbb 01/10/23 10:30:08 Modified: . CHANGES include mpm_common.h server mpm_common.c server/mpm/beos beos.c server/mpm/perchild perchild.c server/mpm/prefork prefork.c server/mpm/threaded threaded.c server/mpm/worker worker.c . CHANGES include apr_thread_proc.h memory/unix apr_pools.c test testproc.c testprocmutex.c testsock.c threadproc/beos proc.c threadproc/netware proc.c threadproc/os2 proc.c threadproc/unix proc.c threadproc/win32 proc.c Log: Fix the reporting for child processes that die. This removes all of the non-portable W* macros from Apache. Submitted by: Jeff Trawick and Ryan Bloom Revision Changes Path 1.402 +5 -0 httpd-2.0/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/httpd-2.0/CHANGES,v retrieving revision 1.401 retrieving revision 1.402 diff -u -r1.401 -r1.402 --- CHANGES 2001/10/23 17:13:26 1.401 +++ CHANGES 2001/10/23 17:30:06 1.402 @@ -1,4 +1,9 @@ Changes with Apache 2.0.27-dev + + *) Fix the reporting for child processes that die. This removes + all of the non-portable W* macros from Apache. + [Jeff Trawick and Ryan Bloom] + *) Win32: Track and display "Parent Server Generation:" in mod_status output. The generation will be bumped at server graceful restart, when the child process exits 1.29 +3 -2 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.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- mpm_common.h 2001/08/14 12:30:49 1.28 +++ mpm_common.h 2001/10/23 17:30:07 1.29 @@ -125,7 +125,8 @@ * @param p The pool to allocate out of */ #ifdef AP_MPM_WANT_WAIT_OR_TIMEOUT -void ap_wait_or_timeout(apr_wait_t *status, apr_proc_t *ret, apr_pool_t *p); +void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret, + apr_pool_t *p); #endif /** @@ -135,7 +136,7 @@ * @param status The status returned from ap_wait_or_timeout */ #ifdef AP_MPM_WANT_PROCESS_CHILD_STATUS -void ap_process_child_status(apr_proc_t *pid, apr_wait_t status); +void ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status); #endif #if defined(TCP_NODELAY) && !defined(MPE) && !defined(TPF) 1.70 +12 -14 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.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- mpm_common.c 2001/09/21 14:29:33 1.69 +++ mpm_common.c 2001/10/23 17:30:07 1.70 @@ -124,7 +124,7 @@ continue; proc.pid = pid; - waitret = apr_proc_wait(&proc, NULL, APR_NOWAIT); + waitret = apr_proc_wait(&proc, NULL, NULL, APR_NOWAIT); if (waitret != APR_CHILD_NOTDONE) { MPM_NOTE_CHILD_KILLED(i); continue; @@ -196,7 +196,8 @@ #endif static int wait_or_timeout_counter; -void ap_wait_or_timeout(apr_wait_t *status, apr_proc_t *ret, apr_pool_t *p) +void ap_wait_or_timeout(apr_exit_why_e *status, int *exitcode, apr_proc_t *ret, + apr_pool_t *p) { apr_status_t rv; @@ -204,7 +205,7 @@ if (wait_or_timeout_counter == INTERVAL_OF_WRITABLE_PROBES) { wait_or_timeout_counter = 0; } - rv = apr_proc_wait_all_procs(ret, status, APR_NOWAIT, p); + rv = apr_proc_wait_all_procs(ret, exitcode, status, APR_NOWAIT, p); if (APR_STATUS_IS_EINTR(rv)) { ret->pid = -1; return; @@ -213,7 +214,7 @@ return; } #ifdef NEED_WAITPID - if ((ret = reap_children(status)) > 0) { + if ((ret = reap_children(exitcode, status)) > 0) { return; } #endif @@ -224,16 +225,16 @@ #endif /* AP_MPM_WANT_WAIT_OR_TIMEOUT */ #ifdef AP_MPM_WANT_PROCESS_CHILD_STATUS -void ap_process_child_status(apr_proc_t *pid, apr_wait_t status) +void ap_process_child_status(apr_proc_t *pid, apr_exit_why_e why, int status) { - int signum = WTERMSIG(status); + int signum = status; const char *sigdesc = apr_signal_get_description(signum); /* Child died... if it died due to a fatal error, * we should simply bail out. */ - if ((WIFEXITED(status)) && - WEXITSTATUS(status) == APEXIT_CHILDFATAL) { + if ((APR_PROC_CHECK_EXIT(why)) && + (status == APEXIT_CHILDFATAL)) { ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, 0, ap_server_conf, "Child %ld returned a Fatal error..." APR_EOL_STR "Apache is exiting!", @@ -241,7 +242,7 @@ exit(APEXIT_CHILDFATAL); } - if (WIFSIGNALED(status)) { + if (APR_PROC_CHECK_SIGNALED(why)) { switch (signum) { case SIGTERM: case SIGHUP: @@ -249,8 +250,7 @@ case SIGKILL: break; default: -#ifdef WCOREDUMP - if (WCOREDUMP(status)) { + if (APR_PROC_CHECK_CORE_DUMP(why)) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, "child pid %ld exit signal %s (%d), " @@ -258,9 +258,7 @@ (long)pid->pid, sigdesc, signum, ap_coredump_dir); } - else -#endif - { + else { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf, "child pid %ld exit signal %s (%d)", 1.63 +4 -3 httpd-2.0/server/mpm/beos/beos.c Index: beos.c =================================================================== RCS file: /home/cvs/httpd-2.0/server/mpm/beos/beos.c,v retrieving revision 1.62 retrieving revision 1.63 diff -u -r1.62 -r1.63 --- beos.c 2001/09/18 22:13:58 1.62 +++ beos.c 2001/10/23 17:30:07 1.63 @@ -597,16 +597,17 @@ static void server_main_loop(int remaining_threads_to_start) { int child_slot; - apr_wait_t status; + apr_exit_why_e exitwhy; + int status; apr_proc_t pid; int i; while (!restart_pending && !shutdown_pending) { - ap_wait_or_timeout(&status, &pid, pconf); + ap_wait_or_timeout(&exitwhy, &status, &pid, pconf); if (pid.pid >= 0) { - ap_process_child_status(&pid, status); + ap_process_child_status(&pid, exitwhy, status); /* non-fatal death... note that it's gone in the scoreboard. */ child_slot = -1; for (i = 0; i < ap_max_child_assigned; ++i) { 1.80 +4 -3 httpd-2.0/server/mpm/perchild/perchild.c Index: perchild.c =================================================================== RCS file: /home/cvs/httpd-2.0/server/mpm/perchild/perchild.c,v retrieving revision 1.79 retrieving revision 1.80 diff -u -r1.79 -r1.80 --- perchild.c 2001/09/18 22:13:58 1.79 +++ perchild.c 2001/10/23 17:30:07 1.80 @@ -1091,15 +1091,16 @@ static void server_main_loop(int remaining_children_to_start) { int child_slot; - apr_wait_t status; + apr_exit_why exitwhy; + int status; apr_proc_t pid; int i; while (!restart_pending && !shutdown_pending) { - ap_wait_or_timeout(&status, &pid, pconf); + ap_wait_or_timeout(&exitwhy, &status, &pid, pconf); if (pid.pid != -1) { - ap_process_child_status(&pid, status); + ap_process_child_status(&pid, exitwhy, status); /* non-fatal death... note that it's gone in the child table and * clean out the status table. */ child_slot = -1; 1.205 +7 -5 httpd-2.0/server/mpm/prefork/prefork.c Index: prefork.c =================================================================== RCS file: /home/cvs/httpd-2.0/server/mpm/prefork/prefork.c,v retrieving revision 1.204 retrieving revision 1.205 diff -u -r1.204 -r1.205 --- prefork.c 2001/10/16 18:45:16 1.204 +++ prefork.c 2001/10/23 17:30:07 1.205 @@ -369,7 +369,7 @@ Systems without a real waitpid sometimes lose a child's exit while waiting for another. Search through the scoreboard for missing children. */ -int reap_children(apr_wait_t *status) +int reap_children(int *exitcode, apr_exit_why_e *status) { int n, pid; @@ -379,7 +379,8 @@ kill((pid = ap_scoreboard_image->parent[n].pid), 0) == -1) { ap_update_child_status(AP_CHILD_THREAD_FROM_ID(n), SERVER_DEAD, NULL); /* just mark it as having a successful exit status */ - memset(status, 0, sizeof(apr_wait_t)); + *status = APR_PROC_EXIT; + *exitcode = 0; return(pid); } } @@ -1171,18 +1172,19 @@ while (!restart_pending && !shutdown_pending) { int child_slot; - apr_wait_t status; + apr_exit_why_e exitwhy; + int status; /* this is a memory leak, but I'll fix it later. */ apr_proc_t pid; - ap_wait_or_timeout(&status, &pid, pconf); + ap_wait_or_timeout(&exitwhy, &status, &pid, pconf); /* XXX: if it takes longer than 1 second for all our children * to start up and get into IDLE state then we may spawn an * extra child */ if (pid.pid != -1) { - ap_process_child_status(&pid, status); + ap_process_child_status(&pid, exitwhy, status); /* non-fatal death... note that it's gone in the scoreboard. */ ap_sync_scoreboard_image(); child_slot = find_child_by_pid(&pid); 1.66 +4 -3 httpd-2.0/server/mpm/threaded/threaded.c Index: threaded.c =================================================================== RCS file: /home/cvs/httpd-2.0/server/mpm/threaded/threaded.c,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- threaded.c 2001/10/16 04:02:28 1.65 +++ threaded.c 2001/10/23 17:30:07 1.66 @@ -1122,15 +1122,16 @@ static void server_main_loop(int remaining_children_to_start) { int child_slot; - apr_wait_t status; + apr_exit_why_e exitwhy; + int status; apr_proc_t pid; int i; while (!restart_pending && !shutdown_pending) { - ap_wait_or_timeout(&status, &pid, pconf); + ap_wait_or_timeout(&exitwhy, &status, &pid, pconf); if (pid.pid != -1) { - ap_process_child_status(&pid, status); + ap_process_child_status(&pid, exitwhy, status); /* non-fatal death... note that it's gone in the scoreboard. */ child_slot = find_child_by_pid(&pid); if (child_slot >= 0) { 1.31 +4 -3 httpd-2.0/server/mpm/worker/worker.c Index: worker.c =================================================================== RCS file: /home/cvs/httpd-2.0/server/mpm/worker/worker.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- worker.c 2001/10/19 23:45:39 1.30 +++ worker.c 2001/10/23 17:30:07 1.31 @@ -1187,15 +1187,16 @@ static void server_main_loop(int remaining_children_to_start) { int child_slot; - apr_wait_t status; + apr_exit_why_e exitwhy; + int status; apr_proc_t pid; int i; while (!restart_pending && !shutdown_pending) { - ap_wait_or_timeout(&status, &pid, pconf); + ap_wait_or_timeout(&exitwhy, &status, &pid, pconf); if (pid.pid != -1) { - ap_process_child_status(&pid, status); + ap_process_child_status(&pid, exitwhy, status); /* non-fatal death... note that it's gone in the scoreboard. */ child_slot = find_child_by_pid(&pid); if (child_slot >= 0) { 1.175 +5 -0 apr/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apr/CHANGES,v retrieving revision 1.174 retrieving revision 1.175 diff -u -r1.174 -r1.175 --- CHANGES 2001/10/19 23:27:57 1.174 +++ CHANGES 2001/10/23 17:30:07 1.175 @@ -1,5 +1,10 @@ Changes with APR b1 + *) Re-vamp the apr_proc_wait and apr_proc_wait_all functions. We + now return the exit code from the program and a reason that the + program died, either normal exit or signalled. + [Jeff Trawick and Ryan Bloom] + *) Implement portable accessors for proc mutex. These are equivalent to apr_os_lock_get/set, but they work for apr_proc_mutex_t types instead. [Aaron Bannert] 1.76 +39 -13 apr/include/apr_thread_proc.h Index: apr_thread_proc.h =================================================================== RCS file: /home/cvs/apr/include/apr_thread_proc.h,v retrieving revision 1.75 retrieving revision 1.76 diff -u -r1.75 -r1.76 --- apr_thread_proc.h 2001/09/20 08:59:30 1.75 +++ apr_thread_proc.h 2001/10/23 17:30:08 1.76 @@ -81,6 +81,17 @@ typedef enum {APR_SHELLCMD, APR_PROGRAM} apr_cmdtype_e; typedef enum {APR_WAIT, APR_NOWAIT} apr_wait_how_e; +/* I am specifically calling out the values so that the macros below make + * more sense. Yes, I know I don't need to, but I am hoping this makes what + * I am doing more clear. If you want to add more reasons to exit, continue + * to use bitmasks. + */ +typedef enum {APR_PROC_EXIT = 1, APR_PROC_SIGNAL = 2, + APR_PROC_SIGNAL_CORE = 4} apr_exit_why_e; + +#define APR_PROC_CHECK_EXIT(x) (x & APR_PROC_EXIT) +#define APR_PROC_CHECK_SIGNALED(x) (x & APR_PROC_SIGNAL) +#define APR_PROC_CHECK_CORE_DUMP(x) (x & APR_PROC_SIGNAL_CORE) #define APR_NO_PIPE 0 #define APR_FULL_BLOCK 1 @@ -481,11 +492,17 @@ /** * Wait for a child process to die * @param proc The process handle that corresponds to the desired child process - * @param exitcode The returned exit status of the child, if a child process - * dies. On platforms that don't support obtaining this - * information, the exitcode parameter will be returned as - * APR_ENOTIMPL. This parameter may be NULL if the exit code - * is not needed. + * @param exitcode The returned exit status of the child, if a child process + * dies, or the signal that caused the child to die. + * On platforms that don't support obtaining this information, + * the status parameter will be returned as APR_ENOTIMPL. + * @param exitwhy Why the child died, the bitwise or of: + *
  + *            APR_PROC_EXIT         -- process terminated normally
  + *            APR_PROC_SIGNAL       -- process was killed by a signal
  + *            APR_PROC_SIGNAL_CORE  -- process was killed by a signal, and
  + *                                     generated a core dump.
  + * 
* @param waithow How should we wait. One of: *
    *            APR_WAIT   -- block until the child process dies.
  @@ -498,8 +515,8 @@
    *            APR_CHILD_NOTDONE  -- child is still running.
    * 
*/ -APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, - apr_wait_t *exitcode, +APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, + int *exitcode, apr_exit_why_e *exitwhy, apr_wait_how_e waithow); /** @@ -507,9 +524,17 @@ * about that child. * @param proc Pointer to NULL on entry, will be filled out with child's * information - * @param status The returned exit status of the child, if a child process dies - * On platforms that don't support obtaining this information, - * the status parameter will be returned as APR_ENOTIMPL. + * @param exitcode The returned exit status of the child, if a child process + * dies, or the signal that caused the child to die. + * On platforms that don't support obtaining this information, + * the status parameter will be returned as APR_ENOTIMPL. + * @param exitwhy Why the child died, the bitwise or of: + *
  + *            APR_PROC_EXIT         -- process terminated normally
  + *            APR_PROC_SIGNAL       -- process was killed by a signal
  + *            APR_PROC_SIGNAL_CORE  -- process was killed by a signal, and
  + *                                     generated a core dump.
  + * 
* @param waithow How should we wait. One of: *
    *            APR_WAIT   -- block until the child process dies.
  @@ -519,9 +544,10 @@
    * @param p Pool to allocate child information out of.
    */
   APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
  -                                             apr_wait_t *status,
  -                                             apr_wait_how_e waithow,
  -                                             apr_pool_t *p);
  +                                                  int *exitcode,
  +                                                  apr_exit_why_e *exitwhy,
  +                                                  apr_wait_how_e waithow,
  +                                                  apr_pool_t *p);
   
   /**
    * Detach the process from the controlling terminal.
  
  
  
  1.114     +2 -2      apr/memory/unix/apr_pools.c
  
  Index: apr_pools.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
  retrieving revision 1.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- apr_pools.c	2001/09/28 15:22:35	1.113
  +++ apr_pools.c	2001/10/23 17:30:08	1.114
  @@ -1505,7 +1505,7 @@
   #ifndef NEED_WAITPID
       /* Pick up all defunct processes */
       for (p = procs; p; p = p->next) {
  -        if (apr_proc_wait(p->pid, NULL, APR_NOWAIT) != APR_CHILD_NOTDONE) {
  +        if (apr_proc_wait(p->pid, NULL, NULL, APR_NOWAIT) != APR_CHILD_NOTDONE) {
               p->kill_how = kill_never;
           }
       }
  @@ -1550,7 +1550,7 @@
       /* Now wait for all the signaled processes to die */
       for (p = procs; p; p = p->next) {
   	if (p->kill_how != kill_never) {
  -	    (void) apr_proc_wait(p->pid, NULL, APR_WAIT);
  +	    (void) apr_proc_wait(p->pid, NULL, NULL, APR_WAIT);
   	}
       }
   #ifdef WIN32
  
  
  
  1.33      +1 -1      apr/test/testproc.c
  
  Index: testproc.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testproc.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- testproc.c	2001/09/20 09:03:24	1.32
  +++ testproc.c	2001/10/23 17:30:08	1.33
  @@ -142,7 +142,7 @@
       else printf( "Read failed.\n");
   
       TEST_NEQ("Waiting for child to die",
  -             apr_proc_wait(&newproc, NULL, APR_WAIT),
  +             apr_proc_wait(&newproc, NULL, NULL, APR_WAIT),
                APR_CHILD_DONE, "OK", "Failed")   
       STD_TEST_NEQ("Removing directory", apr_dir_remove("proctest", pool))
   
  
  
  
  1.5       +4 -4      apr/test/testprocmutex.c
  
  Index: testprocmutex.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testprocmutex.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- testprocmutex.c	2001/09/24 05:37:28	1.4
  +++ testprocmutex.c	2001/10/23 17:30:08	1.5
  @@ -126,10 +126,10 @@
       printf("OK\n");
    
       printf("%-60s", "    Waiting for processes to exit");
  -    s1 = apr_proc_wait(p1, NULL, APR_WAIT);
  -    s2 = apr_proc_wait(p2, NULL, APR_WAIT);
  -    s3 = apr_proc_wait(p3, NULL, APR_WAIT);
  -    s4 = apr_proc_wait(p4, NULL, APR_WAIT);
  +    s1 = apr_proc_wait(p1, NULL, NULL, APR_WAIT);
  +    s2 = apr_proc_wait(p2, NULL, NULL, APR_WAIT);
  +    s3 = apr_proc_wait(p3, NULL, NULL, APR_WAIT);
  +    s4 = apr_proc_wait(p4, NULL, NULL, APR_WAIT);
       printf("OK\n");
    
       if ((*x) != MAX_COUNTER) {
  
  
  
  1.24      +8 -8      apr/test/testsock.c
  
  Index: testsock.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testsock.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- testsock.c	2001/09/20 09:03:24	1.23
  +++ testsock.c	2001/10/23 17:30:08	1.24
  @@ -96,18 +96,18 @@
           exit(-1);
       }
   
  -    while ((s1 = apr_proc_wait(&proc1, NULL, APR_NOWAIT)) == APR_CHILD_NOTDONE && 
  -           (s2 = apr_proc_wait(&proc2, NULL, APR_NOWAIT)) == APR_CHILD_NOTDONE) {
  +    while ((s1 = apr_proc_wait(&proc1, NULL, NULL, APR_NOWAIT)) == APR_CHILD_NOTDONE && 
  +           (s2 = apr_proc_wait(&proc2, NULL, NULL, APR_NOWAIT)) == APR_CHILD_NOTDONE) {
           continue;
       }
   
       if (s1 == APR_SUCCESS) {
           apr_proc_kill(&proc2, SIGTERM);
  -        while (apr_proc_wait(&proc2, NULL, APR_WAIT) == APR_CHILD_NOTDONE);
  +        while (apr_proc_wait(&proc2, NULL, NULL, APR_WAIT) == APR_CHILD_NOTDONE);
       }
       else {
           apr_proc_kill(&proc1, SIGTERM);
  -        while (apr_proc_wait(&proc1, NULL, APR_WAIT) == APR_CHILD_NOTDONE);
  +        while (apr_proc_wait(&proc1, NULL, NULL, APR_WAIT) == APR_CHILD_NOTDONE);
       }
       fprintf(stdout, "Network test completed.\n");   
   
  @@ -163,18 +163,18 @@
           exit(-1);
       }
   
  -    while ((s1 = apr_proc_wait(&proc1, NULL, APR_NOWAIT)) == APR_CHILD_NOTDONE && 
  -           (s2 = apr_proc_wait(&proc2, NULL, APR_NOWAIT)) == APR_CHILD_NOTDONE) {
  +    while ((s1 = apr_proc_wait(&proc1, NULL, NULL, APR_NOWAIT)) == APR_CHILD_NOTDONE && 
  +           (s2 = apr_proc_wait(&proc2, NULL, NULL, APR_NOWAIT)) == APR_CHILD_NOTDONE) {
           continue;
       }
   
       if (s1 == APR_SUCCESS) {
           apr_proc_kill(&proc2, SIGTERM);
  -        while (apr_proc_wait(&proc2, NULL, APR_WAIT) == APR_CHILD_NOTDONE);
  +        while (apr_proc_wait(&proc2, NULL, NULL, APR_WAIT) == APR_CHILD_NOTDONE);
       }
       else {
           apr_proc_kill(&proc1, SIGTERM);
  -        while (apr_proc_wait(&proc1, NULL, APR_WAIT) == APR_CHILD_NOTDONE);
  +        while (apr_proc_wait(&proc1, NULL, NULL, APR_WAIT) == APR_CHILD_NOTDONE);
       }
       fprintf(stdout, "Network test completed.\n");   
   
  
  
  
  1.41      +6 -4      apr/threadproc/beos/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/beos/proc.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- proc.c	2001/09/20 08:59:30	1.40
  +++ proc.c	2001/10/23 17:30:08	1.41
  @@ -280,7 +280,9 @@
       return APR_SUCCESS;
   }
   
  -APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, apr_wait_t *status,
  +APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
  +                                                  int *exitcode,
  +                                                  apr_exit_why_e *exitwhy,
                                             apr_wait_how_e waithow, apr_pool_t *p)
   {
       int waitpid_options = WUNTRACED;
  @@ -298,9 +300,9 @@
       return errno;
   } 
   
  -APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, 
  -                                        apr_wait_t *exitcode,
  -                                        apr_wait_how_e wait)
  +APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
  +                                        int *exitcode, apr_exit_why_e *exitwhy,
  +                                        apr_wait_how_e waithow)
   {
       status_t rv;
   
  
  
  
  1.3       +8 -5      apr/threadproc/netware/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/netware/proc.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- proc.c	2001/09/20 08:59:30	1.2
  +++ proc.c	2001/10/23 17:30:08	1.3
  @@ -372,8 +372,11 @@
       return APR_SUCCESS;
   }
   
  -apr_status_t apr_proc_wait_all_procs(apr_proc_t *proc, apr_wait_t *status,
  -                              apr_wait_how_e waithow, apr_pool_t *p)
  +APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
  +                                                  int *exitcode,
  +                                                  apr_exit_why_e *exitwhy,
  +                                                  apr_wait_how_e waithow,
  +                                                  apr_pool_t *p)
   {
   #if 0
       int waitpid_options = WUNTRACED;
  @@ -392,9 +395,9 @@
       return errno;
   } 
   
  -apr_status_t apr_proc_wait(apr_proc_t *proc, 
  -                           apr_wait_t *exitcode,
  -                           apr_wait_how_e waithow)
  +APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
  +                                        int *exitcode, apr_exit_why_e *exitwhy,
  +                                        apr_wait_how_e waithow)
   {
   #if 0
       pid_t status;
  
  
  
  1.46      +7 -6      apr/threadproc/os2/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/os2/proc.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- proc.c	2001/09/20 08:59:30	1.45
  +++ proc.c	2001/10/23 17:30:08	1.46
  @@ -496,10 +496,11 @@
       return status;
   }
   
  -
  -
  -APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, apr_wait_t *status,
  -                                                  apr_wait_how_e waithow, apr_pool_t *p)
  +APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
  +                                                  int *exitcode,
  +                                                  apr_exit_why_e *exitwhy,
  +                                                  apr_wait_how_e waithow,
  +                                                  apr_pool_t *p)
   {
       RESULTCODES codes;
       ULONG rc;
  @@ -527,8 +528,8 @@
   
   
   APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
  -                                        apr_wait_t *exitcode,
  -                                        apr_wait_how_e wait)
  +                                        int *exitcode, apr_exit_why_e *exitwhy,
  +                                        apr_wait_how_e waithow)
   {
       RESULTCODES codes;
       ULONG rc;
  
  
  
  1.50      +29 -10    apr/threadproc/unix/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/unix/proc.c,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- proc.c	2001/09/21 16:14:50	1.49
  +++ proc.c	2001/10/23 17:30:08	1.50
  @@ -362,37 +362,56 @@
   }
   
   APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, 
  -                                                  apr_wait_t *status,
  +                                                  int *exitcode,
  +                                                  apr_exit_why_e *exitwhy,
                                                     apr_wait_how_e waithow, 
                                                     apr_pool_t *p)
   {
       proc->pid = -1;
  -    return apr_proc_wait(proc, status, waithow);
  +    return apr_proc_wait(proc, exitcode, exitwhy, waithow);
   } 
   
   APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, 
  -                                        apr_wait_t *exitcode,
  +                                        int *exitcode, apr_exit_why_e *exitwhy,
                                           apr_wait_how_e waithow)
   {
       pid_t pstatus;
       int waitpid_options = WUNTRACED;
       int exit_int;
  +    int ignore;
  +    apr_exit_why_e ignorewhy;
   
  +    if (exitcode == NULL) {
  +        exitcode = &ignore;
  +    }
  +    if (exitwhy == NULL) {
  +        exitwhy = &ignorewhy;
  +    }
  +
       if (waithow != APR_WAIT) {
           waitpid_options |= WNOHANG;
       }
       
       if ((pstatus = waitpid(proc->pid, &exit_int, waitpid_options)) > 0) {
  -        if (proc->pid == -1) {
  -            proc->pid = pstatus;
  -        }
  +        proc->pid = pstatus;
           if (WIFEXITED(exit_int)) {
  -            if (exitcode != NULL) {
  -                *exitcode = WEXITSTATUS(exit_int);
  +            *exitwhy = APR_PROC_EXIT;
  +            *exitcode = WEXITSTATUS(exit_int);
  +        }
  +        else if (WIFSIGNALED(exit_int)) {
  +            *exitwhy = APR_PROC_SIGNAL;
  +#ifdef WCOREDUMP
  +            if (WCOREDUMP(exit_int)) {
  +                *exitwhy |= APR_PROC_SIGNAL_CORE;
               }
  -            return APR_CHILD_DONE;
  +#endif
  +            *exitcode = WTERMSIG(exit_int);
  +        }
  +        else {
  +            /* unexpected condition */
  +            return APR_EGENERAL;
           }
  -        return APR_CHILD_NOTDONE;
  +        return APR_CHILD_DONE;
       }
       else if (pstatus == 0) {
           return APR_CHILD_NOTDONE;
  
  
  
  1.58      +2 -2      apr/threadproc/win32/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/win32/proc.c,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- proc.c	2001/09/20 17:21:01	1.57
  +++ proc.c	2001/10/23 17:30:08	1.58
  @@ -541,8 +541,8 @@
   }
   
   APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
  -                                        apr_wait_t *exitcode, 
  -                                        apr_wait_how_e wait)
  +                                        int *exitcode, apr_exit_why_e *exitwhy,
  +                                        apr_wait_how_e waithow)
   {
       DWORD stat;
       DWORD time;