summaryrefslogtreecommitdiff
path: root/threadproc/netware
diff options
context:
space:
mode:
authorbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2002-04-11 20:49:29 +0000
committerbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2002-04-11 20:49:29 +0000
commit94b45646f3a990b985af7a67fe73899940067bdf (patch)
tree0415ff768f70e4722c5a938acbc84ad813ecab7c /threadproc/netware
parentd53a039bcc94932d2348b469a06af8ea81325427 (diff)
downloadlibapr-94b45646f3a990b985af7a67fe73899940067bdf.tar.gz
Still working on the spawning process and wiring up the pipes. Changed
apr_proc_create so that the parent side of the pipes are opened first. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63250 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc/netware')
-rw-r--r--threadproc/netware/proc.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/threadproc/netware/proc.c b/threadproc/netware/proc.c
index e466108bc..a83e93e50 100644
--- a/threadproc/netware/proc.c
+++ b/threadproc/netware/proc.c
@@ -347,12 +347,18 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc,
envSpec.esStdin.ssPath = attr->child_in->fname;
apr_file_close(attr->child_in);
if (attr->parent_in) {
- apr_file_close(attr->parent_in);
+ close(attr->parent_in->filedes);
+ attr->parent_in->filedes = pipe_open(attr->parent_in->fname, O_WRONLY);
+ /* XXX take this out when pipe blocking is fixed */
+ fcntl(attr->parent_in->filedes, F_SETFL, 0);
}
}
else if (attr->parent_in) {
envSpec.esStdin.ssPath = attr->parent_in->fname;
- apr_file_close(attr->parent_in);
+ close(attr->parent_in->filedes);
+ attr->parent_in->filedes = pipe_open(attr->parent_in->fname, O_WRONLY);
+ /* XXX take this out when pipe blocking is fixed */
+ fcntl(attr->parent_in->filedes, F_SETFL, 0);
}
else {
envSpec.esStdin.ssPath = NULL;
@@ -367,12 +373,18 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc,
envSpec.esStdout.ssPath = attr->child_out->fname;
apr_file_close(attr->child_out);
if (attr->parent_out) {
- apr_file_close(attr->parent_out);
+ close(attr->parent_out->filedes);
+ attr->parent_out->filedes = pipe_open(attr->parent_out->fname, O_RDONLY);
+ /* XXX take this out when pipe blocking is fixed */
+ fcntl(attr->parent_out->filedes, F_SETFL, 0);
}
}
else if (attr->parent_out) {
envSpec.esStdout.ssPath = attr->parent_out->fname;
- apr_file_close(attr->parent_out);
+ close(attr->parent_out->filedes);
+ attr->parent_out->filedes = pipe_open(attr->parent_out->fname, O_RDONLY);
+ /* XXX take this out when pipe blocking is fixed */
+ fcntl(attr->parent_out->filedes, F_SETFL, 0);
}
else {
envSpec.esStdout.ssPath = NULL;
@@ -387,12 +399,18 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc,
envSpec.esStderr.ssPath = attr->child_err->fname;
apr_file_close(attr->child_err);
if (attr->parent_err) {
- apr_file_close(attr->parent_err);
+ close(attr->parent_err->filedes);
+ attr->parent_err->filedes = pipe_open(attr->parent_err->fname, O_RDONLY);
+ /* XXX take this out when pipe blocking is fixed */
+ fcntl(attr->parent_err->filedes, F_SETFL, 0);
}
}
else if (attr->parent_err) {
envSpec.esStderr.ssPath = attr->parent_err->fname;
- apr_file_close(attr->parent_err);
+ close(attr->parent_err->filedes);
+ attr->parent_err->filedes = pipe_open(attr->parent_err->fname, O_RDONLY);
+ /* XXX take this out when pipe blocking is fixed */
+ fcntl(attr->parent_err->filedes, F_SETFL, 0);
}
else {
envSpec.esStderr.ssPath = NULL;
@@ -406,20 +424,13 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc,
newproc->err = attr->parent_err;
newproc->out = attr->parent_out;
if (NXVmSpawn(&nameSpec, &envSpec, flags, &newVM) != 0) {
+ apr_file_close(attr->parent_in);
+ apr_file_close(attr->parent_out);
+ apr_file_close(attr->parent_err);
return errno;
}
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(pool, (void *)newproc, apr_netware_proc_cleanup,
apr_pool_cleanup_null);
}