summaryrefslogtreecommitdiff
path: root/threadproc
diff options
context:
space:
mode:
authorbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2002-03-05 19:48:55 +0000
committerbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2002-03-05 19:48:55 +0000
commit396814563993f3776768274c272f2fe7afb3b9c3 (patch)
tree1109e27a7c8e42c970b8a257c005fd5d29637671 /threadproc
parent690818d69e4965717c34f9897e6a9da6598f18bc (diff)
downloadlibapr-396814563993f3776768274c272f2fe7afb3b9c3.tar.gz
Second cut at fork/exec and pipe functionality on NetWare. Still a work in
progress. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63083 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r--threadproc/netware/proc.c75
1 files changed, 57 insertions, 18 deletions
diff --git a/threadproc/netware/proc.c b/threadproc/netware/proc.c
index 08ceede31..541e52bd0 100644
--- a/threadproc/netware/proc.c
+++ b/threadproc/netware/proc.c
@@ -333,36 +333,65 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc,
else
envSpec.esEnv = NULL;
+ envSpec.esStdin.ssType = NX_OBJ_FIFO;
+ envSpec.esStdin.ssHandle = -1;
+ envSpec.esStdin.ssPathCtx = 0;
if (attr->child_in) {
- envSpec.esStdin.ssType = NX_OBJ_FIFO;
- envSpec.esStdin.ssHandle = attr->child_in->filedes;
+ apr_pool_cleanup_kill(apr_file_pool_get(attr->child_in),
+ attr->child_in, apr_netware_pipe_cleanup);
+ envSpec.esStdin.ssPath = attr->child_in->fname;
+ apr_file_close(attr->child_in);
+ if (attr->parent_in) {
+ apr_file_close(attr->parent_in);
+ }
+ }
+ else if (attr->parent_in) {
+ envSpec.esStdin.ssPath = attr->parent_in->fname;
+ apr_file_close(attr->parent_in);
}
else {
- envSpec.esStdin.ssType = NX_OBJ_DEFAULT;
- envSpec.esStdin.ssHandle = -1;
+ envSpec.esStdin.ssPath = NULL;
}
- envSpec.esStdin.ssPathCtx = NULL;
- envSpec.esStdin.ssPath = NULL;
+
+ envSpec.esStdout.ssType = NX_OBJ_FIFO;
+ envSpec.esStdout.ssHandle = -1;
+ envSpec.esStdout.ssPathCtx = 0;
if (attr->child_out) {
- envSpec.esStdout.ssType = NX_OBJ_FIFO;
- envSpec.esStdout.ssHandle = attr->child_out->filedes;
+ apr_pool_cleanup_kill(apr_file_pool_get(attr->child_out),
+ attr->child_out, apr_netware_pipe_cleanup);
+ envSpec.esStdout.ssPath = attr->child_out->fname;
+ apr_file_close(attr->child_out);
+ if (attr->parent_out) {
+ apr_file_close(attr->parent_out);
+ }
+ }
+ else if (attr->parent_out) {
+ envSpec.esStdout.ssPath = attr->parent_out->fname;
+ apr_file_close(attr->parent_out);
}
else {
- envSpec.esStdout.ssType = NX_OBJ_DEFAULT;
- envSpec.esStdout.ssHandle = -1;
+ envSpec.esStdout.ssPath = NULL;
}
- envSpec.esStdout.ssPathCtx = NULL;
- envSpec.esStdout.ssPath = NULL;
+
+ envSpec.esStderr.ssType = NX_OBJ_FIFO;
+ envSpec.esStderr.ssHandle = -1;
+ envSpec.esStderr.ssPathCtx = 0;
if (attr->child_err) {
- envSpec.esStderr.ssType = NX_OBJ_FIFO;
- envSpec.esStderr.ssHandle = attr->child_err->filedes;
+ apr_pool_cleanup_kill(apr_file_pool_get(attr->child_err),
+ attr->child_err, apr_netware_pipe_cleanup);
+ envSpec.esStderr.ssPath = attr->child_err->fname;
+ apr_file_close(attr->child_err);
+ if (attr->parent_err) {
+ apr_file_close(attr->parent_err);
+ }
+ }
+ else if (attr->parent_err) {
+ envSpec.esStderr.ssPath = attr->parent_err->fname;
+ apr_file_close(attr->parent_err);
}
else {
- envSpec.esStderr.ssType = NX_OBJ_DEFAULT;
- envSpec.esStderr.ssHandle = -1;
+ envSpec.esStderr.ssPath = NULL;
}
- envSpec.esStderr.ssPathCtx = NULL;
- envSpec.esStderr.ssPath = NULL;
if (attr->detached) {
flags = NX_VM_CREATE_DETACHED;
@@ -376,6 +405,16 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc,
}
else {
newproc->pid = newVM;
+ if (attr->parent_out) {
+ attr->parent_out->filedes = pipe_open(attr->parent_out->fname, O_WRONLY);
+ }
+ if (attr->parent_in) {
+ attr->parent_in->filedes = pipe_open(attr->parent_in->fname, O_RDONLY);
+ }
+ if (attr->parent_err) {
+ attr->parent_err->filedes = pipe_open(attr->parent_err->fname, O_RDONLY);
+ }
+
apr_pool_cleanup_register(cont, (void *)newproc, apr_netware_proc_cleanup,
apr_pool_cleanup_null);
}