summaryrefslogtreecommitdiff
path: root/threadproc/os2
diff options
context:
space:
mode:
authorbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2000-01-10 06:21:12 +0000
committerbjh <bjh@13f79535-47bb-0310-9956-ffa450edef68>2000-01-10 06:21:12 +0000
commitbfcde3574e10e52ec6633099dad59c621b27a0b0 (patch)
tree3eb85b685cbeac79d1f0d787d06a6a2196c4bc35 /threadproc/os2
parent8f1857909533ba9c90a33bdf2d743922ff35d62e (diff)
downloadlibapr-bfcde3574e10e52ec6633099dad59c621b27a0b0.tar.gz
OS/2: Use native API for process waits.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59581 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/os2')
-rw-r--r--threadproc/os2/proc.c31
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);
}