summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorRyan Bloom <rbb@apache.org>2000-05-16 17:04:09 +0000
committerRyan Bloom <rbb@apache.org>2000-05-16 17:04:09 +0000
commit75cee9a68d329992b9a98a36f6a2b2fc215f76a0 (patch)
tree5993cfab74c2919e8e41e94a14e32503d02b0f20 /misc
parentf593c842a4b053d455fb20fc345299471cc27973 (diff)
downloadapr-75cee9a68d329992b9a98a36f6a2b2fc215f76a0.tar.gz
Remove the separate beos directory and add support to the unix directory
for BeOS support. The diffs are minimal, and this makes it much easier to find and fix bugs, without duplicating nearly as much code. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@60045 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'misc')
-rw-r--r--misc/beos/Makefile.in61
-rw-r--r--misc/beos/misc.h97
-rw-r--r--misc/beos/misc_common.c64
-rw-r--r--misc/beos/otherchild.c180
-rw-r--r--misc/beos/start.c153
-rw-r--r--misc/unix/getopt.c6
-rw-r--r--misc/unix/misc.h5
-rw-r--r--misc/unix/otherchild.c16
8 files changed, 14 insertions, 568 deletions
diff --git a/misc/beos/Makefile.in b/misc/beos/Makefile.in
deleted file mode 100644
index 7fbb62784..000000000
--- a/misc/beos/Makefile.in
+++ /dev/null
@@ -1,61 +0,0 @@
-#CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
-#LIBS=$(EXTRA_LIBS) $(LIBS1)
-#INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
-#LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
-
-CC=@CC@
-RANLIB=@RANLIB@
-CFLAGS=@CFLAGS@ @OPTIM@
-LIBS=@LIBS@
-LDFLAGS=@LDFLAGS@ $(LIBS)
-INCDIR=../../include
-INCDIR1=../../file_io/unix -I../../locks/beos -I../../threadproc/beos
-
-INCLUDES=-I$(INCDIR) -I$(INCDIR1) -I.
-
-LIB=libmisc.a
-
-OBJS=misc_common.o
-
-.c.o:
- $(CC) $(CFLAGS) -c $(INCLUDES) $<
-
-all: $(LIB)
-
-clean:
- $(RM) -f *.o *.a *.so
-
-distclean: clean
- -$(RM) -f Makefile
-
-
-$(LIB): $(OBJS)
- $(RM) -f $@
- $(AR) cr $@ $(OBJS)
- $(RANLIB) $@
-
-#
-# We really don't expect end users to use this rule. It works only with
-# gcc, and rebuilds Makefile.in. You have to re-run configure after
-# using it.
-#
-depend:
- cp Makefile.in Makefile.in.bak \
- && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.in > Makefile.new \
- && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \
- && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \
- -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \
- > Makefile.in \
- && rm Makefile.new
-
-# DO NOT REMOVE
-getopt.o: getopt.c misc.h ../../include/apr_private.h \
- ../../include/apr_general.h ../../include/apr.h \
- ../../include/apr_errno.h ../../include/apr_pools.h \
- ../../include/apr_lib.h ../../include/apr_file_io.h \
- ../../include/apr_getopt.h
-start.o: start.c misc.h ../../include/apr_private.h \
- ../../include/apr_general.h ../../include/apr.h \
- ../../include/apr_errno.h ../../include/apr_pools.h \
- ../../include/apr_lib.h ../../include/apr_file_io.h \
- ../../include/apr_getopt.h
diff --git a/misc/beos/misc.h b/misc/beos/misc.h
deleted file mode 100644
index 7c99c206a..000000000
--- a/misc/beos/misc.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#ifndef MISC_H
-#define MISC_H
-
-#include "apr_private.h"
-#include "apr_general.h"
-#include "apr_pools.h"
-#include "apr_getopt.h"
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_STDIO_H
-#include <stdio.h>
-#endif
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-
-#include <kernel/OS.h>
-
-typedef struct datastruct {
- void *data;
- char *key;
- struct datastruct *next;
- struct datastruct *prev;
-} datastruct;
-
-struct ap_other_child_rec_t {
- struct ap_other_child_rec_t *next;
- thread_id pid; /* this is actually a thread_id, but in order to
- restrict the amount of code duplication we'll use
- pid so that the Unix code won't have too many #ifdef's
- */
- void (*maintenance) (int, void *);
- void *data;
- int write_fd;
-};
-
-
-#endif /* ! MISC_H */
-
diff --git a/misc/beos/misc_common.c b/misc/beos/misc_common.c
deleted file mode 100644
index 86a11c4cf..000000000
--- a/misc/beos/misc_common.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/* BeOS uses identical code so let's not have 2 copies... */
-
-#include "../unix/start.c"
-
-#include "../unix/getopt.c"
-
-#include "../unix/otherchild.c"
-
-#include "../unix/canonerr.c"
-#include "../unix/errorcodes.c"
diff --git a/misc/beos/otherchild.c b/misc/beos/otherchild.c
deleted file mode 100644
index 1239eedbc..000000000
--- a/misc/beos/otherchild.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "misc.h"
-#include "../../threadproc/beos/threadproc.h"
-
-static ap_other_child_rec_t *other_children = NULL;
-
-API_EXPORT(void) ap_register_other_child(ap_proc_t *pid,
- void (*maintenance) (int reason, void *),
- void *data, int write_fd, ap_pool_t *p)
-{
- ap_other_child_rec_t *ocr;
-
- ocr = ap_palloc(p, sizeof(*ocr));
- ocr->tid = pid->tid;
- ocr->maintenance = maintenance;
- ocr->data = data;
- ocr->write_fd = write_fd;
- ocr->next = other_children;
- other_children = ocr;
-}
-
-API_EXPORT(void) ap_unregister_other_child(void *data)
-{
- ap_other_child_rec_t **pocr, *nocr;
-
- for (pocr = &other_children; *pocr; pocr = &(*pocr)->next) {
- if ((*pocr)->data == data) {
- nocr = (*pocr)->next;
- (*(*pocr)->maintenance) (APR_OC_REASON_UNREGISTER, (*pocr)->data);
- *pocr = nocr;
- /* XXX: um, well we've just wasted some space in pconf ? */
- return;
- }
- }
-}
-
-/* test to ensure that the write_fds are all still writable, otherwise
- * invoke the maintenance functions as appropriate */
-static void probe_writable_fds(void)
-{
- fd_set writable_fds;
- int fd_max;
- ap_other_child_rec_t *ocr, *nocr;
- struct timeval tv;
- int rc;
-
- if (other_children == NULL)
- return;
-
- fd_max = 0;
- FD_ZERO(&writable_fds);
- do {
- for (ocr = other_children; ocr; ocr = ocr->next) {
- if (ocr->write_fd == -1)
- continue;
- FD_SET(ocr->write_fd, &writable_fds);
- if (ocr->write_fd > fd_max) {
- fd_max = ocr->write_fd;
- }
- }
- if (fd_max == 0)
- return;
-
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- rc = select(fd_max + 1, NULL, &writable_fds, NULL, &tv);
- } while (rc == -1 && errno == EINTR);
-
- if (rc == -1) {
- /* XXX: uhh this could be really bad, we could have a bad file
- * descriptor due to a bug in one of the maintenance routines */
- return;
- }
- if (rc == 0)
- return;
-
- for (ocr = other_children; ocr; ocr = nocr) {
- nocr = ocr->next;
- if (ocr->write_fd == -1)
- continue;
- if (FD_ISSET(ocr->write_fd, &writable_fds))
- continue;
- (*ocr->maintenance) (APR_OC_REASON_UNWRITABLE, ocr->data);
- }
-}
-
-API_EXPORT(ap_status_t) reap_other_child(ap_proc_t *pid)
-{
- ap_other_child_rec_t *ocr, *nocr;
-
- for (ocr = other_children; ocr; ocr = nocr) {
- nocr = ocr->next;
- if (ocr->tid != pid->tid)
- continue;
- ocr->tid = -1;
- (*ocr->maintenance) (APR_OC_REASON_DEATH, ocr->data);
- return 0;
- }
- return APR_CHILD_NOTDONE;
-}
-
-API_EXPORT(void) check_other_child(void)
-{
- ap_other_child_rec_t *ocr, *nocr;
- pid_t waitret;
-
- for (ocr = other_children; ocr; ocr = nocr) {
- nocr = ocr->next;
- if (ocr->tid == -1)
- continue;
-
- waitret = waitpid(ocr->tid, NULL, WNOHANG);
- if (waitret == ocr->tid) {
- ocr->tid = -1;
- (*ocr->maintenance) (APR_OC_REASON_DEATH, ocr->data);
- }
- else if (waitret == 0) {
- (*ocr->maintenance) (APR_OC_REASON_RESTART, ocr->data);
- }
- else if (waitret == -1) {
- /* uh what the heck? they didn't call unregister? */
- ocr->tid = -1;
- (*ocr->maintenance) (APR_OC_REASON_LOST, ocr->data);
- }
- }
-}
-
diff --git a/misc/beos/start.c b/misc/beos/start.c
deleted file mode 100644
index f46f1bfe5..000000000
--- a/misc/beos/start.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-#include "misc.h"
-
-ap_status_t ap_create_pool(ap_pool_t **newcont, ap_pool_t *cont)
-{
- ap_pool_t *new;
- ap_pool_t *pool;
-
- if (cont) {
- pool = ap_make_sub_pool(cont->pool, cont->apr_abort);
- }
- else {
- pool = ap_make_sub_pool(NULL, NULL);
- }
-
- if (pool == NULL) {
- return APR_ENOPOOL;
- }
-
- new = (ap_pool_t *)ap_palloc(cont, sizeof(ap_pool_t));
-
- new->pool = pool;
- new->prog_data = NULL;
-
- *newcont = new;
- return APR_SUCCESS;
-}
-
-ap_status_t ap_destroy_context(ap_pool_t *cont)
-{
- ap_destroy_pool(cont);
- return APR_SUCCESS;
-}
-
-ap_status_t ap_set_userdata(void *data, char *key,
- ap_status_t (*cleanup) (void *),
- ap_pool_t *cont)
-{
- datastruct *dptr = NULL, *dptr2 = NULL;
- if (cont) {
- dptr = cont->prog_data;
- while (dptr) {
- if (!strcmp(dptr->key, key))
- break;
- dptr2 = dptr;
- dptr = dptr->next;
- }
- if (dptr == NULL) {
- dptr = ap_palloc(cont, sizeof(datastruct));
- dptr->next = dptr->prev = NULL;
- dptr->key = ap_pstrdup(cont, key);
- if (dptr2) {
- dptr2->next = dptr;
- dptr->prev = dptr2;
- }
- else {
- cont->prog_data = dptr;
- }
- }
- dptr->data = data;
- ap_register_cleanup(cont, dptr->data, cleanup, cleanup);
- return APR_SUCCESS;
- }
- return APR_ENOPOOL;
-}
-
-ap_status_t ap_get_userdata(void **data, char *key, ap_pool_t *cont)
-{
- datastruct *dptr = NULL;
- if (cont) {
- dptr = cont->prog_data;
- while (dptr) {
- if (!strcmp(dptr->key, key)) {
- break;
- }
- dptr = dptr->next;
- }
- if (dptr) {
- (*data) = dptr->data;
- }
- else {
- (*data) = NULL;
- }
- return APR_SUCCESS;
- }
- return APR_ENOPOOL;
-}
-
-ap_status_t ap_initialize(void)
-{
- ap_status_t status;
- status = ap_init_alloc();
- return status;
-}
-
-void ap_terminate(void)
-{
- ap_term_alloc();
-}
-
diff --git a/misc/unix/getopt.c b/misc/unix/getopt.c
index 940e5b612..0272e2c5b 100644
--- a/misc/unix/getopt.c
+++ b/misc/unix/getopt.c
@@ -67,8 +67,7 @@ ap_status_t ap_getopt(ap_int32_t nargc, char *const *nargv, const char *ostr, ap
* if the user didn't specify '-' as an option,
* assume it means -1.
*/
- if (ap_optopt == (int) '-')
- {
+ if (ap_optopt == (int) '-') {
*rv = ap_optopt;
return (APR_EOF);
}
@@ -95,8 +94,7 @@ ap_status_t ap_getopt(ap_int32_t nargc, char *const *nargv, const char *ostr, ap
ap_optarg = place;
else if (nargc <= ++ap_optind) { /* no arg */
place = EMSG;
- if (*ostr == ':')
- {
+ if (*ostr == ':') {
*rv = ap_optopt;
return (APR_BADARG);
}
diff --git a/misc/unix/misc.h b/misc/unix/misc.h
index bb754bbf6..736eb60df 100644
--- a/misc/unix/misc.h
+++ b/misc/unix/misc.h
@@ -77,6 +77,9 @@
#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif
+#ifdef BEOS
+#include <kernel/OS.h>
+#endif
typedef struct datastruct {
void *data;
@@ -87,7 +90,7 @@ typedef struct datastruct {
struct ap_other_child_rec_t {
struct ap_other_child_rec_t *next;
- int pid;
+ int id; /* This is either a pid or tid depending on the platform */
void (*maintenance) (int, void *, int);
void *data;
int write_fd;
diff --git a/misc/unix/otherchild.c b/misc/unix/otherchild.c
index d2255cc56..9c752656f 100644
--- a/misc/unix/otherchild.c
+++ b/misc/unix/otherchild.c
@@ -74,7 +74,7 @@ API_EXPORT(void) ap_register_other_child(ap_proc_t *pid,
ap_other_child_rec_t *ocr;
ocr = ap_palloc(p, sizeof(*ocr));
- ocr->pid = pid->pid;
+ ocr->id = pid->pid;
ocr->maintenance = maintenance;
ocr->data = data;
if (write_fd == NULL) {
@@ -158,10 +158,10 @@ API_EXPORT(ap_status_t) ap_reap_other_child(ap_proc_t *pid, int status)
for (ocr = other_children; ocr; ocr = nocr) {
nocr = ocr->next;
- if (ocr->pid != pid->pid)
+ if (ocr->id != pid->pid)
continue;
- ocr->pid = -1;
+ ocr->id = -1;
(*ocr->maintenance) (APR_OC_REASON_DEATH, ocr->data, status);
return 0;
}
@@ -176,12 +176,12 @@ API_EXPORT(void) ap_check_other_child(void)
for (ocr = other_children; ocr; ocr = nocr) {
nocr = ocr->next;
- if (ocr->pid == -1)
+ if (ocr->id == -1)
continue;
- waitret = waitpid(ocr->pid, &status, WNOHANG);
- if (waitret == ocr->pid) {
- ocr->pid = -1;
+ waitret = waitpid(ocr->id, &status, WNOHANG);
+ if (waitret == ocr->id) {
+ ocr->id = -1;
(*ocr->maintenance) (APR_OC_REASON_DEATH, ocr->data, status);
}
else if (waitret == 0) {
@@ -189,7 +189,7 @@ API_EXPORT(void) ap_check_other_child(void)
}
else if (waitret == -1) {
/* uh what the heck? they didn't call unregister? */
- ocr->pid = -1;
+ ocr->id = -1;
(*ocr->maintenance) (APR_OC_REASON_LOST, ocr->data, -1);
}
}