rbb 99/06/07 06:34:15
Modified: apr/file_io/beos dir.c pipe.c
apr/misc/beos start.c
apr/threadproc/beos proc.c
Log:
Most recent changes to BeOS APR.
Submitted by: David Reid
Revision Changes Path
1.7 +1 -1 apache-apr/apr/file_io/beos/dir.c
Index: dir.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/file_io/beos/dir.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- dir.c 1999/06/02 18:44:26 1.6
+++ dir.c 1999/06/07 13:34:13 1.7
@@ -86,7 +86,7 @@
return errno;
}
else {
- ap_register_cleanup(cont->pool, (void*)(*new), dir_cleanup, NULL);
+ ap_register_cleanup((*new)->cntxt, (void*)(*new), dir_cleanup, NULL);
return APR_SUCCESS;
}
}
1.5 +2 -3 apache-apr/apr/file_io/beos/pipe.c
Index: pipe.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/file_io/beos/pipe.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- pipe.c 1999/06/02 18:44:28 1.4
+++ pipe.c 1999/06/07 13:34:14 1.5
@@ -69,16 +69,15 @@
if (pipe(filedes) == -1) {
return errno;
}
-
(*in) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t));
(*in)->cntxt = cont;
(*in)->filedes = filedes[0];
- (*in)->fname = (char*)ap_pstrdup(cont->pool, "PIPE");
+ (*in)->fname = (char*)ap_pstrdup(cont, "PIPE");
(*out) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t));
(*out)->cntxt = cont;
(*out)->filedes = filedes[1];
- (*out)->fname = (char*)ap_pstrdup(cont->pool, "PIPE");
+ (*out)->fname = (char*)ap_pstrdup(cont, "PIPE");
return APR_SUCCESS;
}
1.3 +10 -2 apache-apr/apr/misc/beos/start.c
Index: start.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/misc/beos/start.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- start.c 1999/05/27 19:02:33 1.2
+++ start.c 1999/06/07 13:34:14 1.3
@@ -59,6 +59,7 @@
#include "apr_general.h"
#include "apr_errno.h"
#include "apr_pools.h"
+#include "misc.h"
#include <errno.h>
#include <string.h>
@@ -76,8 +77,15 @@
if (pool == NULL) {
return APR_ENOPOOL;
- }
- new = (ap_context_t *)ap_palloc(pool, sizeof(ap_context_t));
+ }
+
+ if (cont) {
+ new = (struct context_t *)ap_palloc(cont, sizeof(struct context_t));
+ }
+ else {
+ new = (struct context_t *)malloc(sizeof(struct context_t));
+ }
+
new->pool = pool;
if (data == NULL && cont) {
new->prog_data = cont->prog_data;
1.5 +17 -17 apache-apr/apr/threadproc/beos/proc.c
Index: proc.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/threadproc/beos/proc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- proc.c 1999/06/02 18:44:59 1.4
+++ proc.c 1999/06/07 13:34:15 1.5
@@ -110,7 +110,7 @@
ap_status_t ap_setprocattr_dir(struct procattr_t *attr,
char *dir)
{
- attr->currdir = (char*)ap_pstrdup(attr->cntxt, dir);
+ attr->currdir = (char *)ap_pstrdup(attr->cntxt, dir);
if (attr->currdir) {
return APR_SUCCESS;
}
@@ -156,7 +156,6 @@
}
(*new)->cntxt = cont;
-
if (((*new)->pid = fork()) < 0) {
return errno;
}
@@ -182,7 +181,6 @@
if (attr->currdir != NULL) {
if (chdir(attr->currdir) == -1) {
- free(new);
exit(-1); /* We have big problems, the child should exit.
*/
}
}
@@ -191,7 +189,7 @@
while (args[i]) {
i++;
}
- newargs = (char **)malloc(sizeof (char *) * (i + 3));
+ newargs = (char **)ap_palloc(cont, sizeof (char *) * (i + 3));
newargs[0] = strdup(SHELL_PATH);
newargs[1] = strdup("-c");
i = 0;
@@ -231,7 +229,7 @@
ap_status_t ap_get_childout(struct proc_t *proc, ap_file_t **new)
{
- (*new) = proc->attr->parent_out;
+ (*new) = proc->attr->parent_out;
return APR_SUCCESS;
}
@@ -244,21 +242,23 @@
ap_status_t ap_wait_proc(struct proc_t *proc,
ap_wait_how_e wait)
{
+ pid_t stat;
if (!proc)
return APR_ENOPROC;
if (wait == APR_WAIT) {
- if (waitpid(proc->pid, NULL, WUNTRACED) > 0)
+ if ((stat = waitpid(proc->pid, NULL, WUNTRACED)) > 0) {
return APR_CHILD_DONE;
- return APR_CHILD_NOTDONE;
+ }
+ else if (stat == 0) {
+ return APR_CHILD_NOTDONE;
+ }
+ return errno;
}
- if (waitpid(proc->pid, NULL, WUNTRACED | WNOHANG) > 0)
- return APR_CHILD_DONE;
- return APR_CHILD_NOTDONE;
+ if ((stat = waitpid(proc->pid, NULL, WUNTRACED | WNOHANG)) > 0) {
+ return APR_CHILD_DONE;
+ }
+ else if (stat == 0) {
+ return APR_CHILD_NOTDONE;
+ }
+ return errno;
}
-
-void ap_exit_proc(ap_context_t *cont)
-{
- ap_destroy_pool(cont->pool);
-}
-
-