diff options
author | (no author) <(no author)@13f79535-47bb-0310-9956-ffa450edef68> | 2002-02-13 03:17:53 +0000 |
---|---|---|
committer | (no author) <(no author)@13f79535-47bb-0310-9956-ffa450edef68> | 2002-02-13 03:17:53 +0000 |
commit | 255eacbcf0dad32d85bb86bc3e9dbb903daac490 (patch) | |
tree | 19d5c35cd5f607a6d76a363a34a26ce151a27000 | |
parent | 33e2f2595bea66582184615dbc471ef562c549da (diff) | |
download | libapr-APACHE_2_0_32.tar.gz |
This commit was manufactured by cvs2svn to create tagAPACHE_2_0_32
'APACHE_2_0_32'.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/tags/APACHE_2_0_32@62978 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | build/find_apr.m4 | 2 | ||||
-rw-r--r-- | file_io/win32/filedup.c | 21 | ||||
-rw-r--r-- | file_io/win32/filestat.c | 49 | ||||
-rw-r--r-- | file_io/win32/open.c | 6 | ||||
-rw-r--r-- | shmem/os2/shm.c | 2 | ||||
-rw-r--r-- | threadproc/beos/threadcancel.c | 88 | ||||
-rw-r--r-- | threadproc/os2/threadcancel.c | 85 | ||||
-rw-r--r-- | threadproc/win32/thread.c | 21 | ||||
-rw-r--r-- | threadproc/win32/threadcancel.c | 86 |
9 files changed, 39 insertions, 321 deletions
diff --git a/build/find_apr.m4 b/build/find_apr.m4 index e87818638..ef73caca8 100644 --- a/build/find_apr.m4 +++ b/build/find_apr.m4 @@ -82,7 +82,7 @@ build directory, or an apr-config file.]) if test -n "$1"; then apr_temp_abs_srcdir="`cd $1 && pwd`" if test "$apr_found" = "yes" \ - && test "`$apr_config --srcdir`" = "$apr_temp_abs_srcdir"; then + -a "`$apr_config --srcdir`" = "$apr_temp_abs_srcdir"; then dnl the installed apr-config represents our source directory, so dnl pretend we didn't see it and just use our bundled source apr_found="no" diff --git a/file_io/win32/filedup.c b/file_io/win32/filedup.c index f607dc8fa..a5ef11c74 100644 --- a/file_io/win32/filedup.c +++ b/file_io/win32/filedup.c @@ -62,6 +62,9 @@ APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, apr_file_t *old_file, apr_pool_t *p) { +#ifdef _WIN32_WCE + return APR_ENOTIMPL; +#else HANDLE hproc = GetCurrentProcess(); HANDLE newhand = NULL; @@ -83,12 +86,16 @@ APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, apr_pool_cleanup_null); return APR_SUCCESS; +#endif /* !defined(_WIN32_WCE) */ } APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, apr_file_t *old_file, apr_pool_t *p) { +#ifdef _WIN32_WCE + return APR_ENOTIMPL; +#else DWORD stdhandle = -1; HANDLE hproc = GetCurrentProcess(); HANDLE newhand = NULL; @@ -99,13 +106,13 @@ APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, * and close and replace other handles with duped handles. * The os_handle will change, however. */ - if (old_file->filehand == GetStdHandle(STD_ERROR_HANDLE)) { + if (new_file->filehand == GetStdHandle(STD_ERROR_HANDLE)) { stdhandle = STD_ERROR_HANDLE; } - else if (old_file->filehand == GetStdHandle(STD_OUTPUT_HANDLE)) { + else if (new_file->filehand == GetStdHandle(STD_OUTPUT_HANDLE)) { stdhandle = STD_OUTPUT_HANDLE; } - else if (old_file->filehand == GetStdHandle(STD_INPUT_HANDLE)) { + else if (new_file->filehand == GetStdHandle(STD_INPUT_HANDLE)) { stdhandle = STD_INPUT_HANDLE; } @@ -126,12 +133,13 @@ APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, FALSE, DUPLICATE_SAME_ACCESS)) { return apr_get_os_error(); } - if (new_file->filehand) { - CloseHandle(new_file->filehand); - } newflags = old_file->flags & ~APR_INHERIT; } + if (new_file->filehand && (new_file->filehand != INVALID_HANDLE_VALUE)) { + CloseHandle(new_file->filehand); + } + new_file->flags = newflags; new_file->filehand = newhand; new_file->fname = apr_pstrdup(new_file->cntxt, old_file->fname); @@ -139,5 +147,6 @@ APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, new_file->buffered = FALSE; return APR_SUCCESS; +#endif /* !defined(_WIN32_WCE) */ } diff --git a/file_io/win32/filestat.c b/file_io/win32/filestat.c index 43a2a73cb..fca7e1b46 100644 --- a/file_io/win32/filestat.c +++ b/file_io/win32/filestat.c @@ -622,52 +622,5 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, apr_fileattrs_t attributes, apr_pool_t *cont) { - DWORD flags; - apr_status_t rv; -#if APR_HAS_UNICODE_FS - apr_wchar_t wfname[APR_PATH_MAX]; -#endif - -#if APR_HAS_UNICODE_FS - IF_WIN_OS_IS_UNICODE - { - if (rv = utf8_to_unicode_path(wfname, - sizeof(wfname) / sizeof(wfname[0]), - fname)) - return rv; - flags = GetFileAttributesW(wfname); - } -#endif -#if APR_HAS_ANSI_FS - ELSE_WIN_OS_IS_ANSI - { - flags = GetFileAttributesA(fname); - } -#endif - - if (flags == 0xFFFFFFFF) - return apr_get_os_error(); - - if (attributes & APR_FILE_ATTR_READONLY) - flags |= FILE_ATTRIBUTE_READONLY; - else - flags &= !FILE_ATTRIBUTE_READONLY; - -#if APR_HAS_UNICODE_FS - IF_WIN_OS_IS_UNICODE - { - rv = SetFileAttributesW(wfname, flags); - } -#endif -#if APR_HAS_ANSI_FS - ELSE_WIN_OS_IS_ANSI - { - rv = SetFileAttributesA(fname, flags); - } -#endif - - if (rv == 0) - return apr_get_os_error(); - - return APR_SUCCESS; + return APR_ENOTIMPL; } diff --git a/file_io/win32/open.c b/file_io/win32/open.c index 4cd802813..db89eae89 100644 --- a/file_io/win32/open.c +++ b/file_io/win32/open.c @@ -534,7 +534,7 @@ APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile, apr_pool_t file_handle = GetStdHandle(STD_ERROR_HANDLE); if (file_handle == INVALID_HANDLE_VALUE) - return apr_get_os_error(); + return APR_EINVAL; return apr_os_file_put(thefile, &file_handle, 0, cont); } @@ -545,7 +545,7 @@ APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile, apr_pool_t file_handle = GetStdHandle(STD_OUTPUT_HANDLE); if (file_handle == INVALID_HANDLE_VALUE) - return apr_get_os_error(); + return APR_EINVAL; return apr_os_file_put(thefile, &file_handle, 0, cont); } @@ -556,7 +556,7 @@ APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, apr_pool_t * file_handle = GetStdHandle(STD_INPUT_HANDLE); if (file_handle == INVALID_HANDLE_VALUE) - return apr_get_os_error(); + return APR_EINVAL; return apr_os_file_put(thefile, &file_handle, 0, cont); } diff --git a/shmem/os2/shm.c b/shmem/os2/shm.c index 9830ba205..0dc05fae2 100644 --- a/shmem/os2/shm.c +++ b/shmem/os2/shm.c @@ -107,7 +107,7 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, int rc; apr_shm_t *newm = (apr_shm_t *)apr_palloc(pool, sizeof(apr_shm_t)); char *name = NULL; - ULONG flags = PAG_COMMIT|PAG_READ|PAG_WRITE; + ULONG flags = PAG_READ|PAG_WRITE; newm->pool = pool; name = apr_pstrcat(pool, "\\SHAREMEM\\", filename, NULL); diff --git a/threadproc/beos/threadcancel.c b/threadproc/beos/threadcancel.c deleted file mode 100644 index 94a7e9407..000000000 --- a/threadproc/beos/threadcancel.c +++ /dev/null @@ -1,88 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "threadproc.h" - - -ap_status_t ap_cancel_thread(ap_thread_t *thd) -{ - if (kill_thread(thd->td) == 0) { - return APR_SUCCESS; - } - else { - return errno; - } -} - - -ap_status_t ap_setcanceltype(ap_int32_t type, ap_pool_t *cont) -{ -/* if (pthread_setcanceltype(type, NULL) == 0) {*/ - return APR_SUCCESS; -/* } - else { - return APR_FAILURE; - }*/ -} - -ap_status_t ap_setcancelstate(ap_int32_t type, ap_pool_t *cont) -{ -/* if (pthread_setcanceltype(type, NULL) == 0) {*/ - return APR_SUCCESS; -/* } - else { - return APR_FAILURE; - }*/ -} - diff --git a/threadproc/os2/threadcancel.c b/threadproc/os2/threadcancel.c deleted file mode 100644 index ca7a18753..000000000 --- a/threadproc/os2/threadcancel.c +++ /dev/null @@ -1,85 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "threadproc.h" -#include "apr_thread_proc.h" -#include "apr_general.h" -#include "fileio.h" - -ap_status_t ap_cancel_thread(ap_thread_t *thd) -{ - return APR_OS2_STATUS(DosKillThread(thd->tid)); -} - - - -ap_status_t ap_setcanceltype(ap_int32_t type, ap_pool_t *cont) -{ - ULONG rc, nesting; - - if (type == APR_CANCEL_DEFER) - rc = DosEnterMustComplete(&nesting); - else - rc = DosExitMustComplete(&nesting); - - return APR_OS2_STATUS(rc); -} - - - -ap_status_t ap_setcancelstate(ap_int32_t type, ap_pool_t *cont) -{ -/* There's no way to ignore thread kills altogether in OS/2 (that I know of) */ - return APR_ENOTIMPL; -} diff --git a/threadproc/win32/thread.c b/threadproc/win32/thread.c index 2b9c85090..2e5be2757 100644 --- a/threadproc/win32/thread.c +++ b/threadproc/win32/thread.c @@ -58,7 +58,9 @@ #include "apr_general.h" #include "apr_lib.h" #include "apr_portable.h" +#if APR_HAVE_PROCESS_H #include <process.h> +#endif #include "misc.h" APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, @@ -121,12 +123,19 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, /* 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, +#ifndef _WIN32_WCE + if (((*new)->td = (HANDLE)_beginthreadex(NULL, 0, (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker, (*new), 0, &temp)) == 0) { return APR_FROM_OS_ERROR(_doserrno); } - +#else + if (((*new)->td = CreateThread(NULL, 0, + (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker, + (*new), 0, &temp)) == 0) { + return apr_get_os_error(); + } +#endif if (attr && attr->detach) { CloseHandle((*new)->td); } @@ -139,8 +148,12 @@ APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, { thd->exitval = retval; apr_pool_destroy(thd->cntxt); +#ifndef _WIN32_WCE _endthreadex(0); - return APR_SUCCESS; +#else + ExitThread(0); +#endif + return APR_SUCCESS; } APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, @@ -174,9 +187,11 @@ APR_DECLARE(void) apr_thread_yield() * providing more critical threads a bit larger timeslice) * we won't worry too much if it's not available. */ +#ifndef _WIN32_WCE if (apr_os_level >= APR_WIN_NT) { SwitchToThread(); } +#endif } APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key, diff --git a/threadproc/win32/threadcancel.c b/threadproc/win32/threadcancel.c deleted file mode 100644 index 3a509202b..000000000 --- a/threadproc/win32/threadcancel.c +++ /dev/null @@ -1,86 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "threadproc.h" -#include "apr_thread_proc.h" -#include "apr_general.h" - - -ap_status_t ap_cancel_thread(ap_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_int32_t type, ap_pool_t *cont) -{ - -} - -ap_status_t ap_setcancelstate(ap_int32_t type, ap_pool_t *cont) -{ - ap_status_t stat; - if ((stat = pthread_setcanceltype(type, NULL)) == 0) { - return APR_SUCCESS; - } - else { - return stat; - } -} -*/ |