diff options
Diffstat (limited to 'threadproc/win32')
-rw-r--r-- | threadproc/win32/proc.c | 384 | ||||
-rw-r--r-- | threadproc/win32/signals.c | 75 | ||||
-rw-r--r-- | threadproc/win32/thread.c | 203 | ||||
-rw-r--r-- | threadproc/win32/threadcancel.c | 87 | ||||
-rw-r--r-- | threadproc/win32/threadpriv.c | 138 | ||||
-rw-r--r-- | threadproc/win32/threadproc.def | 39 | ||||
-rw-r--r-- | threadproc/win32/threadproc.dsp | 119 | ||||
-rw-r--r-- | threadproc/win32/threadproc.h | 105 |
8 files changed, 0 insertions, 1150 deletions
diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c deleted file mode 100644 index 50c454a35..000000000 --- a/threadproc/win32/proc.c +++ /dev/null @@ -1,384 +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 <stdlib.h> -#include <signal.h> -#include <string.h> -#include <process.h> - -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; - (*new)->detached = TRUE; - - memset(&(*new)->si, 0, sizeof((*new)->si)); - - return APR_SUCCESS; -} - -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; -} - -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; -} - -ap_status_t ap_setprocattr_cmdtype(struct procattr_t *attr, - ap_cmdtype_e cmd) -{ - attr->cmdtype = cmd; - return APR_SUCCESS; -} - -ap_status_t ap_setprocattr_detach(struct procattr_t *attr, - ap_int32_t det) -{ - attr->detached = det; - return APR_SUCCESS; -} - -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, iEnvBlockLen; - char *cmdline; - HANDLE hCurrentProcess; - HANDLE hParentindup, hParentoutdup,hParenterrdup; - char ppid[20]; - char *envstr; - char *pEnvBlock, *pNext; - - - - (*new) = (struct proc_t *)ap_palloc(cont, sizeof(struct proc_t)); - - if ((*new) == NULL) { - return APR_ENOMEM; - } - - (*new)->cntxt = cont; - (*new)->attr = attr; - - attr->si.cb = sizeof(attr->si); - if (attr->detached) { - /* If we are creating ourselves detached, Then we should hide the - * window we are starting in. And we had better redfine our - * handles for STDIN, STDOUT, and STDERR. - */ - attr->si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; - attr->si.wShowWindow = SW_HIDE; - - if (attr->child_in) { - attr->si.hStdInput = attr->child_in->filehand; - } - - if (attr->child_out) { - attr->si.hStdOutput = attr->child_out->filehand; - } - - if (attr->child_err) { - attr->si.hStdError = attr->child_err->filehand; - } - } - - cmdline = args[0]; - i = 1; - while (args[i]) { - cmdline = ap_pstrcat(cont, cmdline, " ", args[i], NULL); - i++; - } - /* - * When the pipe handles are created, the security descriptor - * indicates that the handle can be inherited. However, we do not - * want the server side handles to the pipe to be inherited by the - * child CGI process. If the child CGI does inherit the server - * side handles, then the child may be left around if the server - * closes its handles (e.g. if the http connection is aborted), - * because the child will have a valid copy of handles to both - * sides of the pipes, and no I/O error will occur. Microsoft - * recommends using DuplicateHandle to turn off the inherit bit - * under NT and Win95. - */ - hCurrentProcess = GetCurrentProcess(); - if ((attr->child_in && !DuplicateHandle(hCurrentProcess, attr->parent_in->filehand, - hCurrentProcess, - &hParentindup, 0, FALSE, - DUPLICATE_SAME_ACCESS)) - || (attr->child_out && !DuplicateHandle(hCurrentProcess, attr->parent_out->filehand, - hCurrentProcess, &hParentoutdup, - 0, FALSE, DUPLICATE_SAME_ACCESS)) - || (attr->child_err && !DuplicateHandle(hCurrentProcess, attr->parent_err->filehand, - hCurrentProcess, &hParenterrdup, - 0, FALSE, DUPLICATE_SAME_ACCESS))) { - if (attr->child_in) { - ap_close(attr->child_in); - ap_close(attr->parent_in); - } - if (attr->child_out) { - ap_close(attr->child_out); - ap_close(attr->parent_out); - } - if (attr->child_err) { - ap_close(attr->child_err); - ap_close(attr->parent_err); - } - return APR_EEXIST; - } - else { - if (attr->child_in) { - ap_close(attr->parent_in); - attr->parent_in->filehand = hParentindup; - } - if (attr->child_out) { - ap_close(attr->parent_out); - attr->parent_out->filehand = hParentoutdup; - } - if (attr->child_err) { - ap_close(attr->parent_err); - attr->parent_err->filehand = hParenterrdup; - } - } - - _itoa(_getpid(), ppid, 10); - if (env) { - - envstr = ap_pstrcat(cont, "parentpid=", ppid, NULL); - /* - * Win32's CreateProcess call requires that the environment - * be passed in an environment block, a null terminated block of - * null terminated strings. - */ - i = 0; - iEnvBlockLen = 1; - while (env[i]) { - iEnvBlockLen += strlen(env[i]) + 1; - i++; - } - - pEnvBlock = (char *)ap_pcalloc(cont, iEnvBlockLen + strlen(envstr)); - - i = 0; - pNext = pEnvBlock; - while (env[i]) { - strcpy(pNext, env[i]); - pNext = pNext + strlen(pNext) + 1; - i++; - } - strcpy(pNext, envstr); - } - else { - SetEnvironmentVariable("parentpid", ppid); - pEnvBlock = NULL; - } - - - if (CreateProcess(NULL, cmdline, NULL, NULL, TRUE, 0, pEnvBlock, attr->currdir, - &attr->si, &(*new)->pi)) { - if (attr->detached) { - CloseHandle((*new)->pi.hProcess); - } - 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); - } - CloseHandle((*new)->pi.hThread); - return APR_SUCCESS; - } - - return GetLastError(); -} - -ap_status_t ap_get_childin(struct proc_t *proc, ap_file_t **new) -{ - (*new) = proc->attr->parent_in; - return APR_SUCCESS; -} - -ap_status_t ap_get_childout(struct proc_t *proc, ap_file_t **new) -{ - (*new) = proc->attr->parent_out; - return APR_SUCCESS; -} - -ap_status_t ap_get_childerr(struct proc_t *proc, ap_file_t **new) -{ - (*new) = proc->attr->parent_err; - return APR_SUCCESS; -} - -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 = WaitForSingleObject(proc->pi.hProcess, INFINITE)) == WAIT_OBJECT_0) { - return APR_CHILD_DONE; - } - else if (stat == WAIT_TIMEOUT) { - return APR_CHILD_NOTDONE; - } - return APR_EEXIST; - } - if ((stat = WaitForSingleObject(proc->pi.hProcess, 0)) == WAIT_OBJECT_0) { - return APR_CHILD_DONE; - } - else if (stat == WAIT_TIMEOUT) { - return APR_CHILD_NOTDONE; - } - return APR_EEXIST; -} - -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; - } -} - -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; - } -} - -ap_status_t ap_get_os_proc(ap_proc_t *proc, ap_os_proc_t *theproc) -{ - if (proc == NULL) { - return APR_ENOPROC; - } - theproc = &(proc->pi); - return APR_SUCCESS; -} - -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)->pi = *theproc; - return APR_SUCCESS; -} diff --git a/threadproc/win32/signals.c b/threadproc/win32/signals.c deleted file mode 100644 index 9aefad4d6..000000000 --- a/threadproc/win32/signals.c +++ /dev/null @@ -1,75 +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> -#ifdef HAVE_SYS_WAIT -#include <sys/wait.h> -#endif - -/* Windows only really support killing process, but that will do for now. */ -ap_status_t ap_kill(struct proc_t *proc, int signal) -{ - if (TerminateProcess(proc->pi.hProcess, signal) == 0) { - return errno; - } - return APR_SUCCESS; -} - diff --git a/threadproc/win32/thread.c b/threadproc/win32/thread.c deleted file mode 100644 index 79fc083cb..000000000 --- a/threadproc/win32/thread.c +++ /dev/null @@ -1,203 +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_win.h" -#include "threadproc.h" -#include "apr_thread_proc.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" -#include <process.h> - - -ap_status_t ap_create_threadattr(ap_context_t *cont, struct threadattr_t **new) -{ - (*new) = (struct threadattr_t *)ap_palloc(cont, - sizeof(struct threadattr_t)); - - if ((*new) == NULL) { - return APR_ENOMEM; - } - - (*new)->cntxt = cont; - return APR_SUCCESS; -} - -ap_status_t ap_setthreadattr_detach(struct threadattr_t *attr, ap_int32_t on) -{ - attr->detach = on; - return APR_SUCCESS; -} - -ap_status_t ap_getthreadattr_detach(struct threadattr_t *attr) -{ - if (attr->detach == 1) - return APR_DETACH; - 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) -{ - ap_status_t stat; - unsigned temp; - int lasterror; - - (*new) = (struct thread_t *)ap_palloc(cont, sizeof(struct thread_t)); - - if ((*new) == NULL) { - return APR_ENOMEM; - } - - (*new)->cntxt = cont; - - stat = ap_create_context(cont, NULL, &(*new)->cntxt); - if (stat != APR_SUCCESS) { - return stat; - } - - /* Use 0 for Thread Stack Size, because that will default the stack to the - * same size as the calling thread. - */ - if (((*new)->td = (HANDLE *)_beginthreadex(NULL, 0, (unsigned int (API_THREAD_FUNC *)(void *))func, - data, 0, &temp)) == 0) { - lasterror = GetLastError(); - return APR_EEXIST; - } - - if (attr && attr->detach) { - CloseHandle((*new)->td); - } - - return APR_SUCCESS; -} - -ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval) -{ - ap_destroy_pool(thd->cntxt); - _endthreadex(*retval); - return APR_SUCCESS; -} - -ap_status_t ap_thread_join(struct thread_t *thd, ap_status_t *retval) -{ - ap_status_t stat; - - if ((stat = WaitForSingleObject(thd->td, INFINITE)) == WAIT_OBJECT_0) { - if (GetExitCodeThread(thd->td, retval) == 0) { - return APR_SUCCESS; - } - return APR_EEXIST; - } - else { - return stat; - } -} - -ap_status_t ap_thread_detach(struct thread_t *thd) -{ - if (CloseHandle(thd->td)) { - return APR_SUCCESS; - } - else { - return APR_EEXIST; - } -} - -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; - } -} - -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; - } -} - -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; -} - -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; -} - diff --git a/threadproc/win32/threadcancel.c b/threadproc/win32/threadcancel.c deleted file mode 100644 index a1e4d8ea1..000000000 --- a/threadproc/win32/threadcancel.c +++ /dev/null @@ -1,87 +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" - - -ap_status_t ap_cancel_thread(struct thread_t *thd) -{ - if (TerminateThread(thd->td, APR_SUCCESS) == 0) { - return APR_EEXIST; - } - else { - return APR_SUCCESS; - } -} - -/* Not sure of the best way to do this just yet. -ap_status_t ap_setcanceltype(ap_context_t *cont, ap_int32_t type) -{ - -} - -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; - } -} -*/ diff --git a/threadproc/win32/threadpriv.c b/threadproc/win32/threadpriv.c deleted file mode 100644 index a6b7813d4..000000000 --- a/threadproc/win32/threadpriv.c +++ /dev/null @@ -1,138 +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_lib.h" -#include "apr_errno.h" -#include "apr_portable.h" - -ap_status_t ap_create_thread_private(ap_context_t *cont, void (*dest)(void *), - struct threadkey_t **key) -{ - (*key)->key = TlsAlloc(); - return APR_SUCCESS; -} - -ap_status_t ap_get_thread_private(struct threadkey_t *key, void **new) -{ - if ((*new) = TlsGetValue(key->key)) { - return APR_SUCCESS; - } - return APR_EEXIST; -} - -ap_status_t ap_set_thread_private(struct threadkey_t *key, void *priv) -{ - if (TlsSetValue(key->key, priv)) { - return APR_SUCCESS; - } - return APR_EEXIST; -} - -ap_status_t ap_delete_thread_private(struct threadkey_t *key) -{ - if (TlsFree(key->key)) { - return APR_SUCCESS; - } - return APR_EEXIST; -} - -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; - } -} - -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; - } -} - -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; -} - -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; -} - diff --git a/threadproc/win32/threadproc.def b/threadproc/win32/threadproc.def deleted file mode 100644 index 5a6e12bb9..000000000 --- a/threadproc/win32/threadproc.def +++ /dev/null @@ -1,39 +0,0 @@ -; threadproc.def : - -LIBRARY threadproc -DESCRIPTION '' - -EXPORTS - ; Add new API calls to the end of this list. - ap_createprocattr_init @1 - ap_setprocattr_io @2 - ap_setprocattr_dir @3 - ap_setprocattr_cmdtype @4 - ap_setprocattr_detach @5 - ap_create_process @6 - ap_get_childin @7 - ap_get_childout @8 - ap_get_childerr @9 - ap_wait_proc @10 - ap_kill @11 - ap_create_threadattr @12 - ap_setthreadattr_detach @13 - ap_getthreadattr_detach @14 - ap_create_thread @15 - ap_thread_exit @16 - ap_thread_join @17 - ap_thread_detach @18 - ap_cancel_thread @19 - ap_create_thread_private @20 - ap_get_thread_private @21 - ap_set_thread_private @22 - ap_delete_thread_private @23 - ap_get_threaddata @24 - ap_set_threaddata @25 - ap_get_threadkeydata @26 - ap_set_threadkeydata @27 - ap_get_procdata @28 - ap_set_procdata @29 - ap_get_os_proc @30 - ap_get_os_thread @31 - ap_get_os_threadkey @32 diff --git a/threadproc/win32/threadproc.dsp b/threadproc/win32/threadproc.dsp deleted file mode 100644 index b4340b31c..000000000 --- a/threadproc/win32/threadproc.dsp +++ /dev/null @@ -1,119 +0,0 @@ -# Microsoft Developer Studio Project File - Name="threadproc" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 5.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=threadproc - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "threadproc.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "threadproc.mak" CFG="threadproc - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "threadproc - Win32 Release" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE "threadproc - Win32 Debug" (based on\ - "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "threadproc - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\..\include ..\..\inc" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 - -!ELSEIF "$(CFG)" == "threadproc - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\include" /I "..\..\file_io\win32" /I "..\..\include" /I "..\..\inc" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "NEED_TLS_SPEC" /YX /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\file_io\win32\Debug\file_io.lib ..\..\lib\Debug\lib.lib ..\..\misc\win32\Debug\misc.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "threadproc - Win32 Release" -# Name "threadproc - Win32 Debug" -# Begin Source File - -SOURCE=.\proc.c -# End Source File -# Begin Source File - -SOURCE=.\signals.c -# End Source File -# Begin Source File - -SOURCE=.\thread.c -# End Source File -# Begin Source File - -SOURCE=.\threadcancel.c -# End Source File -# Begin Source File - -SOURCE=.\threadpriv.c -# End Source File -# Begin Source File - -SOURCE=.\threadproc.def -# End Source File -# Begin Source File - -SOURCE=.\threadproc.h -# End Source File -# End Target -# End Project diff --git a/threadproc/win32/threadproc.h b/threadproc/win32/threadproc.h deleted file mode 100644 index 72d71af1d..000000000 --- a/threadproc/win32/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_win.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include <windows.h> - -#ifndef THREAD_PROC_H -#define THREAD_PROC_H - -#define SHELL_PATH "/bin/sh" - -struct thread_t { - ap_context_t *cntxt; - HANDLE td; - ap_int32_t cancel; - ap_int32_t cancel_how; -}; - -struct threadattr_t { - ap_context_t *cntxt; - ap_int32_t detach; - -}; - -struct threadkey_t { - ap_context_t *cntxt; - DWORD key; - -}; - -struct procattr_t { - ap_context_t *cntxt; - STARTUPINFO si; - 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; - PROCESS_INFORMATION pi; - struct procattr_t *attr; -}; - -#endif /* ! THREAD_PROC_H */ - |