apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/threadproc/win32 proc.c
Date Mon, 24 Feb 2003 23:27:15 GMT
wrowe       2003/02/24 15:27:14

  Modified:    threadproc/win32 proc.c
  Log:
    Our exit codes are ugly, this should help some of them and tell us what
    sort of exit occurred.
  
    Declare apr_proc_wait_all_procs() unimplemented, and further fix the
    code not to shut down the ->hproc which we need to recover the error
    in the otherchild logic.
  
  Revision  Changes    Path
  1.89      +28 -6     apr/threadproc/win32/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apr/threadproc/win32/proc.c,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- proc.c	7 Feb 2003 21:02:32 -0000	1.88
  +++ proc.c	24 Feb 2003 23:27:14 -0000	1.89
  @@ -692,6 +692,31 @@
       return APR_SUCCESS;
   }
   
  +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)
  +{
  +    /* Unix does apr_proc_wait(proc(-1), exitcode, exitwhy, waithow)
  +     * but Win32's apr_proc_wait won't work that way.
  +     */
  +    return APR_ENOTIMPL;
  +}
  +
  +static apr_exit_why_e why_from_exit_code(DWORD exit) {
  +    /* See WinNT.h STATUS_ACCESS_VIOLATION and family for how
  +     * this class of failures was determined
  +     */
  +    if (((exit & 0xC0000000) == 0xC0000000) 
  +                    && !(exit & 0x3FFF0000))
  +        return APR_PROC_SIGNAL;
  +    else
  +        return APR_PROC_EXIT;
  +
  +    /* ### No way to tell if Dr Watson grabbed a core, AFAICT. */
  +}
  +
   APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
                                           int *exitcode, apr_exit_why_e *exitwhy,
                                           apr_wait_how_e waithow)
  @@ -699,9 +724,6 @@
       DWORD stat;
       DWORD time;
   
  -    if (!proc)
  -        return APR_ENOPROC;
  -
       if (waithow == APR_WAIT)
           time = INFINITE;
       else
  @@ -710,9 +732,9 @@
       if ((stat = WaitForSingleObject(proc->hproc, time)) == WAIT_OBJECT_0) {
           if (GetExitCodeProcess(proc->hproc, &stat)) {
               if (exitcode)
  -                *exitcode = (apr_wait_t)stat;
  -            CloseHandle(proc->hproc);
  -            proc->hproc = NULL;
  +                *exitcode = stat;
  +            if (exitwhy)
  +                *exitwhy = why_from_exit_code(stat);
               return APR_CHILD_DONE;
           }
       }
  
  
  

Mime
View raw message