From 0268977037115539ad65a26e858aa0df8d18cd13 Mon Sep 17 00:00:00 2001 From: Stefan Fritsch Date: Tue, 27 Dec 2011 19:42:22 +0100 Subject: Upstream tarball 2.2.9 --- srclib/apr/include/arch/apr_private_common.h | 1 - srclib/apr/include/arch/netware/apr_arch_file_io.h | 7 +- srclib/apr/include/arch/netware/apr_private.h | 2 + srclib/apr/include/arch/os2/apr_arch_file_io.h | 6 +- srclib/apr/include/arch/os2/apr_arch_inherit.h | 50 ++++++++ srclib/apr/include/arch/unix/apr_arch_atomic.h | 45 +++++++ srclib/apr/include/arch/unix/apr_arch_file_io.h | 17 ++- srclib/apr/include/arch/unix/apr_arch_threadproc.h | 3 + srclib/apr/include/arch/unix/apr_private.h.in | 118 +++++++++++++++--- srclib/apr/include/arch/win32/apr_arch_atime.h | 4 +- srclib/apr/include/arch/win32/apr_arch_file_io.h | 34 +----- srclib/apr/include/arch/win32/apr_arch_misc.h | 136 +++++++++++++++++++-- srclib/apr/include/arch/win32/apr_arch_networkio.h | 3 +- .../apr/include/arch/win32/apr_arch_thread_cond.h | 9 +- 14 files changed, 365 insertions(+), 70 deletions(-) create mode 100644 srclib/apr/include/arch/os2/apr_arch_inherit.h create mode 100644 srclib/apr/include/arch/unix/apr_arch_atomic.h (limited to 'srclib/apr/include/arch') diff --git a/srclib/apr/include/arch/apr_private_common.h b/srclib/apr/include/arch/apr_private_common.h index 9cd52ecf..ec850c65 100644 --- a/srclib/apr/include/arch/apr_private_common.h +++ b/srclib/apr/include/arch/apr_private_common.h @@ -37,6 +37,5 @@ apr_status_t apr_filepath_list_merge_impl(char **liststr, /* temporary defines to handle 64bit compile mismatches */ #define APR_INT_TRUNC_CAST int #define APR_UINT32_TRUNC_CAST apr_uint32_t -#define APR_UINT32_MAX 0xFFFFFFFFUL #endif /*APR_PRIVATE_COMMON_H*/ diff --git a/srclib/apr/include/arch/netware/apr_arch_file_io.h b/srclib/apr/include/arch/netware/apr_arch_file_io.h index dd1c42f2..0676eb27 100644 --- a/srclib/apr/include/arch/netware/apr_arch_file_io.h +++ b/srclib/apr/include/arch/netware/apr_arch_file_io.h @@ -69,7 +69,9 @@ /* End System headers */ -#define APR_FILE_BUFSIZE 4096 +#define APR_FILE_DEFAULT_BUFSIZE 4096 +/* For backwards compat */ +#define APR_FILE_BUFSIZE APR_FILE_DEFAULT_BUFSIZE #if APR_HAS_THREADS #define file_lock(f) do { \ @@ -109,7 +111,8 @@ struct apr_file_t { /* Stuff for buffered mode */ char *buffer; - int bufpos; /* Read/Write position in buffer */ + apr_size_t bufpos; /* Read/Write position in buffer */ + apr_size_t bufsize; /* The buffer size */ apr_off_t dataRead; /* amount of valid data read into buffer */ int direction; /* buffer being used for 0 = read, 1 = write */ apr_off_t filePtr; /* position in file of handle */ diff --git a/srclib/apr/include/arch/netware/apr_private.h b/srclib/apr/include/arch/netware/apr_private.h index ad659b59..034271b1 100644 --- a/srclib/apr/include/arch/netware/apr_private.h +++ b/srclib/apr/include/arch/netware/apr_private.h @@ -160,6 +160,8 @@ typedef struct app_data { rtag_t gs_lookup_rtag; rtag_t gs_event_rtag; rtag_t gs_pcp_rtag; + void* gs_ldap_xref_lock; + void* gs_xref_head; } APP_DATA; int setGlobalPool(void *data); diff --git a/srclib/apr/include/arch/os2/apr_arch_file_io.h b/srclib/apr/include/arch/os2/apr_arch_file_io.h index a8884c34..39937123 100644 --- a/srclib/apr/include/arch/os2/apr_arch_file_io.h +++ b/srclib/apr/include/arch/os2/apr_arch_file_io.h @@ -31,7 +31,8 @@ */ #undef HAVE_MKSTEMP -#define APR_FILE_BUFSIZE 4096 +#define APR_FILE_DEFAULT_BUFSIZE 4096 +#define APR_FILE_BUFSIZE APR_FILE_DEFAULT_BUFSIZE struct apr_file_t { apr_pool_t *pool; @@ -48,7 +49,8 @@ struct apr_file_t { /* Stuff for buffered mode */ char *buffer; - int bufpos; // Read/Write position in buffer + apr_size_t bufsize; // Read/Write position in buffer + apr_size_t bufpos; // Read/Write position in buffer unsigned long dataRead; // amount of valid data read into buffer int direction; // buffer being used for 0 = read, 1 = write unsigned long filePtr; // position in file of handle diff --git a/srclib/apr/include/arch/os2/apr_arch_inherit.h b/srclib/apr/include/arch/os2/apr_arch_inherit.h new file mode 100644 index 00000000..494772ac --- /dev/null +++ b/srclib/apr/include/arch/os2/apr_arch_inherit.h @@ -0,0 +1,50 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef INHERIT_H +#define INHERIT_H + +#include "apr_inherit.h" + +#define APR_INHERIT (1 << 24) /* Must not conflict with other bits */ + +#define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup) \ +APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *the##name) \ +{ \ + int rv; \ + ULONG state; \ + if (((rv = DosQueryFHState(attr->parent_err->filedes, &state)) \ + != 0) || \ + ((rv = DosSetFHState(attr->parent_err->filedes, \ + state & ~OPEN_FLAGS_NOINHERIT)) != 0)) \ + return APR_FROM_OS_ERROR(rv); \ + return APR_SUCCESS; \ +} + +#define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup) \ +APR_DECLARE(apr_status_t) apr_##name##_inherit_unset(apr_##name##_t *the##name)\ +{ \ + int rv; \ + ULONG state; \ + if (((rv = DosQueryFHState(attr->parent_err->filedes, &state)) \ + != 0) || \ + ((rv = DosSetFHState(attr->parent_err->filedes, \ + state | OPEN_FLAGS_NOINHERIT)) != 0)) \ + return APR_FROM_OS_ERROR(rv); \ + return APR_SUCCESS; \ +} + +#endif /* ! INHERIT_H */ diff --git a/srclib/apr/include/arch/unix/apr_arch_atomic.h b/srclib/apr/include/arch/unix/apr_arch_atomic.h new file mode 100644 index 00000000..f8019060 --- /dev/null +++ b/srclib/apr/include/arch/unix/apr_arch_atomic.h @@ -0,0 +1,45 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ATOMIC_H +#define ATOMIC_H + +#include "apr.h" +#include "apr_private.h" +#include "apr_atomic.h" +#include "apr_thread_mutex.h" + +#if defined(USE_ATOMICS_GENERIC) +/* noop */ +#elif defined(__GNUC__) && defined(__STRICT_ANSI__) +/* force use of generic atomics if building e.g. with -std=c89, which + * doesn't allow inline asm */ +# define USE_ATOMICS_GENERIC +#elif HAVE_ATOMIC_BUILTINS +# define USE_ATOMICS_BUILTINS +#elif defined(SOLARIS2) && SOLARIS2 >= 10 +# define USE_ATOMICS_SOLARIS +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# define USE_ATOMICS_IA32 +#elif defined(__GNUC__) && (defined(__PPC__) || defined(__ppc__)) +# define USE_ATOMICS_PPC +#elif defined(__GNUC__) && (defined(__s390__) || defined(__s390x__)) +# define USE_ATOMICS_S390 +#else +# define USE_ATOMICS_GENERIC +#endif + +#endif /* ATOMIC_H */ diff --git a/srclib/apr/include/arch/unix/apr_arch_file_io.h b/srclib/apr/include/arch/unix/apr_arch_file_io.h index 4216e131..77a90917 100644 --- a/srclib/apr/include/arch/unix/apr_arch_file_io.h +++ b/srclib/apr/include/arch/unix/apr_arch_file_io.h @@ -86,7 +86,9 @@ #endif /* End System headers */ -#define APR_FILE_BUFSIZE 4096 +#define APR_FILE_DEFAULT_BUFSIZE 4096 +/* For backwards-compat */ +#define APR_FILE_BUFSIZE APR_FILE_DEFAULT_BUFSIZE struct apr_file_t { apr_pool_t *pool; @@ -105,7 +107,8 @@ struct apr_file_t { #endif /* Stuff for buffered mode */ char *buffer; - int bufpos; /* Read/Write position in buffer */ + apr_size_t bufpos; /* Read/Write position in buffer */ + apr_size_t bufsize; /* The size of the buffer */ unsigned long dataRead; /* amount of valid data read into buffer */ int direction; /* buffer being used for 0 = read, 1 = write */ apr_off_t filePtr; /* position in file of handle */ @@ -139,11 +142,21 @@ typedef struct stat64 struct_stat; typedef struct stat struct_stat; #endif +/* readdir64_r is only used in specific cases: */ +#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ + && !defined(READDIR_IS_THREAD_SAFE) && defined(HAVE_READDIR64_R) +#define APR_USE_READDIR64_R +#endif + struct apr_dir_t { apr_pool_t *pool; char *dirname; DIR *dirstruct; +#ifdef APR_USE_READDIR64_R + struct dirent64 *entry; +#else struct dirent *entry; +#endif }; apr_status_t apr_unix_file_cleanup(void *); diff --git a/srclib/apr/include/arch/unix/apr_arch_threadproc.h b/srclib/apr/include/arch/unix/apr_arch_threadproc.h index 6b018023..b76dc9be 100644 --- a/srclib/apr/include/arch/unix/apr_arch_threadproc.h +++ b/srclib/apr/include/arch/unix/apr_arch_threadproc.h @@ -39,6 +39,9 @@ #if APR_HAVE_STRING_H #include #endif +#if HAVE_SCHED_H +#include +#endif /* End System Headers */ diff --git a/srclib/apr/include/arch/unix/apr_private.h.in b/srclib/apr/include/arch/unix/apr_private.h.in index 94689637..1e1d0961 100644 --- a/srclib/apr/include/arch/unix/apr_private.h.in +++ b/srclib/apr/include/arch/unix/apr_private.h.in @@ -7,6 +7,14 @@ /* Define as function used for conversion of strings to apr_off_t */ #undef APR_OFF_T_STRFN +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + /* Define to path of random device */ #undef DEV_RANDOM @@ -46,15 +54,19 @@ /* Define if gethostbyname_r has the hostent_data for the third argument */ #undef GETHOSTBYNAME_R_HOSTENT_DATA -/* Define to 1 if you have the `alloca' function. */ +/* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA -/* Define to 1 if you have the header file. */ +/* Define to 1 if you have and it should be used (not on Ultrix). + */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H +/* Define if compiler provides atomic builtins */ +#undef HAVE_ATOMIC_BUILTINS + /* Define if BONE_VERSION is defined in sys/socket.h */ #undef HAVE_BONE_VERSION @@ -191,15 +203,33 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LANGINFO_H +/* Enable if this library is available */ +#undef HAVE_LIBADVAPI32 + /* Define to 1 if you have the `bsd' library (-lbsd). */ #undef HAVE_LIBBSD +/* Enable if this library is available */ +#undef HAVE_LIBKERNEL32 + +/* Define to 1 if you have the `msvcrt' library (-lmsvcrt). */ +#undef HAVE_LIBMSVCRT + +/* Enable if this library is available */ +#undef HAVE_LIBRPCRT4 + /* Define to 1 if you have the `sendfile' library (-lsendfile). */ #undef HAVE_LIBSENDFILE +/* Enable if this library is available */ +#undef HAVE_LIBSHELL32 + /* Define to 1 if you have the `truerand' library (-ltruerand). */ #undef HAVE_LIBTRUERAND +/* Enable if this library is available */ +#undef HAVE_LIBWS2_32 + /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H @@ -314,12 +344,24 @@ /* Define to 1 if you have the `pthread_rwlock_init' function. */ #undef HAVE_PTHREAD_RWLOCK_INIT +/* Define to 1 if you have the `pthread_yield' function. */ +#undef HAVE_PTHREAD_YIELD + /* Define to 1 if you have the `putenv' function. */ #undef HAVE_PUTENV /* Define to 1 if you have the header file. */ #undef HAVE_PWD_H +/* Define to 1 if you have the `readdir64_r' function. */ +#undef HAVE_READDIR64_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_SCHED_H + +/* Define to 1 if you have the `sched_yield' function. */ +#undef HAVE_SCHED_YIELD + /* Define to 1 if you have the header file. */ #undef HAVE_SEMAPHORE_H @@ -623,9 +665,18 @@ /* Define to 1 if you have the `waitpid' function. */ #undef HAVE_WAITPID +/* Define to 1 if you have the header file. */ +#undef HAVE_WINDOWS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + /* Define to 1 if you have the `writev' function. */ #undef HAVE_WRITEV +/* Define for z/OS pthread API nuances */ +#undef HAVE_ZOS_PTHREADS + /* Define if EAI_ error codes from getaddrinfo are negative */ #undef NEGATIVE_EAI @@ -647,6 +698,9 @@ /* Define if POSIX semaphores affect threads within the process */ #undef POSIXSEM_IS_GLOBAL +/* Define on PowerPC 405 where errata 77 applies */ +#undef PPC405_ERRATA + /* Define if pthread_attr_getdetachstate() has one arg */ #undef PTHREAD_ATTR_GETDETACHSTATE_TAKES_ONE_ARG @@ -689,9 +743,20 @@ /* The size of ssize_t */ #undef SIZEOF_SSIZE_T +/* The size of struct iovec */ +#undef SIZEOF_STRUCT_IOVEC + /* The size of `void*', as computed by sizeof. */ #undef SIZEOF_VOIDP +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS @@ -701,6 +766,9 @@ /* Define if SysV semaphores affect threads within the process */ #undef SYSVSEM_IS_GLOBAL +/* Define if use of generic atomics is requested */ +#undef USE_ATOMICS_GENERIC + /* Define if BeOS Semaphores will be used */ #undef USE_BEOSSEM @@ -710,9 +778,6 @@ /* Define if 4.2BSD-style flock() will be used */ #undef USE_FLOCK_SERIALIZE -/* Define if use of generic atomics is requested */ -#undef USE_GENERIC_ATOMICS - /* Define if BeOS areas will be used */ #undef USE_SHMEM_BEOS @@ -743,21 +808,24 @@ /* Define if SysV IPC shmget() will be used */ #undef USE_SHMEM_SHMGET_ANON +/* Define if Windows shared memory will be used */ +#undef USE_SHMEM_WIN32 + +/* Define if Windows CreateFileMapping() will be used */ +#undef USE_SHMEM_WIN32_ANON + /* Define if SysV IPC semget() will be used */ #undef USE_SYSVSEM_SERIALIZE /* Define if apr_wait_for_io_or_timeout() uses poll(2) */ #undef WAITIO_USES_POLL -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -/* Define to 1 if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +#elif ! defined __LITTLE_ENDIAN__ +# undef WORDS_BIGENDIAN #endif /* Define to 1 if on MINIX. */ @@ -770,6 +838,28 @@ /* Define to 1 if you need to in order for `stat' and other things to work. */ #undef _POSIX_SOURCE +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/srclib/apr/include/arch/win32/apr_arch_atime.h b/srclib/apr/include/arch/win32/apr_arch_atime.h index 47b75a95..35f2041a 100644 --- a/srclib/apr/include/arch/win32/apr_arch_atime.h +++ b/srclib/apr/include/arch/win32/apr_arch_atime.h @@ -36,7 +36,7 @@ struct atime_t { #define APR_DELTA_EPOCH_IN_USEC APR_TIME_C(11644473600000000); -__inline void FileTimeToAprTime(apr_time_t *result, FILETIME *input) +static APR_INLINE void FileTimeToAprTime(apr_time_t *result, FILETIME *input) { /* Convert FILETIME one 64 bit number so we can work with it. */ *result = input->dwHighDateTime; @@ -48,7 +48,7 @@ __inline void FileTimeToAprTime(apr_time_t *result, FILETIME *input) } -__inline void AprTimeToFileTime(LPFILETIME pft, apr_time_t t) +static APR_INLINE void AprTimeToFileTime(LPFILETIME pft, apr_time_t t) { LONGLONG ll; t += APR_DELTA_EPOCH_IN_USEC; diff --git a/srclib/apr/include/arch/win32/apr_arch_file_io.h b/srclib/apr/include/arch/win32/apr_arch_file_io.h index 776dc169..c8c7bdee 100644 --- a/srclib/apr/include/arch/win32/apr_arch_file_io.h +++ b/srclib/apr/include/arch/win32/apr_arch_file_io.h @@ -82,7 +82,9 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool); #define APR_FILE_MAX MAX_PATH -#define APR_FILE_BUFSIZE 4096 +#define APR_FILE_DEFAULT_BUFSIZE 4096 +/* For backwards-compat */ +#define APR_FILE_BUFSIZE APR_FILE_DEFAULT_BUFSIZE /* obscure ommissions from msvc's sys/stat.h */ #ifdef _MSC_VER @@ -176,6 +178,7 @@ struct apr_file_t { /* Stuff for buffered mode */ char *buffer; apr_size_t bufpos; // Read/Write position in buffer + apr_size_t bufsize; // The size of the buffer apr_size_t dataRead; // amount of valid data read into buffer int direction; // buffer being used for 0 = read, 1 = write apr_off_t filePtr; // position in file of handle @@ -249,33 +252,4 @@ apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p); apr_status_t file_cleanup(void *); -/** - * Internal function to create a Win32/NT pipe that respects some async - * timeout options. - * @param in new read end of the created pipe - * @param out new write end of the created pipe - * @param blocking_mode one of - *
- *       APR_FULL_BLOCK
- *       APR_READ_BLOCK
- *       APR_WRITE_BLOCK
- *       APR_FULL_NONBLOCK
- * 
- * @remark It so happens that APR_FULL_BLOCK and APR_FULL_NONBLOCK - * are common to apr_procattr_io_set() in, out and err modes. - * Because APR_CHILD_BLOCK and APR_WRITE_BLOCK share the same value, - * as do APR_PARENT_BLOCK and APR_READ_BLOCK, it's possible to use - * that value directly for creating the stdout/stderr pipes. When - * creating the stdin pipe, the values must be transposed. - * @see apr_procattr_io_set - */ -apr_status_t apr_create_nt_pipe(apr_file_t **in, apr_file_t **out, - apr_int32_t blocking_mode, - apr_pool_t *p); - -/** @see apr_create_nt_pipe */ -#define APR_READ_BLOCK 3 -/** @see apr_create_nt_pipe */ -#define APR_WRITE_BLOCK 4 - #endif /* ! FILE_IO_H */ diff --git a/srclib/apr/include/arch/win32/apr_arch_misc.h b/srclib/apr/include/arch/win32/apr_arch_misc.h index 5113e955..9ead7b04 100644 --- a/srclib/apr/include/arch/win32/apr_arch_misc.h +++ b/srclib/apr/include/arch/win32/apr_arch_misc.h @@ -103,7 +103,8 @@ typedef enum { APR_WIN_XP = 60, APR_WIN_XP_SP1 = 61, APR_WIN_XP_SP2 = 62, - APR_WIN_2003 = 70 + APR_WIN_2003 = 70, + APR_WIN_VISTA = 80 } apr_oslevel_e; extern APR_DECLARE_DATA apr_oslevel_e apr_os_level; @@ -138,6 +139,37 @@ apr_status_t apr_get_oslevel(apr_oslevel_e *); #define ELSE_WIN_OS_IS_ANSI #endif /* WINNT */ +#if defined(_MSC_VER) && !defined(_WIN32_WCE) +#include "crtdbg.h" + +static APR_INLINE void* apr_malloc_dbg(size_t size, const char* filename, + int linenumber) +{ + return _malloc_dbg(size, _CRT_BLOCK, filename, linenumber); +} + +static APR_INLINE void* apr_realloc_dbg(void* userData, size_t newSize, + const char* filename, int linenumber) +{ + return _realloc_dbg(userData, newSize, _CRT_BLOCK, filename, linenumber); +} + +#else + +static APR_INLINE void* apr_malloc_dbg(size_t size, const char* filename, + int linenumber) +{ + return malloc(size); +} + +static APR_INLINE void* apr_realloc_dbg(void* userData, size_t newSize, + const char* filename, int linenumber) +{ + return realloc(userData, newSize); +} + +#endif /* ! _MSC_VER */ + typedef enum { DLL_WINBASEAPI = 0, // kernel32 From WinBase.h DLL_WINADVAPI = 1, // advapi32 From WinBase.h @@ -150,16 +182,20 @@ typedef enum { FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int ordinal); -/* The apr_load_dll_func call WILL fault if the function cannot be loaded */ +/* The apr_load_dll_func call WILL return 0 set error to + * ERROR_INVALID_FUNCTION if the function cannot be loaded + */ #define APR_DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \ typedef rettype (calltype *apr_winapi_fpt_##fn) args; \ static apr_winapi_fpt_##fn apr_winapi_pfn_##fn = NULL; \ - __inline rettype apr_winapi_##fn args \ + static APR_INLINE rettype apr_winapi_##fn args \ { if (!apr_winapi_pfn_##fn) \ apr_winapi_pfn_##fn = (apr_winapi_fpt_##fn) \ apr_load_dll_func(lib, #fn, ord); \ - return (*(apr_winapi_pfn_##fn)) names; }; \ + if (apr_winapi_pfn_##fn) \ + return (*(apr_winapi_pfn_##fn)) names; \ + else { SetLastError(ERROR_INVALID_FUNCTION); return 0;} }; \ /* Provide late bound declarations of every API function missing from * one or more supported releases of the Win32 API @@ -181,6 +217,7 @@ FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int ordinal); */ #if !defined(_WIN32_WCE) && !defined(WINNT) +/* This group is available to all versions of WINNT 4.0 SP6 and later */ #ifdef GetFileAttributesExA #undef GetFileAttributesExA @@ -276,15 +313,39 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_SHSTDAPI, LPWSTR *, WINAPI, CommandLineToArgvW, 0, #endif /* !defined(_WIN32_WCE) && !defined(WINNT) */ #if !defined(_WIN32_WCE) +/* This group is NOT available to all versions of WinNT, + * these we must always look up + */ -APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, DWORD, WINAPI, NtQueryTimerResolution, 0, ( +#ifdef GetCompressedFileSizeA +#undef GetCompressedFileSizeA +#endif +APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, DWORD, WINAPI, GetCompressedFileSizeA, 0, ( + IN LPCSTR lpFileName, + OUT LPDWORD lpFileSizeHigh), + (lpFileName, lpFileSizeHigh)); +#define GetCompressedFileSizeA apr_winapi_GetCompressedFileSizeA +#undef GetCompressedFileSize +#define GetCompressedFileSize apr_winapi_GetCompressedFileSizeA + +#ifdef GetCompressedFileSizeW +#undef GetCompressedFileSizeW +#endif +APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, DWORD, WINAPI, GetCompressedFileSizeW, 0, ( + IN LPCWSTR lpFileName, + OUT LPDWORD lpFileSizeHigh), + (lpFileName, lpFileSizeHigh)); +#define GetCompressedFileSizeW apr_winapi_GetCompressedFileSizeW + + +APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, LONG, WINAPI, NtQueryTimerResolution, 0, ( ULONG *pMaxRes, /* Minimum NS Resolution */ ULONG *pMinRes, /* Maximum NS Resolution */ ULONG *pCurRes), /* Current NS Resolution */ (pMaxRes, pMinRes, pCurRes)); #define QueryTimerResolution apr_winapi_NtQueryTimerResolution -APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, DWORD, WINAPI, NtSetTimerResolution, 0, ( +APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, LONG, WINAPI, NtSetTimerResolution, 0, ( ULONG ReqRes, /* Requested NS Clock Resolution */ BOOL Acquire, /* Aquire (1) or Release (0) our interest */ ULONG *pNewRes), /* The NS Clock Resolution granted */ @@ -294,13 +355,13 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, DWORD, WINAPI, NtSetTimerResolution, 0, ( typedef struct PBI { LONG ExitStatus; PVOID PebBaseAddress; - ULONG_PTR AffinityMask; + apr_uintptr_t AffinityMask; LONG BasePriority; - ULONG_PTR UniqueProcessId; - ULONG_PTR InheritedFromUniqueProcessId; + apr_uintptr_t UniqueProcessId; + apr_uintptr_t InheritedFromUniqueProcessId; } PBI, *PPBI; -APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, DWORD, WINAPI, NtQueryInformationProcess, 0, ( +APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, LONG, WINAPI, NtQueryInformationProcess, 0, ( HANDLE hProcess, /* Obvious */ INT info, /* Use 0 for PBI documented above */ PVOID pPI, /* The PIB buffer */ @@ -309,7 +370,7 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, DWORD, WINAPI, NtQueryInformationProcess, 0 (hProcess, info, pPI, LenPI, pSizePI)); #define QueryInformationProcess apr_winapi_NtQueryInformationProcess -APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, DWORD, WINAPI, NtQueryObject, 0, ( +APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, LONG, WINAPI, NtQueryObject, 0, ( HANDLE hObject, /* Obvious */ INT info, /* Use 0 for PBI documented above */ PVOID pOI, /* The PIB buffer */ @@ -318,7 +379,58 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, DWORD, WINAPI, NtQueryObject, 0, ( (hObject, info, pOI, LenOI, pSizeOI)); #define QueryObject apr_winapi_NtQueryObject +typedef struct IOSB { + union { + UINT Status; + PVOID reserved; + }; + apr_uintptr_t Information; /* Varies by op, consumed buffer size for FSI below */ +} IOSB, *PIOSB; + +typedef struct FSI { + LONGLONG AllocationSize; + LONGLONG EndOfFile; + ULONG NumberOfLinks; + BOOL DeletePending; + BOOL Directory; +} FSI, *PFSI; + +APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, LONG, WINAPI, ZwQueryInformationFile, 0, ( + HANDLE hObject, /* Obvious */ + PVOID pIOSB, /* Point to the IOSB buffer for detailed return results */ + PVOID pFI, /* The buffer, using FIB above */ + ULONG LenFI, /* Use sizeof(FI) */ + ULONG info), /* Use 5 for FSI documented above*/ + (hObject, pIOSB, pFI, LenFI, info)); +#define ZwQueryInformationFile apr_winapi_ZwQueryInformationFile + +#ifdef CreateToolhelp32Snapshot +#undef CreateToolhelp32Snapshot +#endif +APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, HANDLE, WINAPI, CreateToolhelp32Snapshot, 0, ( + DWORD dwFlags, + DWORD th32ProcessID), + (dwFlags, th32ProcessID)); +#define CreateToolhelp32Snapshot apr_winapi_CreateToolhelp32Snapshot + +#ifdef Process32FirstW +#undef Process32FirstW +#endif +APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, Process32FirstW, 0, ( + HANDLE hSnapshot, + LPPROCESSENTRY32W lppe), + (hSnapshot, lppe)); +#define Process32FirstW apr_winapi_Process32FirstW + +#ifdef Process32NextW +#undef Process32NextW +#endif +APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, Process32NextW, 0, ( + HANDLE hSnapshot, + LPPROCESSENTRY32W lppe), + (hSnapshot, lppe)); +#define Process32NextW apr_winapi_Process32NextW + #endif /* !defined(_WIN32_WCE) */ #endif /* ! MISC_H */ - diff --git a/srclib/apr/include/arch/win32/apr_arch_networkio.h b/srclib/apr/include/arch/win32/apr_arch_networkio.h index d4e434d0..04be5559 100644 --- a/srclib/apr/include/arch/win32/apr_arch_networkio.h +++ b/srclib/apr/include/arch/win32/apr_arch_networkio.h @@ -64,9 +64,10 @@ typedef struct _WSABUF { } WSABUF, FAR * LPWSABUF; #endif #else -/* Not sure if this is the right place to define this */ +#ifdef _MSC_VER #define HAVE_STRUCT_IPMREQ #endif +#endif apr_status_t status_from_res_error(int); diff --git a/srclib/apr/include/arch/win32/apr_arch_thread_cond.h b/srclib/apr/include/arch/win32/apr_arch_thread_cond.h index 840949c2..c7f69f80 100644 --- a/srclib/apr/include/arch/win32/apr_arch_thread_cond.h +++ b/srclib/apr/include/arch/win32/apr_arch_thread_cond.h @@ -21,10 +21,11 @@ struct apr_thread_cond_t { apr_pool_t *pool; - HANDLE event; - int signal_all; - int num_waiting; - int signalled; + HANDLE semaphore; + CRITICAL_SECTION csection; + unsigned long num_waiting; + unsigned long num_wake; + unsigned long generation; }; #endif /* THREAD_COND_H */ -- cgit v1.2.3