bjh 99/10/11 07:44:26
Modified: src/lib/apr/threadproc/os2 proc.c threadproc.h Log: OS/2: Implement detached processes & fix some parameter ordering. Revision Changes Path 1.4 +16 -8 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- proc.c 1999/10/04 16:37:37 1.3 +++ proc.c 1999/10/11 14:44:24 1.4 @@ -65,6 +65,7 @@ #include <sys/wait.h> #include <unistd.h> #include <process.h> +#include <stdlib.h> #define INCL_DOS #include <os2.h> @@ -85,6 +86,7 @@ (*new)->child_err = NULL; (*new)->currdir = NULL; (*new)->cmdtype = APR_PROGRAM; + (*new)->detached = FALSE; return APR_SUCCESS; } @@ -93,20 +95,20 @@ { ap_status_t stat; if (in) { - if ((stat = ap_create_pipe(attr->cntxt, &attr->child_in, - &attr->parent_in)) != APR_SUCCESS) { + if ((stat = ap_create_pipe(&attr->child_in, &attr->parent_in, + attr->cntxt)) != APR_SUCCESS) { return stat; } } if (out) { - if ((stat = ap_create_pipe(attr->cntxt, &attr->parent_out, - &attr->child_out)) != APR_SUCCESS) { + if ((stat = ap_create_pipe(&attr->parent_out, &attr->child_out, + attr->cntxt)) != APR_SUCCESS) { return stat; } } if (err) { - if ((stat = ap_create_pipe(attr->cntxt, &attr->parent_err, - &attr->child_err)) != APR_SUCCESS) { + if ((stat = ap_create_pipe(&attr->parent_err, &attr->child_err, + attr->cntxt)) != APR_SUCCESS) { return stat; } } @@ -130,6 +132,12 @@ return APR_SUCCESS; } +ap_status_t ap_setprocattr_detach(struct procattr_t *attr, ap_int32_t detach) +{ + attr->detached = detach; + return APR_SUCCESS; +} + ap_status_t ap_fork(struct proc_t **proc, ap_context_t *cont) { int pid; @@ -229,9 +237,9 @@ } newargs[i + 3] = NULL; - (*new)->pid = spawnve(P_NOWAIT, SHELL_PATH, newargs, env); + (*new)->pid = spawnve(attr->detached ? P_DETACH : P_NOWAIT, SHELL_PATH, newargs, env); } else { - (*new)->pid = spawnve(P_NOWAIT, progname, args, env); + (*new)->pid = spawnve(attr->detached ? P_DETACH : P_NOWAIT, progname, args, env); } stat = (*new)->pid < 0 ? errno : APR_SUCCESS; 1.2 +1 -0 apache-2.0/src/lib/apr/threadproc/os2/threadproc.h Index: threadproc.h =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/os2/threadproc.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- threadproc.h 1999/08/17 15:59:50 1.1 +++ threadproc.h 1999/10/11 14:44:25 1.2 @@ -93,6 +93,7 @@ ap_file_t *child_err; char *currdir; ap_int32_t cmdtype; + ap_int32_t detached; }; struct proc_t {