bjh         00/01/09 22:21:13

  Modified:    src/lib/apr/threadproc/os2 proc.c
  Log:
  OS/2: Use native API for process waits.
  
  Revision  Changes    Path
  1.13      +13 -18    apache-2.0/src/lib/apr/threadproc/os2/proc.c
  
  Index: proc.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/os2/proc.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- proc.c    1999/12/31 04:15:12     1.12
  +++ proc.c    2000/01/10 06:21:12     1.13
  @@ -53,9 +53,11 @@
    *
    */
   
  +#define INCL_DOS
  +#define INCL_DOSERRORS
  +
   #include "threadproc.h"
   #include "fileio.h"
  -
   #include "apr_config.h"
   #include "apr_thread_proc.h"
   #include "apr_file_io.h"
  @@ -68,7 +70,6 @@
   #include <unistd.h>
   #include <process.h>
   #include <stdlib.h>
  -#define INCL_DOS
   #include <os2.h>
   
   ap_status_t ap_createprocattr_init(struct procattr_t **new, ap_context_t 
*cont)
  @@ -371,8 +372,8 @@
       } else
           env_block = NULL;
   
  -    status = DosExecPgm(error_object, sizeof(error_object), 
  -                        attr->detached ? EXEC_BACKGROUND : EXEC_ASYNC, 
  +    status = DosExecPgm(error_object, sizeof(error_object),
  +                        attr->detached ? EXEC_BACKGROUND : EXEC_ASYNCRESULT,
                           cmdline, env_block, &rescodes, cmdline);
   
       (*new)->pid = rescodes.codeTerminate;
  @@ -433,7 +434,9 @@
   ap_status_t ap_wait_proc(struct proc_t *proc, 
                              ap_wait_how_e wait)
   {
  -    pid_t stat;
  +    RESULTCODES codes;
  +    ULONG rc;
  +    PID pid;
   
       if (!proc)
           return APR_ENOPROC;
  @@ -441,24 +444,16 @@
       if (!proc->running)
           return APR_CHILD_DONE;
   
  -    if (wait == APR_WAIT) {
  -        if ((stat = waitpid(proc->pid, NULL, WUNTRACED)) > 0) {
  -            proc->running = FALSE;
  -            return APR_CHILD_DONE;
  -        } else if (stat == 0) {
  -            return APR_CHILD_NOTDONE;
  -        }
  -        return errno;
  -    }
  +    rc = DosWaitChild(DCWA_PROCESS, wait == APR_WAIT ? DCWW_WAIT : 
DCWW_NOWAIT, &codes, &pid, proc->pid);
   
  -    if ((stat = waitpid(proc->pid, NULL, WUNTRACED | WNOHANG)) > 0) {
  -        proc->running = FALSE;
  +    if (rc == 0) {
  +        proc->running = 0;
           return APR_CHILD_DONE;
  -    } else if (stat == 0) {
  +    } else if (rc == ERROR_CHILD_NOT_COMPLETE) {
           return APR_CHILD_NOTDONE;
       }
   
  -    return errno;
  +    return os2errno(rc);
   } 
   
   
  
  
  

Reply via email to