aboutsummaryrefslogtreecommitdiff
path: root/threadproc/unix
diff options
context:
space:
mode:
Diffstat (limited to 'threadproc/unix')
-rw-r--r--threadproc/unix/.cvsignore1
-rw-r--r--threadproc/unix/Makefile.in90
-rw-r--r--threadproc/unix/proc.c410
-rw-r--r--threadproc/unix/procsup.c166
-rw-r--r--threadproc/unix/signals.c72
-rw-r--r--threadproc/unix/thread.c364
-rw-r--r--threadproc/unix/threadcancel.c128
-rw-r--r--threadproc/unix/threadpriv.c260
-rw-r--r--threadproc/unix/threadproc.h105
9 files changed, 0 insertions, 1596 deletions
diff --git a/threadproc/unix/.cvsignore b/threadproc/unix/.cvsignore
deleted file mode 100644
index f3c7a7c5d..000000000
--- a/threadproc/unix/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile
diff --git a/threadproc/unix/Makefile.in b/threadproc/unix/Makefile.in
deleted file mode 100644
index 51640cde1..000000000
--- a/threadproc/unix/Makefile.in
+++ /dev/null
@@ -1,90 +0,0 @@
-#CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS)
-#LIBS=$(EXTRA_LIBS) $(LIBS1)
-#INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES)
-#LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS)
-
-RM=@RM@
-CC=@CC@
-RANLIB=@RANLIB@
-CFLAGS=@CFLAGS@ @OPTIM@
-LIBS=@LIBS@
-LDFLAGS=@LDFLAGS@ $(LIBS)
-INCDIR=../../inc
-INCDIR1=../../include
-INCDIR2=../../file_io/unix
-INCLUDES=-I$(INCDIR) -I$(INCDIR1) -I$(INCDIR2) -I.
-
-LIB=../libthreadproc.a
-
-OBJS=proc.o \
- procsup.o \
- thread.o \
- threadcancel.o \
- threadpriv.o \
- signals.o
-
-.c.o:
- $(CC) $(CFLAGS) -c $(INCLUDES) $<
-
-all: $(LIB)
-
-clean:
- $(RM) -f *.o *.a *.so
-
-distclean: clean
- -$(RM) -f Makefile
-
-$(OBJS): 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.tmpl. 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
-proc.o: proc.c threadproc.h ../../include/apr_thread_proc.h \
- ../../include/apr_file_io.h ../../include/apr_general.h \
- ../../include/apr_config.h ../../include/apr_errno.h \
- ../../include/apr_win.h ../../file_io/unix/fileio.h \
- ../../include/apr_lib.h ../../include/hsregex.h \
- ../../include/apr_portable.h ../../include/apr_network_io.h \
- ../../include/apr_lock.h ../../include/apr_time.h
-procsup.o: procsup.c threadproc.h ../../include/apr_thread_proc.h \
- ../../include/apr_file_io.h ../../include/apr_general.h \
- ../../include/apr_config.h ../../include/apr_errno.h \
- ../../include/apr_win.h ../../file_io/unix/fileio.h \
- ../../include/apr_lib.h ../../include/hsregex.h
-signals.o: signals.c threadproc.h ../../include/apr_thread_proc.h \
- ../../include/apr_file_io.h ../../include/apr_general.h \
- ../../include/apr_config.h ../../include/apr_errno.h \
- ../../include/apr_win.h ../../file_io/unix/fileio.h
-thread.o: thread.c threadproc.h ../../include/apr_thread_proc.h \
- ../../include/apr_file_io.h ../../include/apr_general.h \
- ../../include/apr_config.h ../../include/apr_errno.h \
- ../../include/apr_win.h ../../include/apr_portable.h \
- ../../include/apr_network_io.h ../../include/apr_lock.h \
- ../../include/apr_time.h
-threadcancel.o: threadcancel.c threadproc.h \
- ../../include/apr_thread_proc.h ../../include/apr_file_io.h \
- ../../include/apr_general.h ../../include/apr_config.h \
- ../../include/apr_errno.h ../../include/apr_win.h
-threadpriv.o: threadpriv.c threadproc.h \
- ../../include/apr_thread_proc.h ../../include/apr_file_io.h \
- ../../include/apr_general.h ../../include/apr_config.h \
- ../../include/apr_errno.h ../../include/apr_win.h \
- ../../include/apr_portable.h ../../include/apr_network_io.h \
- ../../include/apr_lock.h ../../include/apr_time.h
diff --git a/threadproc/unix/proc.c b/threadproc/unix/proc.c
deleted file mode 100644
index 3022350e5..000000000
--- a/threadproc/unix/proc.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1999 The Apache Group. 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. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" 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 names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``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 GROUP 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 Group.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- */
-
-#include "threadproc.h"
-#include "fileio.h"
-
-#include "apr_thread_proc.h"
-#include "apr_file_io.h"
-#include "apr_general.h"
-#include "apr_lib.h"
-#include "apr_portable.h"
-#include <signal.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_createprocattr_init(ap_context_t *, ap_procattr_t **)
- * Create and initialize a new procattr variable
- * arg 1) The context to use
- * arg 2) The newly created procattr.
- */
-ap_status_t ap_createprocattr_init(ap_context_t *cont, struct procattr_t **new)
-{
- (*new) = (struct procattr_t *)ap_palloc(cont,
- sizeof(struct procattr_t));
-
- if ((*new) == NULL) {
- return APR_ENOMEM;
- }
- (*new)->cntxt = cont;
- (*new)->parent_in = NULL;
- (*new)->child_in = NULL;
- (*new)->parent_out = NULL;
- (*new)->child_out = NULL;
- (*new)->parent_err = NULL;
- (*new)->child_err = NULL;
- (*new)->currdir = NULL;
- (*new)->cmdtype = APR_PROGRAM;
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_setprocattr_io(ap_procattr_t *, ap_int32_t, ap_int32_t
- * ap_int32_t)
- * Determine if any of stdin, stdout, or stderr should be linked
- * to pipes when starting a child process.
- * arg 1) The procattr we care about.
- * arg 2) Should stdin be a pipe bnack to the parent?
- * arg 3) Should stdout be a pipe bnack to the parent?
- * arg 4) Should stderr be a pipe bnack to the parent?
- */
-ap_status_t ap_setprocattr_io(struct procattr_t *attr, ap_int32_t in,
- ap_int32_t out, ap_int32_t err)
-{
- ap_status_t stat;
- if (in) {
- if ((stat = ap_create_pipe(attr->cntxt, &attr->child_in,
- &attr->parent_in)) != APR_SUCCESS) {
- return stat;
- }
- }
- if (out) {
- if ((stat = ap_create_pipe(attr->cntxt, &attr->parent_out,
- &attr->child_out)) != APR_SUCCESS) {
- return stat;
- }
- }
- if (err) {
- if ((stat = ap_create_pipe(attr->cntxt, &attr->parent_err,
- &attr->child_err)) != APR_SUCCESS) {
- return stat;
- }
- }
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_setprocattr_dir(ap_procattr_t *, char *)
- * Set which directory the child process should start executing in.
- * arg 1) The procattr we care about.
- * arg 2) Which dir to start in. By default, this is the same dir as
- * the parent currently resides in, when the createprocess call
- * is made.
- */
-ap_status_t ap_setprocattr_dir(struct procattr_t *attr,
- char *dir)
-{
- attr->currdir = ap_pstrdup(attr->cntxt, dir);
- if (attr->currdir) {
- return APR_SUCCESS;
- }
- return APR_ENOMEM;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_setprocattr_cmdtype(ap_procattr_t *, ap_cmdtype_e)
- * Set what type of command the child process will call.
- * arg 1) The procattr we care about.
- * arg 2) The type of command. One of:
- * APR_SHELLCMD -- Shell script
- * APR_PROGRAM -- Executable program (default)
- */
-ap_status_t ap_setprocattr_cmdtype(struct procattr_t *attr,
- ap_cmdtype_e cmd)
-{
- attr->cmdtype = cmd;
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_setprocattr_detach(ap_procattr_t *, ap_int32_t)
- * Determine if the chlid should start in detached state.
- * arg 1) The procattr we care about.
- * arg 2) Should the child start in detached state? Default is no.
- */
-ap_status_t ap_setprocattr_detach(struct procattr_t *attr, ap_int32_t detach)
-{
- attr->detached = detach;
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_fork_detach(ap_context_t *, ap_proc_t **)
- * This is currently the only non-portable call in APR. This executes
- * a standard unix fork.
- * arg 1) The context to use.
- * arg 2) The resulting process handle.
- */
-ap_status_t ap_fork(ap_context_t *cont, struct proc_t **proc)
-{
- int pid;
-
- (*proc) = ap_palloc(cont, sizeof(struct proc_t));
-
- if ((pid = fork()) < 0) {
- return errno;
- }
- else if (pid == 0) {
- (*proc)->pid = pid;
- (*proc)->attr = NULL;
- return APR_INCHILD;
- }
- (*proc)->pid = pid;
- (*proc)->attr = NULL;
- return APR_INPARENT;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_create_process(ap_context_t *, char *, char *const [],
- char **, ap_procattr_t *, ap_proc_t **)
- * Create a new process and execute a new program within that process.
- * arg 1) The context to use.
- * arg 2) The program to run
- * arg 3) the arguments to pass to the new program. The first one should
- * be the program name.
- * arg 4) The new environment table for the new process. This should be a
- * list of NULL-terminated strings.
- * arg 5) the procattr we should use to determine how to create the new
- * process
- * arg 6) The resulting process handle.
- */
-ap_status_t ap_create_process(ap_context_t *cont, char *progname,
- char *const args[], char **env,
- struct procattr_t *attr, struct proc_t **new)
-{
- int i;
- char **newargs;
- struct proc_t *pgrp;
-
- (*new) = (struct proc_t *)ap_palloc(cont, sizeof(struct proc_t));
-
- if ((*new) == NULL) {
- return APR_ENOMEM;
- }
-
- (*new)->cntxt = cont;
-
- if (((*new)->pid = fork()) < 0) {
- return errno;
- }
- else if ((*new)->pid == 0) {
- /* child process */
- if (attr->child_in) {
- ap_close(attr->parent_in);
- dup2(attr->child_in->filedes, STDIN_FILENO);
- ap_close(attr->child_in);
- }
- if (attr->child_out) {
- ap_close(attr->parent_out);
- dup2(attr->child_out->filedes, STDOUT_FILENO);
- ap_close(attr->child_out);
- }
- if (attr->child_err) {
- ap_close(attr->parent_err);
- dup2(attr->child_err->filedes, STDERR_FILENO);
- ap_close(attr->child_err);
- }
-
- signal(SIGCHLD, SIG_DFL); /*not sure if this is needed or not */
-
- if (attr->currdir != NULL) {
- if (chdir(attr->currdir) == -1) {
- exit(-1); /* We have big problems, the child should exit. */
- }
- }
- if (attr->cmdtype == APR_SHELLCMD) {
- i = 0;
- while (args[i]) {
- i++;
- }
- newargs = (char **)ap_palloc(cont, sizeof (char *) * (i + 3));
- newargs[0] = strdup(SHELL_PATH);
- newargs[1] = strdup("-c");
- i = 0;
- while (args[i]) {
- newargs[i + 2] = strdup(args[i]);
- i++;
- }
- newargs[i + 3] = NULL;
- if (attr->detached) {
- ap_detach(attr->cntxt, &pgrp);
- }
- execve(SHELL_PATH, newargs, env);
- }
- else {
- if (attr->detached) {
- ap_detach(attr->cntxt, &pgrp);
- }
- execve(progname, args, env);
- }
- exit(-1); /* if we get here, there is a problem, so exit with an */
- /* error code. */
- }
- /* Parent process */
- if (attr->child_in) {
- ap_close(attr->child_in);
- }
- if (attr->child_out) {
- ap_close(attr->child_out);
- }
- if (attr->child_err) {
- ap_close(attr->child_err);
- }
-
- (*new)->attr = attr;
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_childin(ap_proc_t *, ap_file_t **)
- * Get the file handle that is assocaited with a child's stdin.
- * arg 1) The process handle that corresponds to the desired child process
- * arg 2) The returned file handle.
- */
-ap_status_t ap_get_childin(struct proc_t *proc, ap_file_t **new)
-{
- (*new) = proc->attr->parent_in;
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_childout(ap_proc_t *, ap_file_t **)
- * Get the file handle that is assocaited with a child's stdout.
- * arg 1) The process handle that corresponds to the desired child process
- * arg 2) The returned file handle.
- */
-ap_status_t ap_get_childout(struct proc_t *proc, ap_file_t **new)
-{
- (*new) = proc->attr->parent_out;
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_childerr(ap_proc_t *, ap_file_t **)
- * Get the file handle that is assocaited with a child's stderr.
- * arg 1) The process handle that corresponds to the desired child process
- * arg 2) The returned file handle.
- */
-ap_status_t ap_get_childerr(struct proc_t *proc, ap_file_t **new)
-{
- (*new) = proc->attr->parent_err;
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_wait_proc(ap_proc_t *, ap_wait_how)
- * Wait for a child process to die
- * arg 1) The process handle that corresponds to the desired child process
- * arg 2) How should we wait. One of:
- * APR_WAIT -- block until the child process dies.
- * APR_NOWAIT -- return immediately regardless of if the
- * child is dead or not.
- * NOTE: The childs status is in the return code to this process. It is
- * one of:
- * APR_CHILD_DONE -- child is no longer running.
- * APR_CHILD_NOTDONE -- child is still running.
- */
-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 ((stat = waitpid(proc->pid, NULL, WUNTRACED)) > 0) {
- return APR_CHILD_DONE;
- }
- else if (stat == 0) {
- return APR_CHILD_NOTDONE;
- }
- return errno;
- }
- if ((stat = waitpid(proc->pid, NULL, WUNTRACED | WNOHANG)) > 0) {
- return APR_CHILD_DONE;
- }
- else if (stat == 0) {
- return APR_CHILD_NOTDONE;
- }
- return errno;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_os_proc(ap_proc_t *, ap_os_proc_t *)
- * convert the proc from os specific type to apr type.
- * arg 1) The apr proc to converting
- * arg 2) The os specific proc we are converting to
- */
-ap_status_t ap_get_os_proc(ap_proc_t *proc, ap_os_proc_t *theproc)
-{
- if (proc == NULL) {
- return APR_ENOPROC;
- }
- theproc = &(proc->pid);
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_put_os_proc(ap_context_t *, ap_proc_t *, ap_os_proc_t *)
- * convert the proc from os specific type to apr type.
- * arg 1) The context to use if it is needed.
- * arg 2) The apr proc we are converting to.
- * arg 3) The os specific proc to convert
- */
-ap_status_t ap_put_os_proc(ap_context_t *cont, struct proc_t **proc,
- ap_os_proc_t *theproc)
-{
- if (cont == NULL) {
- return APR_ENOCONT;
- }
- if ((*proc) == NULL) {
- (*proc) = (struct proc_t *)ap_palloc(cont, sizeof(struct proc_t));
- (*proc)->cntxt = cont;
- }
- (*proc)->pid = *theproc;
- return APR_SUCCESS;
-}
-
diff --git a/threadproc/unix/procsup.c b/threadproc/unix/procsup.c
deleted file mode 100644
index ddf6020e7..000000000
--- a/threadproc/unix/procsup.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1999 The Apache Group. 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. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" 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 names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``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 GROUP 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 Group.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- */
-
-#include "threadproc.h"
-#include "fileio.h"
-
-#include "apr_config.h"
-#include "apr_thread_proc.h"
-#include "apr_file_io.h"
-#include "apr_general.h"
-#include "apr_lib.h"
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_detach(ap_context_t *, ap_proc_t *)
- * Detach the process from the controlling terminal.
- * arg 1) The context to use if it is needed.
- * arg 2) The new process handler
- */
-ap_status_t ap_detach(ap_context_t *cont, struct proc_t **new)
-{
- int x;
-
- (*new) = (struct proc_t *)ap_palloc(cont, sizeof(struct proc_t));
- (*new)->cntxt = cont;
- (*new)->attr = NULL;
-
- chdir("/");
-#if !defined(MPE) && !defined(OS2) && !defined(TPF)
-/* Don't detach for MPE because child processes can't survive the death of
- the parent. */
- if ((x = fork()) > 0)
- exit(0);
- else if (x == -1) {
- perror("fork");
- fprintf(stderr, "unable to fork new process\n");
- exit(1); /* we can't do anything here, so just exit. */
- }
-/* RAISE_SIGSTOP(DETACH);*/
-#endif
-#if HAVE_SETSID
- if (((*new)->pid = setsid()) == -1) {
- return errno;
- }
-#elif defined(NEXT) || defined(NEWSOS)
- if (setpgrp(0, getpid()) == -1 || ((*new)->pid = getpgrp(0)) == -1) {
- return errno;
- }
-#elif defined(OS2) || defined(TPF)
- /* OS/2 don't support process group IDs */
- (*new)->pid = getpid();
-#elif defined(MPE)
- /* MPE uses negative pid for process group */
- (*new)->pid = -getpid();
-#else
- if (((*new)->pid = setpgrp(getpid(), 0)) == -1) {
- return errno;
- }
-#endif
-
- /* close out the standard file descriptors */
- if (freopen("/dev/null", "r", stdin) == NULL) {
- return APR_ALLSTD;
- /* continue anyhow -- note we can't close out descriptor 0 because we
- * have nothing to replace it with, and if we didn't have a descriptor
- * 0 the next file would be created with that value ... leading to
- * havoc.
- */
- }
- if (freopen("/dev/null", "w", stdout) == NULL) {
- return APR_STDOUT;
- }
- /* We are going to reopen this again in a little while to the error
- * log file, but better to do it twice and suffer a small performance
- * hit for consistancy than not reopen it here.
- */
- if (freopen("/dev/null", "w", stderr) == NULL) {
- return APR_STDERR;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_procdata(ap_proc_t *, void *)
- * Return the context associated with the current proc.
- * arg 1) The currently open proc.
- * arg 2) The user data associated with the proc.
- */
-ap_status_t ap_get_procdata(struct proc_t *proc, void *data)
-{
- if (proc != NULL) {
- return ap_get_userdata(proc->cntxt, &data);
- }
- else {
- data = NULL;
- return APR_ENOPROC;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_set_procdata(ap_proc_t *, void *)
- * Return the context associated with the current proc.
- * arg 1) The currently open proc.
- * arg 2) The user data to associate with the proc.
-*/
-ap_status_t ap_set_procdata(struct proc_t *proc, void *data)
-{
- if (proc != NULL) {
- return ap_set_userdata(proc->cntxt, data);
- }
- else {
- data = NULL;
- return APR_ENOPROC;
- }
-}
-
diff --git a/threadproc/unix/signals.c b/threadproc/unix/signals.c
deleted file mode 100644
index 529dcad8d..000000000
--- a/threadproc/unix/signals.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1999 The Apache Group. 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. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" 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 names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``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 GROUP 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 Group.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- */
-
-#include "threadproc.h"
-#include "fileio.h"
-#include "apr_thread_proc.h"
-#include "apr_file_io.h"
-#include "apr_general.h"
-#include <signal.h>
-#include <string.h>
-#include <sys/wait.h>
-
-ap_status_t ap_kill(struct proc_t *proc, int signal)
-{
- if (kill(proc->pid, signal) == -1) {
- return errno;
- }
- return APR_SUCCESS;
-}
-
diff --git a/threadproc/unix/thread.c b/threadproc/unix/thread.c
deleted file mode 100644
index d79359a0b..000000000
--- a/threadproc/unix/thread.c
+++ /dev/null
@@ -1,364 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1999 The Apache Group. 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. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" 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 names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``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 GROUP 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 Group.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- */
-
-#include "threadproc.h"
-#include "apr_thread_proc.h"
-#include "apr_general.h"
-#include "apr_portable.h"
-
-#ifdef HAVE_PTHREAD_H
-/* ***APRDOC********************************************************
- * ap_status_t ap_create_threadattr(ap_context_t *, ap_threadattr_t **)
- * Create and initialize a new threadattr variable
- * arg 1) The context to use
- * arg 2) The newly created threadattr.
- */
-ap_status_t ap_create_threadattr(ap_context_t *cont, struct threadattr_t **new)
-{
- ap_status_t stat;
-
- (*new) = (struct threadattr_t *)ap_palloc(cont,
- sizeof(struct threadattr_t));
- (*new)->attr = (pthread_attr_t *)ap_palloc(cont,
- sizeof(pthread_attr_t));
-
- if ((*new) == NULL || (*new)->attr == NULL) {
- return APR_ENOMEM;
- }
-
- (*new)->cntxt = cont;
- stat = pthread_attr_init((*new)->attr);
-
- if (stat == 0) {
- return APR_SUCCESS;
- }
- return stat;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_setthreadattr_detach(ap_threadattr_t *, ap_int32_t)
- * Set if newly created threads should be created in detach mode.
- * arg 1) The threadattr to affect
- * arg 2) Thread detach state on or off
- */
-ap_status_t ap_setthreadattr_detach(struct threadattr_t *attr, ap_int32_t on)
-{
- ap_status_t stat;
- if ((stat = pthread_attr_setdetachstate(attr->attr, on)) == 0) {
- return APR_SUCCESS;
- }
- else {
- return stat;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_getthreadattr_detach(ap_threadattr_t *, ap_int32_t *)
- * Get the detach mode for this threadattr.
- * arg 1) The threadattr to reference
- * arg 2) Thread detach state on or off
- */
-ap_status_t ap_getthreadattr_detach(struct threadattr_t *attr)
-{
- int state;
-
- pthread_attr_getdetachstate(attr->attr, &state);
- if (state == 1)
- return APR_DETACH;
- return APR_NOTDETACH;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_create_thread(ap_context_t *, ap_threadattr_t *,
- * ap_thread_start_t, coid *, ap_thread_t **)
- * Create a new thread of execution
- * arg 1) The context to use
- * arg 2) The threadattr to use to determine how to create the thread
- * arg 3) The function to start the new thread in
- * arg 4) Any data to be passed to the starting function
- * arg 5) The newly created thread handle.
- */
-ap_status_t ap_create_thread(ap_context_t *cont, struct threadattr_t *attr,
- ap_thread_start_t func, void *data,
- struct thread_t **new)
-{
- ap_status_t stat;
- pthread_attr_t *temp;
-
- (*new) = (struct thread_t *)ap_palloc(cont, sizeof(struct thread_t));
-
- if ((*new) == NULL) {
- return APR_ENOMEM;
- }
-
- (*new)->td = (pthread_t *)ap_palloc(cont, sizeof(pthread_t));
-
- if ((*new)->td == NULL) {
- return APR_ENOMEM;
- }
-
- (*new)->cntxt = cont;
-
- if (attr)
- temp = attr->attr;
- else
- temp = NULL;
-
- stat = ap_create_context(cont, NULL, &(*new)->cntxt);
- if (stat != APR_SUCCESS) {
- return stat;
- }
-
- if ((stat = pthread_create((*new)->td, temp, func, data)) == 0) {
- return APR_SUCCESS;
- }
- else {
- return stat;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_thread_exit(ap_thread_t *, ap_status_t *)
- * stop the current thread
- * arg 1) The thread to stop
- * arg 2) The return value to pass back to any thread that cares
- */
-ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval)
-{
- ap_destroy_pool(thd->cntxt);
- pthread_exit(retval);
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_thread_join(ap_thread_t *, ap_status_t *)
- * block until the desired thread stops executing.
- * arg 1) The thread to join
- * arg 2) The return value from the dead thread.
- */
-ap_status_t ap_thread_join(struct thread_t *thd, ap_status_t *retval)
-{
- ap_status_t stat;
-
- if ((stat = pthread_join(*thd->td,(void *)&retval)) == 0) {
- return APR_SUCCESS;
- }
- else {
- return stat;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_thread_detach(ap_thread_t *)
- * detach a thread
- * arg 1) The thread to detach
- */
-ap_status_t ap_thread_detach(struct thread_t *thd)
-{
- ap_status_t stat;
-
- if ((stat = pthread_detach(*thd->td)) == 0) {
- return APR_SUCCESS;
- }
- else {
- return stat;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_threaddata(ap_thread_t *, void *)
- * Return the context associated with the current thread.
- * arg 1) The currently open thread.
- * arg 2) The user data associated with the thread.
- */
-ap_status_t ap_get_threaddata(struct thread_t *thread, void *data)
-{
- if (thread != NULL) {
- return ap_get_userdata(thread->cntxt, &data);
- }
- else {
- data = NULL;
- return APR_ENOTHREAD;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_set_threaddata(ap_thread_t *, void *)
- * Return the context associated with the current thread.
- * arg 1) The currently open thread.
- * arg 2) The user data to associate with the thread.
- */
-ap_status_t ap_set_threaddata(struct thread_t *thread, void *data)
-{
- if (thread != NULL) {
- return ap_set_userdata(thread->cntxt, data);
- }
- else {
- data = NULL;
- return APR_ENOTHREAD;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_os_thread(ap_thread_t *, ap_os_thread_t *)
- * convert the thread to os specific type from apr type.
- * arg 1) The apr thread to convert
- * arg 2) The os specific thread we are converting to
- */
-ap_status_t ap_get_os_thread(struct thread_t *thd, ap_os_thread_t *thethd)
-{
- if (thd == NULL) {
- return APR_ENOTHREAD;
- }
- thethd = thd->td;
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_put_os_thread(ap_context_t *, ap_thread_t *, ap_os_thread_t *)
- * convert the thread from os specific type to apr type.
- * arg 1) The context to use if it is needed.
- * arg 2) The apr thread we are converting to.
- * arg 3) The os specific thread to convert
- */
-ap_status_t ap_put_os_thread(ap_context_t *cont, struct thread_t **thd,
- ap_os_thread_t *thethd)
-{
- if (cont == NULL) {
- return APR_ENOCONT;
- }
- if ((*thd) == NULL) {
- (*thd) = (struct thread_t *)ap_palloc(cont, sizeof(struct thread_t));
- (*thd)->cntxt = cont;
- }
- (*thd)->td = thethd;
- return APR_SUCCESS;
-}
-#else
- /* No pthread.h, no threads for right now.*/
-ap_status_t ap_create_threadattr(ap_context_t *cont, struct threadattr_t **new)
-{
- *new = NULL;
- return APR_SUCCESS;
-}
-
-ap_status_t ap_setthreadattr_detach(struct threadattr_t *attr, ap_int32_t on)
-{
- return APR_SUCCESS;
-}
-
-ap_status_t ap_getthreadattr_detach(struct threadattr_t *attr)
-{
- return APR_NOTDETACH;
-}
-
-ap_status_t ap_create_thread(ap_context_t *cont, struct threadattr_t *attr,
- ap_thread_start_t func, void *data,
- struct thread_t **new)
-{
- *new = NULL;
- return stat;
-}
-
-ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval)
-{
- APR_SUCCESS;
-}
-
-ap_status_t ap_thread_join(struct thread_t *thd, ap_status_t *retval)
-{
- return APR_SUCCESS;
-}
-
-ap_status_t ap_thread_detach(struct thread_t *thd)
-{
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_threaddata(ap_thread_t *, void *)
- * Return the context associated with the current thread.
- * arg 1) The currently open thread.
- * arg 2) The user data associated with the thread.
- */
-ap_status_t ap_get_threaddata(struct thread_t *thread, void *data)
-{
- data = NULL;
- return APR_ENOTHREAD;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_set_threaddata(ap_thread_t *, void *)
- * Return the context associated with the current thread.
- * arg 1) The currently open thread.
- * arg 2) The user data to associate with the thread.
- */
-ap_status_t ap_set_threaddata(struct thread_t *thread, void *data)
-{
- return APR_ENOTHREAD;
-}
-
-ap_status_t ap_get_os_thread(struct thread_t *thd, ap_os_thread_t *thethd)
-{
- thethd = NULL;
- return APR_SUCCESS;
-}
-
-ap_status_t ap_put_os_thread(ap_context_t *cont, struct thread_t **thd,
- ap_os_thread_t *thethd)
-{
- return APR_SUCCESS;
-}
-#endif
-
diff --git a/threadproc/unix/threadcancel.c b/threadproc/unix/threadcancel.c
deleted file mode 100644
index b6b5104fb..000000000
--- a/threadproc/unix/threadcancel.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1999 The Apache Group. 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. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" 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 names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``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 GROUP 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 Group.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- */
-
-#include "threadproc.h"
-#include "apr_thread_proc.h"
-#include "apr_general.h"
-
-#ifdef HAVE_PTHREAD_H
-/* ***APRDOC********************************************************
- * ap_status_t ap_cancel_thread(ap_thread_t *)
- * Asynchronously kill a thread
- * arg 1) The thread to kill.
- */
-ap_status_t ap_cancel_thread(struct thread_t *thd)
-{
- ap_status_t stat;
- if ((stat = pthread_cancel(*thd->td)) == 0) {
- return APR_SUCCESS;
- }
- else {
- return stat;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_setcanceltype(ap_context_t *, ap_int32_t)
- * Determine how threads are cancelable.
- * arg 1) The context to operate on
- * arg 2) how are threads cancelable. One of:
- * APR_CANCEL_ASYNCH -- cancel it no matter where it is
- * APR_CANCEL_DEFER -- only cancel the thread if it is safe.
- */
-ap_status_t ap_setcanceltype(ap_context_t *cont, ap_int32_t type)
-{
- ap_status_t stat;
- if ((stat = pthread_setcanceltype(type, NULL)) == 0) {
- return APR_SUCCESS;
- }
- else {
- return stat;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_setcancelstate(ap_context_t *, ap_int32_t)
- * Determine if threads will be cancelable.
- * arg 1) The context to operate on
- * arg 2) Are threads cancelable.
- */
-ap_status_t ap_setcancelstate(ap_context_t *cont, ap_int32_t type)
-{
- ap_status_t stat;
- if ((stat = pthread_setcanceltype(type, NULL)) == 0) {
- return APR_SUCCESS;
- }
- else {
- return stat;
- }
-}
-#else
-ap_status_t ap_cancel_thread(struct thread_t *thd)
-{
- return APR_SUCCESS;
-}
-
-ap_status_t ap_setcanceltype(ap_context_t *cont, ap_int32_t type)
-{
- return APR_SUCCESS;
-}
-
-ap_status_t ap_setcancelstate(ap_context_t *cont, ap_int32_t type)
-{
- return APR_SUCCESS;
-}
-#endif
-
diff --git a/threadproc/unix/threadpriv.c b/threadproc/unix/threadpriv.c
deleted file mode 100644
index eaa4a348d..000000000
--- a/threadproc/unix/threadpriv.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1999 The Apache Group. 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. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" 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 names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``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 GROUP 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 Group.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- */
-
-#include "threadproc.h"
-#include "apr_thread_proc.h"
-#include "apr_general.h"
-#include "apr_errno.h"
-#include "apr_portable.h"
-
-#ifdef HAVE_PTHREAD_H
-/* ***APRDOC********************************************************
- * ap_status_t ap_create_thread_private(ap_context_t *, void *(void *),
- * ap_key_t)
- * Create and initialize a new thread private address space
- * arg 1) The context to use
- * arg 2) The destructor to use when freeing the private memory.
- * arg 3) The thread private handle.
- */
-ap_status_t ap_create_thread_private(ap_context_t *cont, void (*dest)(void *),
- struct threadkey_t **key)
-{
- ap_status_t stat;
- (*key) = (struct threadkey_t *)ap_palloc(cont, sizeof(struct threadkey_t));
-
- if ((*key) == NULL) {
- return APR_ENOMEM;
- }
-
- (*key)->cntxt = cont;
-
- if ((stat = pthread_key_create(&(*key)->key, dest)) == 0) {
- return stat;
- }
- return stat;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_thread_private(ap_key_t *, void **)
- * Get a pointer to the thread private memory
- * arg 1) The handle for the desired thread private memory
- * arg 2) The data stored in private memory
- */
-ap_status_t ap_get_thread_private(struct threadkey_t *key, void **new)
-{
- (*new) = pthread_getspecific(key->key);
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_set_thread_private(ap_key_t *, void *)
- * Set the data to be stored in thread private memory
- * arg 1) The handle for the desired thread private memory
- * arg 2) The data to be stored in private memory
- */
-ap_status_t ap_set_thread_private(struct threadkey_t *key, void *priv)
-{
- ap_status_t stat;
- if ((stat = pthread_setspecific(key->key, priv)) == 0) {
- return APR_SUCCESS;
- }
- else {
- return stat;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_delete_thread_private(ap_key_t *)
- * Free the thread private memory
- * arg 1) The handle for the desired thread private memory
- */
-ap_status_t ap_delete_thread_private(struct threadkey_t *key)
-{
- ap_status_t stat;
- if ((stat = pthread_key_delete(key->key)) == 0) {
- return APR_SUCCESS;
- }
- return stat;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_threadkeydata(ap_threadkey_t *, void *)
- * Return the context associated with the current threadkey.
- * arg 1) The currently open threadkey.
- * arg 2) The user data associated with the threadkey.
- */
-ap_status_t ap_get_threadkeydata(struct threadkey_t *threadkey, void *data)
-{
- if (threadkey != NULL) {
- return ap_get_userdata(threadkey->cntxt, &data);
- }
- else {
- data = NULL;
- return APR_ENOTHDKEY;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_set_threadkeydata(ap_threadkey_t *, void *)
- * Return the context associated with the current threadkey.
- * arg 1) The currently open threadkey.
- * arg 2) The user data to associate with the threadkey.
- */
-ap_status_t ap_set_threadkeydata(struct threadkey_t *threadkey, void *data)
-{
- if (threadkey != NULL) {
- return ap_set_userdata(threadkey->cntxt, data);
- }
- else {
- data = NULL;
- return APR_ENOTHDKEY;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_os_threadkey(ap_key_t *, ap_os_threadkey_t *)
- * convert the thread private memory key to os specific type
- * from an apr type.
- * arg 1) The apr handle we are converting from.
- * arg 2) The os specific handle we are converting to.
- */
-ap_status_t ap_get_os_threadkey(struct threadkey_t *key, ap_os_threadkey_t *thekey)
-{
- if (key == NULL) {
- return APR_ENOFILE;
- }
- thekey = &(key->key);
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_put_os_threadkey(ap_context_t *, ap_key_t *,
- * ap_os_threadkey_t *)
- * convert the thread private memory key from os specific type to apr type.
- * arg 1) The context to use if it is needed.
- * arg 2) The apr handle we are converting to.
- * arg 3) The os specific handle to convert
- */
-ap_status_t ap_put_os_threadkey(ap_context_t *cont, struct threadkey_t **key,
- ap_os_threadkey_t *thekey)
-{
- if (cont == NULL) {
- return APR_ENOCONT;
- }
- if ((*key) == NULL) {
- (*key) = (struct threadkey_t *)ap_palloc(cont, sizeof(struct threadkey_t));
- (*key)->cntxt = cont;
- }
- (*key)->key = *thekey;
- return APR_SUCCESS;
-}
-#else
-ap_status_t ap_create_thread_private(ap_context_t *cont, void (*dest)(void *),
- struct threadkey_t **key)
-{
- *key = NULL;
- return APR_SUCCESS;
-}
-
-ap_status_t ap_get_thread_private(struct threadkey_t *key, void **new)
-{
- (*new) = NULL;
- return APR_SUCCESS;
-}
-
-ap_status_t ap_set_thread_private(struct threadkey_t *key, void *priv)
-{
- return APR_SUCCESS;
-}
-
-ap_status_t ap_delete_thread_private(struct threadkey_t *key)
-{
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_threadkeydata(ap_threadkey_t *, void *)
- * Return the context associated with the current threadkey.
- * arg 1) The currently open threadkey.
- * arg 2) The user data associated with the threadkey.
- */
-ap_status_t ap_get_threadkeydata(struct threadkey_t *threadkey, void *data)
-{
- return APR_SUCCESS;
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_set_threadkeydata(ap_threadkey_t *, void *)
- * Return the context associated with the current threadkey.
- * arg 1) The currently open threadkey.
- * arg 2) The user data to associate with the threadkey.
- */
-ap_status_t ap_set_threadkeydata(struct threadkey_t *threadkey, void *data)
-{
- return APR_SUCCESS;
-}
-
-ap_status_t ap_get_os_threadkey(struct threadkey_t *key, ap_os_threadkey_t *thekey)
-{
- thekey = NULL;
- return APR_SUCCESS;
-}
-
-ap_status_t ap_put_os_threadkey(ap_context_t *cont, struct threadkey_t **key,
- ap_os_threadkey_t *thekey)
-{
- return APR_SUCCESS;
-}
-#endif
diff --git a/threadproc/unix/threadproc.h b/threadproc/unix/threadproc.h
deleted file mode 100644
index fc9755011..000000000
--- a/threadproc/unix/threadproc.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* ====================================================================
- * Copyright (c) 1999 The Apache Group. 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. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * 4. The names "Apache Server" and "Apache Group" 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 names without prior written
- * permission of the Apache Group.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Apache Group
- * for use in the Apache HTTP server project (http://www.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``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 GROUP 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 Group.
- * For more information on the Apache Group and the Apache HTTP server
- * project, please see <http://www.apache.org/>.
- *
- */
-
-#include "apr_thread_proc.h"
-#include "apr_file_io.h"
-#include <pthread.h>
-
-#ifndef THREAD_PROC_H
-#define THREAD_PROC_H
-
-#define SHELL_PATH "/bin/sh"
-
-struct thread_t {
- ap_context_t *cntxt;
- pthread_t *td;
-};
-
-struct threadattr_t {
- ap_context_t *cntxt;
- pthread_attr_t *attr;
-};
-
-struct threadkey_t {
- ap_context_t *cntxt;
- pthread_key_t key;
-};
-
-struct procattr_t {
- ap_context_t *cntxt;
- ap_file_t *parent_in;
- ap_file_t *child_in;
- ap_file_t *parent_out;
- ap_file_t *child_out;
- ap_file_t *parent_err;
- ap_file_t *child_err;
- char *currdir;
- ap_int32_t cmdtype;
- ap_int32_t detached;
-};
-
-struct proc_t {
- ap_context_t *cntxt;
- pid_t pid;
- struct procattr_t *attr;
-};
-
-/*This will move to apr_threadproc.h in time, but I need to figure it out
- * on windows first. :)
- */
-ap_status_t ap_detach(ap_context_t *, struct proc_t **);
-
-#endif /* ! THREAD_PROC_H */
-