diff options
author | Brian Havard <bjh@apache.org> | 2000-01-10 06:21:12 +0000 |
---|---|---|
committer | Brian Havard <bjh@apache.org> | 2000-01-10 06:21:12 +0000 |
commit | da2eefe33a0494be096e914317bed5b64802c89d (patch) | |
tree | 3eb85b685cbeac79d1f0d787d06a6a2196c4bc35 /threadproc/os2/proc.c | |
parent | e6ecd739a876e713f3715257fa5ff21cf9361b65 (diff) | |
download | apr-da2eefe33a0494be096e914317bed5b64802c89d.tar.gz apr-da2eefe33a0494be096e914317bed5b64802c89d.zip |
OS/2: Use native API for process waits.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@59581 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/os2/proc.c')
-rw-r--r-- | threadproc/os2/proc.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/threadproc/os2/proc.c b/threadproc/os2/proc.c index 31789b61a..7ed66e64a 100644 --- a/threadproc/os2/proc.c +++ b/threadproc/os2/proc.c @@ -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 @@ ap_status_t ap_create_process(struct proc_t **new, const char *progname, } 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_get_childerr(ap_file_t **new, struct proc_t *proc) 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 @@ ap_status_t ap_wait_proc(struct proc_t *proc, 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); } |