aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-05-31 20:56:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-05-31 20:56:05 +0000
commita6c43c64d9419dfa888b1c478e658e3e20a4af11 (patch)
treec44233797692f5a1878dfd1d614e5674a3c0e0a6
parentf7eb533f85d0941dbf6edb3081f065e4c010b8cc (diff)
downloadsrc-a6c43c64d9419dfa888b1c478e658e3e20a4af11.tar.gz
src-a6c43c64d9419dfa888b1c478e658e3e20a4af11.zip
Vendor import apr-1.7.0vendor/apr/apr-1.7.0vendor/apr
Notes
Notes: svn path=/vendor/apr/dist/; revision=361666 svn path=/vendor/apr/apr-1.7.0/; revision=361667; tag=vendor/apr/apr-1.7.0
-rw-r--r--CHANGES143
-rw-r--r--Makefile.in3
-rw-r--r--NOTICE2
-rw-r--r--apr.dsp21
-rw-r--r--apr.mak438
-rw-r--r--apr.spec2
-rw-r--r--atomic/unix/builtins64.c64
-rw-r--r--atomic/unix/ia32.c4
-rw-r--r--atomic/unix/mutex.c5
-rw-r--r--atomic/unix/mutex64.c178
-rw-r--r--atomic/unix/ppc.c4
-rw-r--r--atomic/unix/s390.c4
-rw-r--r--atomic/unix/solaris.c4
-rw-r--r--build-outputs.mk84
-rwxr-xr-xbuildconf4
-rwxr-xr-xconfigure1281
-rw-r--r--configure.in177
-rw-r--r--encoding/apr_encode.c1419
-rw-r--r--encoding/apr_escape.c48
-rw-r--r--file_io/unix/dir.c27
-rw-r--r--include/apr.h.in48
-rw-r--r--include/apr.hnw1
-rw-r--r--include/apr.hw1
-rw-r--r--include/apr.hwc1
-rw-r--r--include/apr_atomic.h67
-rw-r--r--include/apr_encode.h569
-rw-r--r--include/apr_escape.h13
-rw-r--r--include/apr_global_mutex.h13
-rw-r--r--include/apr_network_io.h25
-rw-r--r--include/apr_proc_mutex.h15
-rw-r--r--include/apr_thread_mutex.h13
-rw-r--r--include/apr_thread_proc.h7
-rw-r--r--include/apr_time.h4
-rw-r--r--include/apr_version.h6
-rw-r--r--include/arch/unix/apr_arch_atomic.h18
-rw-r--r--include/arch/unix/apr_arch_proc_mutex.h2
-rw-r--r--include/arch/unix/apr_arch_thread_mutex.h3
-rw-r--r--include/arch/unix/apr_private.h.in57
-rw-r--r--include/private/apr_encode_private.h84
-rw-r--r--libapr.dsp16
-rw-r--r--libapr.mak121
-rw-r--r--locks/unix/global_mutex.c41
-rw-r--r--locks/unix/proc_mutex.c502
-rw-r--r--locks/unix/thread_cond.c32
-rw-r--r--locks/unix/thread_mutex.c200
-rw-r--r--misc/unix/rand.c136
-rw-r--r--network_io/unix/sockaddr.c105
-rw-r--r--poll/unix/port.c13
-rw-r--r--strings/apr_snprintf.c1
-rw-r--r--threadproc/unix/signals.c6
-rw-r--r--time/unix/time.c3
51 files changed, 5081 insertions, 954 deletions
diff --git a/CHANGES b/CHANGES
index e7d31369b009..96c32f5186b0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,132 +1,57 @@
-*- coding: utf-8 -*-
-Changes for APR 1.6.5
+Changes for APR 1.7.0
- *) Fix Win32 build breakage in apr_os_exp_time_put() in 1.6.4. [Rainer Jung]
-
-Changes for APR 1.6.4 (not released)
+ *) apr_dir_read: [Unix] Dropped the preference of the dirread_r() flavor
+ for dirread(), because the former is both deprecated and unneeded.
+ [Yann Ylavic, William Rowe]
- *) configure: Fix detection of <net/if.h> on OpenBSD.
- PR 61976. [David Carlier <devnexen gmail.com>, Yann Ylavic]
+ *) apr_file_info: [Win32 only] Treat only "name surrogate" reparse points
+ as symlinks, and not other reparse tag types. PR47630
+ [Oleg Liatte <olegliatte gmail.com>]
- *) Fix apr_parse_addr_port() regression in scope_id parsing introduced
- in 1.6.3. [Rainer Jung]
+ *) Test %ld vs. %lld to avoid compiler emits using APR_OFF_T_FMT, in the
+ case of apparently equivilant long and long long types. [William Rowe]
- *) Fix Win32 file buffer locking behavior for single threaded file streams.
- [Evgeny Kotkov, Mladen Turk, Jean-Frederic Clere]
+ *) Recognize APPLE predefined macros as equivilant to DARWIN. [Jim Jagielski]
- *) Numerous corrections to APR poll behavior. [Yann Ylavic]
+ *) Signals: Allow handling of SIGUSR2 in apr_signal_thread. [Yann Ylavic]
-Changes for APR 1.6.3
+ *) Atomics: Support for 64bit ints. [Jim Jagielski]
- *) apr_file_trunc: Truncating a buffered file could add unexpected
- data after the truncate position. PR 51017.
- [Evgeny Kotkov <evgeny.kotkov visualsvn.com>]
+ *) Add the apr_encode_* API that implements RFC4648 and RFC7515
+ compliant BASE64, BASE64URL, BASE32, BASE32HEX and BASE16
+ encode/decode functions. [Graham Leggett]
- *) apr_file_trunc: Fix an issue where reading from a buffered file
- after truncate could return stale data from the buffer.
- [Evgeny Kotkov <evgeny.kotkov visualsvn.com>]
+ *) rand: Use arc4random_buf() on BSD platforms and getrandom() on Linux,
+ when available. [Christian Weisgerber <naddy openbsd.org, Yann Ylavic]
- *) apr_ipsubnet_create() now fails for an empty input string.
- [Joe Orton]
+ *) Add apr_sockaddr_zone_set, apr_sockaddr_zone_set to set and retrieve
+ the zone for link-local IPv6 addresses. [Joe Orton]
-Changes for APR 1.6.2
+ *) apr_sockaddr_equal: Compare link-local IPv6 addresses with different
+ zones as not equal. [Joe Orton]
- *) Corrected non-Unix builds for APR_LOCK_DEFAULT.
+ *) apr_sockaddr_ip_getbuf, apr_sockaddr_ip_get: Append "%zone" for
+ IPv6 link-local addresses. [Joe Orton]
-Changes for APR 1.6.1
+ *) Locks: add a --disable-timedlocks config option in case users
+ encounter more platforms where it fails [Nick Kew].
- *) Defer timed locks API for later 1.7 release [Nick Kew, William Rowe]
+ *) apr_allocator, apr_pools: Add apr_allocator_page_size() and
+ apr_allocator_min_order_set() to respectively get the (system's) page size
+ in use and set the minimum allocation size for an allocator (expressed in
+ 2^order pages). [Yann Ylavic]
- *) Export build files find_apr.m4 and apr_common.m4 [Jacob Champion]
-
-Changes for APR 1.6.0
-
- *) apr_allocator: Provide apr_allocator_align() to get the true size that
- would be allocated for the given size (including the header and
- alignment). [Yann Ylavic]
-
- *) apr_os_proc_mutex_put_ex: Allow to specify whether the OS native
- mutex should or not be cleaned up (destroyed) with the constructed
- APR mutex (given pool), and default to not for the simple _put()
- function. [Yann Ylavic]
-
- *) apr_proc/global_mutex: Fix API regarding the native OS mutexes
- accessors from/to available APR mechanisms, adding the new functions
- apr_os_proc_mutex_get_ex() and apr_os_proc_mutex_set_ex() which give
- control to the user over the selected mechanisms, including the missing
- POSIX semaphores (sem_t) on platforms supporting them.
- [Yann Ylavic]
-
- *) apr_proc_mutex-pthread: Refcount shared mutexes usage to avoid
- destruction while still is use by some process(es). PR 49504.
- [Yann Ylavic]
-
- *) apr_file_io: Add apr_file_pipe_create_pools() allowing a pair of
- pipes to be created, each in a different pool. [Graham Leggett]
-
- *) Add apr_pollcb_wakeup(), with similar behavior to
- apr_pollset_wakeup(). Add apr_pollcb_method_name(), with similar
- behavior to apr_pollset_method_name().
- [Neil Conway <nrc cs berkeley edu>, Jeff Trawick]
-
- *) apr_table_overlap: Add APR_OVERLAP_TABLES_ADD to merge and set when
- overlapping tables. [Graham Leggett]
+ *) locks: provide portable implementations of timedlock()s for
+ posix-sems, sysv-sems and pthreads for those platforms that
+ lack native versions (eg: OSX/macOS). [Jim Jagielski]
*) locks: Introduce apr_{thread,proc,global}_mutex_timedlock().
[Yann Ylavic]
- *) Introduce the apr_cstr_fn() family of functions, derived from
- the svn_cstring_ functions of the Subversion project.
-
- *) Add APR_SO_FREEBIND option for apr_socket_opt_set. PR 58725.
- [Ashley GC, Jan Kaluza, Joe Orton]
-
- *) apr_filepath_merge: Fix truename length calculation on Windows
- in cases where the "short" name variant is actually longer than
- the "long" or "true" name. See: testnames.c:merge_shortname().
- [Bert Huijben <rhuijben a.o>]
-
- *) apr_atomic: Fix errors when building on Visual Studio 2013 while
- maintaining the ability to build on Visual Studio 6 with Windows
- Server 2003 R2 SDK. PR 57191. [Gregg Smith]
-
- *) apr_skiplist: Add apr_skiplist_addne*() family to preserve existing
- values (no duplicate), add apr_skiplist_size(), apr_skiplist_height()
- and apr_skiplist_preheight() to get the corresponding current values,
- and apr_skiplist_set_preheight() to modify it. [ Yann Ylavic ]
-
- *) Add new --enable-allocator-guard-pages which is like allocator-uses-mmap,
- but will also add inaccessible guard pages before and after each memnode.
- This will result in higher ressource usage but allow to find/protect
- against certain buffer overflow/overread bugs. Under Linux, it may be
- necessary to increase /proc/sys/vm/max_map_count . [Stefan Fritsch]
-
- *) apr_skiplist: Add apr_skiplist_add() to support multiple values.
-
- *) Add new --enable-pool-concurrency-check configure option to detect
- thread-unsafe concurrent accesses to pools. Runtime costs should be
- relatively low. [Stefan Fritsch]
-
- *) Add support code to teach valgrind about APR pools and allocators.
- [Stefan Fritsch]
-
- *) Add apr_sockaddr_info_copy(), for making a deep copy of an
- apr_sockaddr_t into a specified pool. [Yann Ylavic
- <ylavic.dev gmail.com>]
-
- *) Added Unix domain socket support.
- [Mladen Turk]
-
- *) Add apr_shm_delete() to compliment apr_shm_remove().
- [Jim Jagielski]
-
- *) Intruduce APR_PERMS_SET macros for setting the owner/group on
- objects. Currently only implemented for shm, proc and global
- mutexes on posix platforms.
- [Mladen Turk]
+Changes for APR 1.6.x and later:
- *) Add apr_escape_ldap() and apr_pescape_ldap(), escaping characters
- as described by RFC4514 and RFC4515 respectively. [Graham Leggett]
+ *) http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/CHANGES?view=markup
Changes for APR 1.5.x and later:
diff --git a/Makefile.in b/Makefile.in
index cc54e9cef556..7aeefd06d908 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -63,6 +63,7 @@ exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
includedir=@includedir@
+datarootdir=@datarootdir@
datadir=@datadir@
installbuilddir=@installbuilddir@
@@ -92,8 +93,6 @@ install: $(TARGETS)
$(INSTALL_DATA) $(top_srcdir)/build/$${f} $(DESTDIR)$(installbuilddir); \
done
$(INSTALL_DATA) build/apr_rules.out $(DESTDIR)$(installbuilddir)/apr_rules.mk
- $(INSTALL_DATA) $(top_srcdir)/build/apr_common.m4 $(DESTDIR)$(installbuilddir)
- $(INSTALL_DATA) $(top_srcdir)/build/find_apr.m4 $(DESTDIR)$(installbuilddir)
$(INSTALL) -m 755 apr-config.out $(DESTDIR)$(bindir)/$(APR_CONFIG)
@if [ $(INSTALL_SUBDIRS) != "none" ]; then \
for i in $(INSTALL_SUBDIRS); do \
diff --git a/NOTICE b/NOTICE
index e8117bf13a5a..7da5529eae57 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
Apache Portable Runtime
-Copyright (c) 2000-2018 The Apache Software Foundation.
+Copyright (c) 2000-2019 The Apache Software Foundation.
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
diff --git a/apr.dsp b/apr.dsp
index 1afa5715a6a3..ecc4acc8e9ac 100644
--- a/apr.dsp
+++ b/apr.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "LibR"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
-# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -67,7 +67,7 @@ LIB32=link.exe -lib
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /EHsc /c
-# ADD CPP /nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c
+# ADD CPP /nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@@ -90,7 +90,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "x64\LibR"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
-# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -114,7 +114,7 @@ LIB32=link.exe -lib
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /EHsc /c
-# ADD CPP /nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c
+# ADD CPP /nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@@ -142,6 +142,10 @@ LIB32=link.exe -lib
SOURCE=.\atomic\win32\apr_atomic.c
# End Source File
+# Begin Source File
+
+SOURCE=.\atomic\win32\apr_atomic64.c
+# End Source File
# End Group
# Begin Group "dso"
@@ -156,6 +160,11 @@ SOURCE=.\dso\win32\dso.c
# PROP Default_Filter ""
# Begin Source File
+SOURCE=.\encoding\apr_encode.c
+
+# End Source File
+# Begin Source File
+
SOURCE=.\encoding\apr_escape.c
# End Source File
@@ -426,6 +435,10 @@ SOURCE=.\strings\apr_cpystrn.c
# End Source File
# Begin Source File
+SOURCE=.\strings\apr_cstr.c
+# End Source File
+# Begin Source File
+
SOURCE=.\strings\apr_fnmatch.c
# End Source File
# Begin Source File
diff --git a/apr.mak b/apr.mak
index 5bfe665ec003..43657a0bb686 100644
--- a/apr.mak
+++ b/apr.mak
@@ -27,6 +27,9 @@ NULL=
NULL=nul
!ENDIF
+CPP=cl.exe
+RSC=rc.exe
+
!IF "$(CFG)" == "apr - Win32 Release"
OUTDIR=.\LibR
@@ -35,15 +38,17 @@ INTDIR=.\LibR
OutDir=.\LibR
# End Custom Macros
-ALL : ".\LibR\gen_test_char.exe" "$(OUTDIR)\apr-1.lib"
+ALL : ".\include\apr.h" ".\include\apr_escape.h" "$(OUTDIR)\apr-1.lib"
CLEAN :
-@erase "$(INTDIR)\apr-1.idb"
-@erase "$(INTDIR)\apr-1.pdb"
-@erase "$(INTDIR)\apr_atomic.obj"
+ -@erase "$(INTDIR)\apr_atomic64.obj"
-@erase "$(INTDIR)\apr_cpystrn.obj"
-@erase "$(INTDIR)\apr_cstr.obj"
+ -@erase "$(INTDIR)\apr_encode.obj"
-@erase "$(INTDIR)\apr_escape.obj"
-@erase "$(INTDIR)\apr_fnmatch.obj"
-@erase "$(INTDIR)\apr_getpass.obj"
@@ -117,47 +122,11 @@ CLEAN :
-@erase "$(INTDIR)\wakeup.obj"
-@erase "$(OUTDIR)\apr-1.lib"
-@erase ".\include\apr.h"
- -@erase ".\include\apr_gen_test_char.h"
- -@erase "$(OUTDIR)\gen_test_char.exe"
- -@erase "$(OUTDIR)\gen_test_char.obj"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
+CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /c
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\apr.bsc"
BSC32_SBRS= \
@@ -166,7 +135,9 @@ LIB32=link.exe -lib
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\apr-1.lib"
LIB32_OBJS= \
"$(INTDIR)\apr_atomic.obj" \
+ "$(INTDIR)\apr_atomic64.obj" \
"$(INTDIR)\dso.obj" \
+ "$(INTDIR)\apr_encode.obj" \
"$(INTDIR)\apr_escape.obj" \
"$(INTDIR)\buffer.obj" \
"$(INTDIR)\copy.obj" \
@@ -208,15 +179,15 @@ LIB32_OBJS= \
"$(INTDIR)\multicast.obj" \
"$(INTDIR)\sendrecv.obj" \
"$(INTDIR)\sockaddr.obj" \
- "$(INTDIR)\sockets.obj" \
"$(INTDIR)\socket_util.obj" \
+ "$(INTDIR)\sockets.obj" \
"$(INTDIR)\sockopt.obj" \
"$(INTDIR)\apr_getpass.obj" \
"$(INTDIR)\poll.obj" \
"$(INTDIR)\pollcb.obj" \
"$(INTDIR)\pollset.obj" \
- "$(INTDIR)\wakeup.obj" \
"$(INTDIR)\select.obj" \
+ "$(INTDIR)\wakeup.obj" \
"$(INTDIR)\apr_random.obj" \
"$(INTDIR)\sha2.obj" \
"$(INTDIR)\sha2_glue.obj" \
@@ -253,15 +224,17 @@ INTDIR=.\LibD
OutDir=.\LibD
# End Custom Macros
-ALL : ".\LibD\gen_test_char.exe" ".\include\apr_escape_test_char.h" ".\include\apr.h" "$(OUTDIR)\apr-1.lib"
+ALL : ".\include\apr.h" ".\include\apr_escape.h" "$(OUTDIR)\apr-1.lib"
CLEAN :
-@erase "$(INTDIR)\apr-1.idb"
-@erase "$(INTDIR)\apr-1.pdb"
-@erase "$(INTDIR)\apr_atomic.obj"
+ -@erase "$(INTDIR)\apr_atomic64.obj"
-@erase "$(INTDIR)\apr_cpystrn.obj"
-@erase "$(INTDIR)\apr_cstr.obj"
+ -@erase "$(INTDIR)\apr_encode.obj"
-@erase "$(INTDIR)\apr_escape.obj"
-@erase "$(INTDIR)\apr_fnmatch.obj"
-@erase "$(INTDIR)\apr_getpass.obj"
@@ -335,47 +308,11 @@ CLEAN :
-@erase "$(INTDIR)\wakeup.obj"
-@erase "$(OUTDIR)\apr-1.lib"
-@erase ".\include\apr.h"
- -@erase ".\include\apr_gen_test_char.h"
- -@erase "$(OUTDIR)\gen_test_char.exe"
- -@erase "$(OUTDIR)\gen_test_char.obj"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
+CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\apr.bsc"
BSC32_SBRS= \
@@ -384,7 +321,9 @@ LIB32=link.exe -lib
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\apr-1.lib"
LIB32_OBJS= \
"$(INTDIR)\apr_atomic.obj" \
+ "$(INTDIR)\apr_atomic64.obj" \
"$(INTDIR)\dso.obj" \
+ "$(INTDIR)\apr_encode.obj" \
"$(INTDIR)\apr_escape.obj" \
"$(INTDIR)\buffer.obj" \
"$(INTDIR)\copy.obj" \
@@ -426,8 +365,8 @@ LIB32_OBJS= \
"$(INTDIR)\multicast.obj" \
"$(INTDIR)\sendrecv.obj" \
"$(INTDIR)\sockaddr.obj" \
- "$(INTDIR)\sockets.obj" \
"$(INTDIR)\socket_util.obj" \
+ "$(INTDIR)\sockets.obj" \
"$(INTDIR)\sockopt.obj" \
"$(INTDIR)\apr_getpass.obj" \
"$(INTDIR)\poll.obj" \
@@ -471,15 +410,17 @@ INTDIR=.\x64\LibR
OutDir=.\x64\LibR
# End Custom Macros
-ALL : ".\x64\LibR\gen_test_char.exe" ".\include\apr_escape_test_char.h" ".\include\apr.h" "$(OUTDIR)\apr-1.lib"
+ALL : ".\include\apr.h" ".\include\apr_escape.h" "$(OUTDIR)\apr-1.lib"
CLEAN :
-@erase "$(INTDIR)\apr-1.idb"
-@erase "$(INTDIR)\apr-1.pdb"
-@erase "$(INTDIR)\apr_atomic.obj"
+ -@erase "$(INTDIR)\apr_atomic64.obj"
-@erase "$(INTDIR)\apr_cpystrn.obj"
-@erase "$(INTDIR)\apr_cstr.obj"
+ -@erase "$(INTDIR)\apr_encode.obj"
-@erase "$(INTDIR)\apr_escape.obj"
-@erase "$(INTDIR)\apr_fnmatch.obj"
-@erase "$(INTDIR)\apr_getpass.obj"
@@ -553,47 +494,11 @@ CLEAN :
-@erase "$(INTDIR)\wakeup.obj"
-@erase "$(OUTDIR)\apr-1.lib"
-@erase ".\include\apr.h"
- -@erase ".\include\apr_gen_test_char.h"
- -@erase "$(OUTDIR)\gen_test_char.exe"
- -@erase "$(OUTDIR)\gen_test_char.obj"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
+CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /c
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\apr.bsc"
BSC32_SBRS= \
@@ -602,7 +507,9 @@ LIB32=link.exe -lib
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\apr-1.lib"
LIB32_OBJS= \
"$(INTDIR)\apr_atomic.obj" \
+ "$(INTDIR)\apr_atomic64.obj" \
"$(INTDIR)\dso.obj" \
+ "$(INTDIR)\apr_encode.obj" \
"$(INTDIR)\apr_escape.obj" \
"$(INTDIR)\buffer.obj" \
"$(INTDIR)\copy.obj" \
@@ -644,8 +551,8 @@ LIB32_OBJS= \
"$(INTDIR)\multicast.obj" \
"$(INTDIR)\sendrecv.obj" \
"$(INTDIR)\sockaddr.obj" \
- "$(INTDIR)\sockets.obj" \
"$(INTDIR)\socket_util.obj" \
+ "$(INTDIR)\sockets.obj" \
"$(INTDIR)\sockopt.obj" \
"$(INTDIR)\apr_getpass.obj" \
"$(INTDIR)\poll.obj" \
@@ -689,15 +596,17 @@ INTDIR=.\x64\LibD
OutDir=.\x64\LibD
# End Custom Macros
-ALL : ".\x64\LibD\gen_test_char.exe" ".\include\apr_escape_test_char.h" ".\include\apr.h" "$(OUTDIR)\apr-1.lib"
+ALL : ".\include\apr.h" ".\include\apr_escape.h" "$(OUTDIR)\apr-1.lib"
CLEAN :
-@erase "$(INTDIR)\apr-1.idb"
-@erase "$(INTDIR)\apr-1.pdb"
-@erase "$(INTDIR)\apr_atomic.obj"
+ -@erase "$(INTDIR)\apr_atomic64.obj"
-@erase "$(INTDIR)\apr_cpystrn.obj"
-@erase "$(INTDIR)\apr_cstr.obj"
+ -@erase "$(INTDIR)\apr_encode.obj"
-@erase "$(INTDIR)\apr_escape.obj"
-@erase "$(INTDIR)\apr_fnmatch.obj"
-@erase "$(INTDIR)\apr_getpass.obj"
@@ -771,47 +680,12 @@ CLEAN :
-@erase "$(INTDIR)\wakeup.obj"
-@erase "$(OUTDIR)\apr-1.lib"
-@erase ".\include\apr.h"
- -@erase ".\include\apr_gen_test_char.h"
- -@erase "$(OUTDIR)\gen_test_char.exe"
- -@erase "$(OUTDIR)\gen_test_char.obj"
+ -@erase ".\include\apr_escape_test_char.h"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c
-
-.c{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.obj::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.c{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cpp{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-.cxx{$(INTDIR)}.sbr::
- $(CPP) @<<
- $(CPP_PROJ) $<
-<<
-
-RSC=rc.exe
+CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(OUTDIR)\apr-1" /FD /EHsc /c
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\apr.bsc"
BSC32_SBRS= \
@@ -820,7 +694,9 @@ LIB32=link.exe -lib
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\apr-1.lib"
LIB32_OBJS= \
"$(INTDIR)\apr_atomic.obj" \
+ "$(INTDIR)\apr_atomic64.obj" \
"$(INTDIR)\dso.obj" \
+ "$(INTDIR)\apr_encode.obj" \
"$(INTDIR)\apr_escape.obj" \
"$(INTDIR)\buffer.obj" \
"$(INTDIR)\copy.obj" \
@@ -862,8 +738,8 @@ LIB32_OBJS= \
"$(INTDIR)\multicast.obj" \
"$(INTDIR)\sendrecv.obj" \
"$(INTDIR)\sockaddr.obj" \
- "$(INTDIR)\sockets.obj" \
"$(INTDIR)\socket_util.obj" \
+ "$(INTDIR)\sockets.obj" \
"$(INTDIR)\sockopt.obj" \
"$(INTDIR)\apr_getpass.obj" \
"$(INTDIR)\poll.obj" \
@@ -901,6 +777,36 @@ LIB32_OBJS= \
!ENDIF
+.c{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(INTDIR)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("apr.dep")
@@ -914,444 +820,458 @@ LIB32_OBJS= \
!IF "$(CFG)" == "apr - Win32 Release" || "$(CFG)" == "apr - Win32 Debug" || "$(CFG)" == "apr - x64 Release" || "$(CFG)" == "apr - x64 Debug"
SOURCE=.\atomic\win32\apr_atomic.c
-"$(INTDIR)\apr_atomic.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_atomic.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\atomic\win32\apr_atomic64.c
+
+"$(INTDIR)\apr_atomic64.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\dso\win32\dso.c
-"$(INTDIR)\dso.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\dso.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\encoding\apr_encode.c
+
+"$(INTDIR)\apr_encode.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\encoding\apr_escape.c
-"$(INTDIR)\apr_escape.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr_escape.h" ".\include\apr_escape_test_char.h" ".\include\apr.h"
+"$(INTDIR)\apr_escape.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\win32\buffer.c
-"$(INTDIR)\buffer.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\buffer.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\unix\copy.c
-"$(INTDIR)\copy.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\copy.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\win32\dir.c
-"$(INTDIR)\dir.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\dir.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\unix\fileacc.c
-"$(INTDIR)\fileacc.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\fileacc.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\win32\filedup.c
-"$(INTDIR)\filedup.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\filedup.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\win32\filepath.c
-"$(INTDIR)\filepath.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\filepath.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\unix\filepath_util.c
-"$(INTDIR)\filepath_util.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\filepath_util.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\win32\filestat.c
-"$(INTDIR)\filestat.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\filestat.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\win32\filesys.c
-"$(INTDIR)\filesys.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\filesys.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\win32\flock.c
-"$(INTDIR)\flock.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\flock.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\unix\fullrw.c
-"$(INTDIR)\fullrw.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\fullrw.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\unix\mktemp.c
-"$(INTDIR)\mktemp.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\mktemp.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\win32\open.c
-"$(INTDIR)\open.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\open.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\win32\pipe.c
-"$(INTDIR)\pipe.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\pipe.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\win32\readwrite.c
-"$(INTDIR)\readwrite.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\readwrite.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\win32\seek.c
-"$(INTDIR)\seek.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\seek.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\file_io\unix\tempdir.c
-"$(INTDIR)\tempdir.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\tempdir.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\locks\win32\proc_mutex.c
-"$(INTDIR)\proc_mutex.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\proc_mutex.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\locks\win32\thread_cond.c
-"$(INTDIR)\thread_cond.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\thread_cond.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\locks\win32\thread_mutex.c
-"$(INTDIR)\thread_mutex.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\thread_mutex.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\locks\win32\thread_rwlock.c
-"$(INTDIR)\thread_rwlock.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\thread_rwlock.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\memory\unix\apr_pools.c
-"$(INTDIR)\apr_pools.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_pools.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\misc\win32\apr_app.c
SOURCE=.\misc\win32\charset.c
-"$(INTDIR)\charset.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\charset.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\misc\win32\env.c
-"$(INTDIR)\env.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\env.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\misc\unix\errorcodes.c
-"$(INTDIR)\errorcodes.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\errorcodes.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\misc\unix\getopt.c
-"$(INTDIR)\getopt.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\getopt.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\misc\win32\internal.c
-"$(INTDIR)\internal.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\internal.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\misc\win32\misc.c
-"$(INTDIR)\misc.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\misc.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\misc\unix\otherchild.c
-"$(INTDIR)\otherchild.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\otherchild.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\misc\win32\rand.c
-"$(INTDIR)\rand.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\rand.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\misc\win32\start.c
-"$(INTDIR)\start.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\start.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\misc\win32\utf8.c
-"$(INTDIR)\utf8.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\utf8.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\misc\unix\version.c
-"$(INTDIR)\version.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\version.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\mmap\unix\common.c
-"$(INTDIR)\common.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\common.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\mmap\win32\mmap.c
-"$(INTDIR)\mmap.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\mmap.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\network_io\unix\inet_ntop.c
-"$(INTDIR)\inet_ntop.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\inet_ntop.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\network_io\unix\inet_pton.c
-"$(INTDIR)\inet_pton.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\inet_pton.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\network_io\unix\multicast.c
-"$(INTDIR)\multicast.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\multicast.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\network_io\win32\sendrecv.c
-"$(INTDIR)\sendrecv.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\sendrecv.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\network_io\unix\sockaddr.c
-"$(INTDIR)\sockaddr.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\sockaddr.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\network_io\unix\socket_util.c
-"$(INTDIR)\socket_util.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\socket_util.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\network_io\win32\sockets.c
-"$(INTDIR)\sockets.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\sockets.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\network_io\win32\sockopt.c
-"$(INTDIR)\sockopt.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\sockopt.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\passwd\apr_getpass.c
-"$(INTDIR)\apr_getpass.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_getpass.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\poll\unix\poll.c
-"$(INTDIR)\poll.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\poll.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\poll\unix\pollcb.c
-"$(INTDIR)\pollcb.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\pollcb.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\poll\unix\pollset.c
-"$(INTDIR)\pollset.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\pollset.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\poll\unix\select.c
-"$(INTDIR)\select.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\select.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\poll\unix\wakeup.c
-"$(INTDIR)\wakeup.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\wakeup.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
+
SOURCE=.\random\unix\apr_random.c
-"$(INTDIR)\apr_random.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_random.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\random\unix\sha2.c
-"$(INTDIR)\sha2.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\sha2.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\random\unix\sha2_glue.c
-"$(INTDIR)\sha2_glue.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\sha2_glue.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\shmem\win32\shm.c
-"$(INTDIR)\shm.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\shm.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\strings\apr_cpystrn.c
-"$(INTDIR)\apr_cpystrn.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_cpystrn.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
+
SOURCE=.\strings\apr_cstr.c
-"$(INTDIR)\apr_cstr.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr_cstr.h"
+"$(INTDIR)\apr_cstr.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\strings\apr_fnmatch.c
-"$(INTDIR)\apr_fnmatch.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_fnmatch.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\strings\apr_snprintf.c
-"$(INTDIR)\apr_snprintf.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_snprintf.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\strings\apr_strings.c
-"$(INTDIR)\apr_strings.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_strings.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\strings\apr_strnatcmp.c
-"$(INTDIR)\apr_strnatcmp.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_strnatcmp.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\strings\apr_strtok.c
-"$(INTDIR)\apr_strtok.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_strtok.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\tables\apr_hash.c
-"$(INTDIR)\apr_hash.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_hash.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\tables\apr_skiplist.c
-"$(INTDIR)\apr_skiplist.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_skiplist.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\tables\apr_tables.c
-"$(INTDIR)\apr_tables.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\apr_tables.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\threadproc\win32\proc.c
-"$(INTDIR)\proc.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\proc.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\threadproc\win32\signals.c
-"$(INTDIR)\signals.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\signals.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\threadproc\win32\thread.c
-"$(INTDIR)\thread.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\thread.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\threadproc\win32\threadpriv.c
-"$(INTDIR)\threadpriv.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\threadpriv.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\time\win32\time.c
-"$(INTDIR)\time.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\time.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\time\win32\timestr.c
-"$(INTDIR)\timestr.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\timestr.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\user\win32\groupinfo.c
-"$(INTDIR)\groupinfo.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\groupinfo.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=.\user\win32\userinfo.c
-"$(INTDIR)\userinfo.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
+"$(INTDIR)\userinfo.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
@@ -1413,7 +1333,7 @@ InputPath=.\include\apr_escape.h
<<tempfile.bat
@echo off
cl.exe /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\LibR\gen_test_char /Fe.\LibR\gen_test_char.exe .\tools\gen_test_char.c
- .\LibR\gen_test_char.exe > .\include\apr_escape_test_char.h
+ .\LibR\gen_test_char.exe > .\include\apr_escape_test_char.h
<<
@@ -1425,7 +1345,7 @@ InputPath=.\include\apr_escape.h
<<tempfile.bat
@echo off
cl.exe /nologo /W3 /EHsc /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\LibD\gen_test_char /Fe.\LibD\gen_test_char.exe .\tools\gen_test_char.c
- .\LibD\gen_test_char.exe > .\include\apr_escape_test_char.h
+ .\LibD\gen_test_char.exe > .\include\apr_escape_test_char.h
<<
@@ -1437,7 +1357,7 @@ InputPath=.\include\apr_escape.h
<<tempfile.bat
@echo off
cl.exe /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\x64\LibR\gen_test_char /Fe.\x64\LibR\gen_test_char.exe .\tools\gen_test_char.c
- .\x64\LibR\gen_test_char.exe > .\include\apr_escape_test_char.h
+ .\x64\LibR\gen_test_char.exe > .\include\apr_escape_test_char.h
<<
@@ -1449,55 +1369,7 @@ InputPath=.\include\apr_escape.h
<<tempfile.bat
@echo off
cl.exe /nologo /W3 /EHsc /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /I ".\include" /Fo.\x64\LibD\gen_test_char /Fe.\x64\LibD\gen_test_char.exe .\tools\gen_test_char.c
- .\x64\LibD\gen_test_char.exe > .\include\apr_escape_test_char.h
-<<
-
-
-!ENDIF
-
-SOURCE=.\include\apr_want.h
-
-!IF "$(CFG)" == "apr - Win32 Release"
-
-InputPath=.\include\apr_want.h
-
-"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- type .\include\apr.hw > .\include\apr.h
-<<
-
-
-!ELSEIF "$(CFG)" == "apr - Win32 Debug"
-
-InputPath=.\include\apr_want.h
-
-"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- type .\include\apr.hw > .\include\apr.h
-<<
-
-
-!ELSEIF "$(CFG)" == "apr - x64 Release"
-
-InputPath=.\include\apr_want.h
-
-"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- type .\include\apr.hw > .\include\apr.h
-<<
-
-
-!ELSEIF "$(CFG)" == "apr - x64 Debug"
-
-InputPath=.\include\apr_want.h
-
-"$(INTDIR)\gen_test_char.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- type .\include\apr.hw > .\include\apr.h
+ .\x64\LibD\gen_test_char.exe > .\include\apr_escape_test_char.h
<<
diff --git a/apr.spec b/apr.spec
index 919d473863bd..e272d6363c3d 100644
--- a/apr.spec
+++ b/apr.spec
@@ -3,7 +3,7 @@
Summary: Apache Portable Runtime library
Name: apr
-Version: 1.6.5
+Version: 1.7.0
Release: 1
License: Apache Software License
Group: System Environment/Libraries
diff --git a/atomic/unix/builtins64.c b/atomic/unix/builtins64.c
new file mode 100644
index 000000000000..4a4b685c7ac5
--- /dev/null
+++ b/atomic/unix/builtins64.c
@@ -0,0 +1,64 @@
+/* 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.
+ */
+
+#include "apr_arch_atomic.h"
+
+#ifdef USE_ATOMICS_BUILTINS
+
+APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem)
+{
+ return *mem;
+}
+
+APR_DECLARE(void) apr_atomic_set64(volatile apr_uint64_t *mem, apr_uint64_t val)
+{
+ *mem = val;
+}
+
+APR_DECLARE(apr_uint64_t) apr_atomic_add64(volatile apr_uint64_t *mem, apr_uint64_t val)
+{
+ return __sync_fetch_and_add(mem, val);
+}
+
+APR_DECLARE(void) apr_atomic_sub64(volatile apr_uint64_t *mem, apr_uint64_t val)
+{
+ __sync_fetch_and_sub(mem, val);
+}
+
+APR_DECLARE(apr_uint64_t) apr_atomic_inc64(volatile apr_uint64_t *mem)
+{
+ return __sync_fetch_and_add(mem, 1);
+}
+
+APR_DECLARE(int) apr_atomic_dec64(volatile apr_uint64_t *mem)
+{
+ return __sync_sub_and_fetch(mem, 1);
+}
+
+APR_DECLARE(apr_uint64_t) apr_atomic_cas64(volatile apr_uint64_t *mem, apr_uint64_t with,
+ apr_uint64_t cmp)
+{
+ return __sync_val_compare_and_swap(mem, cmp, with);
+}
+
+APR_DECLARE(apr_uint64_t) apr_atomic_xchg64(volatile apr_uint64_t *mem, apr_uint64_t val)
+{
+ __sync_synchronize();
+
+ return __sync_lock_test_and_set(mem, val);
+}
+
+#endif /* USE_ATOMICS_BUILTINS */
diff --git a/atomic/unix/ia32.c b/atomic/unix/ia32.c
index 63f48a753a9f..cdb7a528962e 100644
--- a/atomic/unix/ia32.c
+++ b/atomic/unix/ia32.c
@@ -20,7 +20,11 @@
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
{
+#if defined (NEED_ATOMICS_GENERIC64)
+ return apr__atomic_generic64_init(p);
+#else
return APR_SUCCESS;
+#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
diff --git a/atomic/unix/mutex.c b/atomic/unix/mutex.c
index fba3be2ba150..45bc5e2d9951 100644
--- a/atomic/unix/mutex.c
+++ b/atomic/unix/mutex.c
@@ -15,6 +15,7 @@
*/
#include "apr_arch_atomic.h"
+#include "apr_thread_mutex.h"
#ifdef USE_ATOMICS_GENERIC
@@ -70,7 +71,7 @@ APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
}
}
- return APR_SUCCESS;
+ return apr__atomic_generic64_init(p);
}
static APR_INLINE apr_thread_mutex_t *mutex_hash(volatile apr_uint32_t *mem)
@@ -88,7 +89,7 @@ static APR_INLINE apr_thread_mutex_t *mutex_hash(volatile apr_uint32_t *mem)
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
{
- return APR_SUCCESS;
+ return apr__atomic_generic64_init(p);
}
#endif /* APR_HAS_THREADS */
diff --git a/atomic/unix/mutex64.c b/atomic/unix/mutex64.c
new file mode 100644
index 000000000000..9fc44af61ab4
--- /dev/null
+++ b/atomic/unix/mutex64.c
@@ -0,0 +1,178 @@
+/* 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.
+ */
+
+#include "apr_arch_atomic.h"
+#include "apr_thread_mutex.h"
+
+#if defined(USE_ATOMICS_GENERIC) || defined (NEED_ATOMICS_GENERIC64)
+
+#include <stdlib.h>
+
+#if APR_HAS_THREADS
+# define DECLARE_MUTEX_LOCKED(name, mem) \
+ apr_thread_mutex_t *name = mutex_hash(mem)
+# define MUTEX_UNLOCK(name) \
+ do { \
+ if (apr_thread_mutex_unlock(name) != APR_SUCCESS) \
+ abort(); \
+ } while (0)
+#else
+# define DECLARE_MUTEX_LOCKED(name, mem)
+# define MUTEX_UNLOCK(name)
+# warning Be warned: using stubs for all atomic operations
+#endif
+
+#if APR_HAS_THREADS
+
+static apr_thread_mutex_t **hash_mutex;
+
+#define NUM_ATOMIC_HASH 7
+/* shift by 2 to get rid of alignment issues */
+#define ATOMIC_HASH(x) (unsigned int)(((unsigned long)(x)>>2)%(unsigned int)NUM_ATOMIC_HASH)
+
+static apr_status_t atomic_cleanup(void *data)
+{
+ if (hash_mutex == data)
+ hash_mutex = NULL;
+
+ return APR_SUCCESS;
+}
+
+apr_status_t apr__atomic_generic64_init(apr_pool_t *p)
+{
+ int i;
+ apr_status_t rv;
+
+ if (hash_mutex != NULL)
+ return APR_SUCCESS;
+
+ hash_mutex = apr_palloc(p, sizeof(apr_thread_mutex_t*) * NUM_ATOMIC_HASH);
+ apr_pool_cleanup_register(p, hash_mutex, atomic_cleanup,
+ apr_pool_cleanup_null);
+
+ for (i = 0; i < NUM_ATOMIC_HASH; i++) {
+ rv = apr_thread_mutex_create(&(hash_mutex[i]),
+ APR_THREAD_MUTEX_DEFAULT, p);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+ }
+
+ return APR_SUCCESS;
+}
+
+static APR_INLINE apr_thread_mutex_t *mutex_hash(volatile apr_uint64_t *mem)
+{
+ apr_thread_mutex_t *mutex = hash_mutex[ATOMIC_HASH(mem)];
+
+ if (apr_thread_mutex_lock(mutex) != APR_SUCCESS) {
+ abort();
+ }
+
+ return mutex;
+}
+
+#else
+
+apr_status_t apr__atomic_generic64_init(apr_pool_t *p)
+{
+ return APR_SUCCESS;
+}
+
+#endif /* APR_HAS_THREADS */
+
+APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem)
+{
+ return *mem;
+}
+
+APR_DECLARE(void) apr_atomic_set64(volatile apr_uint64_t *mem, apr_uint64_t val)
+{
+ DECLARE_MUTEX_LOCKED(mutex, mem);
+
+ *mem = val;
+
+ MUTEX_UNLOCK(mutex);
+}
+
+APR_DECLARE(apr_uint64_t) apr_atomic_add64(volatile apr_uint64_t *mem, apr_uint64_t val)
+{
+ apr_uint64_t old_value;
+ DECLARE_MUTEX_LOCKED(mutex, mem);
+
+ old_value = *mem;
+ *mem += val;
+
+ MUTEX_UNLOCK(mutex);
+
+ return old_value;
+}
+
+APR_DECLARE(void) apr_atomic_sub64(volatile apr_uint64_t *mem, apr_uint64_t val)
+{
+ DECLARE_MUTEX_LOCKED(mutex, mem);
+ *mem -= val;
+ MUTEX_UNLOCK(mutex);
+}
+
+APR_DECLARE(apr_uint64_t) apr_atomic_inc64(volatile apr_uint64_t *mem)
+{
+ return apr_atomic_add64(mem, 1);
+}
+
+APR_DECLARE(int) apr_atomic_dec64(volatile apr_uint64_t *mem)
+{
+ apr_uint64_t new;
+ DECLARE_MUTEX_LOCKED(mutex, mem);
+
+ (*mem)--;
+ new = *mem;
+
+ MUTEX_UNLOCK(mutex);
+
+ return new;
+}
+
+APR_DECLARE(apr_uint64_t) apr_atomic_cas64(volatile apr_uint64_t *mem, apr_uint64_t with,
+ apr_uint64_t cmp)
+{
+ apr_uint64_t prev;
+ DECLARE_MUTEX_LOCKED(mutex, mem);
+
+ prev = *mem;
+ if (prev == cmp) {
+ *mem = with;
+ }
+
+ MUTEX_UNLOCK(mutex);
+
+ return prev;
+}
+
+APR_DECLARE(apr_uint64_t) apr_atomic_xchg64(volatile apr_uint64_t *mem, apr_uint64_t val)
+{
+ apr_uint64_t prev;
+ DECLARE_MUTEX_LOCKED(mutex, mem);
+
+ prev = *mem;
+ *mem = val;
+
+ MUTEX_UNLOCK(mutex);
+
+ return prev;
+}
+
+#endif /* USE_ATOMICS_GENERIC64 */
diff --git a/atomic/unix/ppc.c b/atomic/unix/ppc.c
index ae8d503cc4d2..1823fe81c598 100644
--- a/atomic/unix/ppc.c
+++ b/atomic/unix/ppc.c
@@ -26,7 +26,11 @@
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
{
+#if defined (NEED_ATOMICS_GENERIC64)
+ return apr__atomic_generic64_init(p);
+#else
return APR_SUCCESS;
+#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
diff --git a/atomic/unix/s390.c b/atomic/unix/s390.c
index b6b6f42de02d..ae5d04082c31 100644
--- a/atomic/unix/s390.c
+++ b/atomic/unix/s390.c
@@ -20,7 +20,11 @@
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
{
+#if defined (NEED_ATOMICS_GENERIC64)
+ return apr__atomic_generic64_init(p);
+#else
return APR_SUCCESS;
+#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
diff --git a/atomic/unix/solaris.c b/atomic/unix/solaris.c
index 547499a55eab..9bc2de29a749 100644
--- a/atomic/unix/solaris.c
+++ b/atomic/unix/solaris.c
@@ -22,7 +22,11 @@
APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
{
+#if defined (NEED_ATOMICS_GENERIC64)
+ return apr__atomic_generic64_init(p);
+#else
return APR_SUCCESS;
+#endif
}
APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
diff --git a/build-outputs.mk b/build-outputs.mk
index 30b4b3fb53a7..5694556673e6 100644
--- a/build-outputs.mk
+++ b/build-outputs.mk
@@ -1,31 +1,32 @@
# DO NOT EDIT. AUTOMATICALLY GENERATED.
-encoding/apr_escape.lo: encoding/apr_escape.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_escape.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
-passwd/apr_getpass.lo: passwd/apr_getpass.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
-strings/apr_cpystrn.lo: strings/apr_cpystrn.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
-strings/apr_cstr.lo: strings/apr_cstr.c .make.dirs include/apr_allocator.h include/apr_cstr.h include/apr_errno.h include/apr_fnmatch.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_want.h
+encoding/apr_encode.lo: encoding/apr_encode.c .make.dirs include/apr_allocator.h include/apr_encode.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
+encoding/apr_escape.lo: encoding/apr_escape.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_escape.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
+passwd/apr_getpass.lo: passwd/apr_getpass.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
+strings/apr_cpystrn.lo: strings/apr_cpystrn.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
+strings/apr_cstr.lo: strings/apr_cstr.c .make.dirs include/apr_allocator.h include/apr_cstr.h include/apr_errno.h include/apr_fnmatch.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
strings/apr_fnmatch.lo: strings/apr_fnmatch.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_fnmatch.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
strings/apr_snprintf.lo: strings/apr_snprintf.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
-strings/apr_strings.lo: strings/apr_strings.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
-strings/apr_strnatcmp.lo: strings/apr_strnatcmp.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
-strings/apr_strtok.lo: strings/apr_strtok.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+strings/apr_strings.lo: strings/apr_strings.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
+strings/apr_strnatcmp.lo: strings/apr_strnatcmp.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
+strings/apr_strtok.lo: strings/apr_strtok.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
tables/apr_hash.lo: tables/apr_hash.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_hash.h include/apr_pools.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
tables/apr_skiplist.lo: tables/apr_skiplist.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_skiplist.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
-tables/apr_tables.lo: tables/apr_tables.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_want.h
+tables/apr_tables.lo: tables/apr_tables.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
-OBJECTS_all = encoding/apr_escape.lo passwd/apr_getpass.lo strings/apr_cpystrn.lo strings/apr_cstr.lo strings/apr_fnmatch.lo strings/apr_snprintf.lo strings/apr_strings.lo strings/apr_strnatcmp.lo strings/apr_strtok.lo tables/apr_hash.lo tables/apr_skiplist.lo tables/apr_tables.lo
+OBJECTS_all = encoding/apr_encode.lo encoding/apr_escape.lo passwd/apr_getpass.lo strings/apr_cpystrn.lo strings/apr_cstr.lo strings/apr_fnmatch.lo strings/apr_snprintf.lo strings/apr_strings.lo strings/apr_strnatcmp.lo strings/apr_strtok.lo tables/apr_hash.lo tables/apr_skiplist.lo tables/apr_tables.lo
dso/unix/dso.lo: dso/unix/dso.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
OBJECTS_dso_unix = dso/unix/dso.lo
-file_io/unix/buffer.lo: file_io/unix/buffer.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_want.h
+file_io/unix/buffer.lo: file_io/unix/buffer.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
file_io/unix/copy.lo: file_io/unix/copy.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
file_io/unix/dir.lo: file_io/unix/dir.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
-file_io/unix/fileacc.lo: file_io/unix/fileacc.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+file_io/unix/fileacc.lo: file_io/unix/fileacc.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
file_io/unix/filedup.lo: file_io/unix/filedup.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
file_io/unix/filepath.lo: file_io/unix/filepath.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
-file_io/unix/filepath_util.lo: file_io/unix/filepath_util.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_want.h
+file_io/unix/filepath_util.lo: file_io/unix/filepath_util.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
file_io/unix/filestat.lo: file_io/unix/filestat.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
file_io/unix/flock.lo: file_io/unix/flock.c .make.dirs
file_io/unix/fullrw.lo: file_io/unix/fullrw.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
@@ -39,7 +40,7 @@ file_io/unix/tempdir.lo: file_io/unix/tempdir.c .make.dirs include/apr_allocator
OBJECTS_file_io_unix = file_io/unix/buffer.lo file_io/unix/copy.lo file_io/unix/dir.lo file_io/unix/fileacc.lo file_io/unix/filedup.lo file_io/unix/filepath.lo file_io/unix/filepath_util.lo file_io/unix/filestat.lo file_io/unix/flock.lo file_io/unix/fullrw.lo file_io/unix/mktemp.lo file_io/unix/open.lo file_io/unix/pipe.lo file_io/unix/readwrite.lo file_io/unix/seek.lo file_io/unix/tempdir.lo
locks/unix/global_mutex.lo: locks/unix/global_mutex.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
-locks/unix/proc_mutex.lo: locks/unix/proc_mutex.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_errno.h include/apr_general.h include/apr_hash.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+locks/unix/proc_mutex.lo: locks/unix/proc_mutex.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_errno.h include/apr_general.h include/apr_hash.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
locks/unix/thread_cond.lo: locks/unix/thread_cond.c .make.dirs
locks/unix/thread_mutex.lo: locks/unix/thread_mutex.c .make.dirs include/apr_want.h
locks/unix/thread_rwlock.lo: locks/unix/thread_rwlock.c .make.dirs
@@ -51,13 +52,13 @@ memory/unix/apr_pools.lo: memory/unix/apr_pools.c .make.dirs include/apr_allocat
OBJECTS_memory_unix = memory/unix/apr_pools.lo
misc/unix/charset.lo: misc/unix/charset.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
-misc/unix/env.lo: misc/unix/env.c .make.dirs include/apr_allocator.h include/apr_env.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
-misc/unix/errorcodes.lo: misc/unix/errorcodes.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
-misc/unix/getopt.lo: misc/unix/getopt.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+misc/unix/env.lo: misc/unix/env.c .make.dirs include/apr_allocator.h include/apr_env.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
+misc/unix/errorcodes.lo: misc/unix/errorcodes.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
+misc/unix/getopt.lo: misc/unix/getopt.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
misc/unix/otherchild.lo: misc/unix/otherchild.c .make.dirs
-misc/unix/rand.lo: misc/unix/rand.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_want.h
-misc/unix/start.lo: misc/unix/start.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_signal.h include/apr_thread_mutex.h include/apr_want.h
-misc/unix/version.lo: misc/unix/version.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_version.h include/apr_want.h
+misc/unix/rand.lo: misc/unix/rand.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
+misc/unix/start.lo: misc/unix/start.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_signal.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
+misc/unix/version.lo: misc/unix/version.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_time.h include/apr_version.h include/apr_want.h
OBJECTS_misc_unix = misc/unix/charset.lo misc/unix/env.lo misc/unix/errorcodes.lo misc/unix/getopt.lo misc/unix/otherchild.lo misc/unix/rand.lo misc/unix/start.lo misc/unix/version.lo
@@ -66,14 +67,14 @@ mmap/unix/mmap.lo: mmap/unix/mmap.c .make.dirs include/apr_allocator.h include/a
OBJECTS_mmap_unix = mmap/unix/common.lo mmap/unix/mmap.lo
-network_io/unix/inet_ntop.lo: network_io/unix/inet_ntop.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+network_io/unix/inet_ntop.lo: network_io/unix/inet_ntop.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
network_io/unix/inet_pton.lo: network_io/unix/inet_pton.c .make.dirs
network_io/unix/multicast.lo: network_io/unix/multicast.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_support.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
network_io/unix/sendrecv.lo: network_io/unix/sendrecv.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_support.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
-network_io/unix/sockaddr.lo: network_io/unix/sockaddr.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+network_io/unix/sockaddr.lo: network_io/unix/sockaddr.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
network_io/unix/socket_util.lo: network_io/unix/socket_util.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_poll.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
network_io/unix/sockets.lo: network_io/unix/sockets.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_support.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
-network_io/unix/sockopt.lo: network_io/unix/sockopt.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+network_io/unix/sockopt.lo: network_io/unix/sockopt.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
OBJECTS_network_io_unix = network_io/unix/inet_ntop.lo network_io/unix/inet_pton.lo network_io/unix/multicast.lo network_io/unix/sendrecv.lo network_io/unix/sockaddr.lo network_io/unix/socket_util.lo network_io/unix/sockets.lo network_io/unix/sockopt.lo
@@ -95,7 +96,7 @@ random/unix/sha2_glue.lo: random/unix/sha2_glue.c .make.dirs include/apr_allocat
OBJECTS_random_unix = random/unix/apr_random.lo random/unix/sha2.lo random/unix/sha2_glue.lo
-shmem/unix/shm.lo: shmem/unix/shm.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_hash.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_user.h include/apr_want.h
+shmem/unix/shm.lo: shmem/unix/shm.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_hash.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
OBJECTS_shmem_unix = shmem/unix/shm.lo
@@ -105,7 +106,7 @@ OBJECTS_support_unix = support/unix/waitio.lo
threadproc/unix/proc.lo: threadproc/unix/proc.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_random.h include/apr_shm.h include/apr_signal.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
threadproc/unix/procsup.lo: threadproc/unix/procsup.c .make.dirs
-threadproc/unix/signals.lo: threadproc/unix/signals.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_signal.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+threadproc/unix/signals.lo: threadproc/unix/signals.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_signal.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
threadproc/unix/thread.lo: threadproc/unix/thread.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
threadproc/unix/threadpriv.lo: threadproc/unix/threadpriv.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
@@ -122,13 +123,15 @@ user/unix/userinfo.lo: user/unix/userinfo.c .make.dirs include/apr_allocator.h i
OBJECTS_user_unix = user/unix/groupinfo.lo user/unix/userinfo.lo
atomic/unix/builtins.lo: atomic/unix/builtins.c .make.dirs
+atomic/unix/builtins64.lo: atomic/unix/builtins64.c .make.dirs
atomic/unix/ia32.lo: atomic/unix/ia32.c .make.dirs
-atomic/unix/mutex.lo: atomic/unix/mutex.c .make.dirs
+atomic/unix/mutex.lo: atomic/unix/mutex.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
+atomic/unix/mutex64.lo: atomic/unix/mutex64.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
atomic/unix/ppc.lo: atomic/unix/ppc.c .make.dirs
atomic/unix/s390.lo: atomic/unix/s390.c .make.dirs
atomic/unix/solaris.lo: atomic/unix/solaris.c .make.dirs
-OBJECTS_atomic_unix = atomic/unix/builtins.lo atomic/unix/ia32.lo atomic/unix/mutex.lo atomic/unix/ppc.lo atomic/unix/s390.lo atomic/unix/solaris.lo
+OBJECTS_atomic_unix = atomic/unix/builtins.lo atomic/unix/builtins64.lo atomic/unix/ia32.lo atomic/unix/mutex.lo atomic/unix/mutex64.lo atomic/unix/ppc.lo atomic/unix/s390.lo atomic/unix/solaris.lo
OBJECTS_unix = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_unix) $(OBJECTS_file_io_unix) $(OBJECTS_locks_unix) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_unix) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_unix) $(OBJECTS_support_unix) $(OBJECTS_threadproc_unix) $(OBJECTS_time_unix) $(OBJECTS_user_unix)
@@ -159,7 +162,7 @@ shmem/beos/shm.lo: shmem/beos/shm.c .make.dirs include/apr_allocator.h include/a
OBJECTS_shmem_beos = shmem/beos/shm.lo
threadproc/beos/apr_proc_stub.lo: threadproc/beos/apr_proc_stub.c .make.dirs
-threadproc/beos/proc.lo: threadproc/beos/proc.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+threadproc/beos/proc.lo: threadproc/beos/proc.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
threadproc/beos/thread.lo: threadproc/beos/thread.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
threadproc/beos/threadpriv.lo: threadproc/beos/threadpriv.c .make.dirs
threadproc/beos/threadproc_common.lo: threadproc/beos/threadproc_common.c .make.dirs
@@ -172,7 +175,7 @@ dso/os2/dso.lo: dso/os2/dso.c .make.dirs include/apr_allocator.h include/apr_dso
OBJECTS_dso_os2 = dso/os2/dso.lo
-file_io/os2/buffer.lo: file_io/os2/buffer.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_want.h
+file_io/os2/buffer.lo: file_io/os2/buffer.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
file_io/os2/copy.lo: file_io/os2/copy.c .make.dirs
file_io/os2/dir.lo: file_io/os2/dir.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_lib.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
file_io/os2/dir_make_recurse.lo: file_io/os2/dir_make_recurse.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
@@ -181,7 +184,7 @@ file_io/os2/filedup.lo: file_io/os2/filedup.c .make.dirs include/apr_allocator.h
file_io/os2/filepath.lo: file_io/os2/filepath.c .make.dirs
file_io/os2/filepath_util.lo: file_io/os2/filepath_util.c .make.dirs
file_io/os2/filestat.lo: file_io/os2/filestat.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
-file_io/os2/filesys.lo: file_io/os2/filesys.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+file_io/os2/filesys.lo: file_io/os2/filesys.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
file_io/os2/flock.lo: file_io/os2/flock.c .make.dirs
file_io/os2/fullrw.lo: file_io/os2/fullrw.c .make.dirs
file_io/os2/maperrorcode.lo: file_io/os2/maperrorcode.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
@@ -235,22 +238,22 @@ dso/os390/dso.lo: dso/os390/dso.c .make.dirs include/apr_allocator.h include/apr
OBJECTS_dso_os390 = dso/os390/dso.lo
-atomic/os390/atomic.lo: atomic/os390/atomic.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_want.h
+atomic/os390/atomic.lo: atomic/os390/atomic.c .make.dirs
OBJECTS_atomic_os390 = atomic/os390/atomic.lo
OBJECTS_os390 = $(OBJECTS_all) $(OBJECTS_atomic_os390) $(OBJECTS_dso_os390) $(OBJECTS_file_io_unix) $(OBJECTS_locks_unix) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_unix) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_unix) $(OBJECTS_support_unix) $(OBJECTS_threadproc_unix) $(OBJECTS_time_unix) $(OBJECTS_user_unix)
-dso/win32/dso.lo: dso/win32/dso.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+dso/win32/dso.lo: dso/win32/dso.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
OBJECTS_dso_win32 = dso/win32/dso.lo
-file_io/win32/buffer.lo: file_io/win32/buffer.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_want.h
+file_io/win32/buffer.lo: file_io/win32/buffer.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
file_io/win32/dir.lo: file_io/win32/dir.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
file_io/win32/filedup.lo: file_io/win32/filedup.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
-file_io/win32/filepath.lo: file_io/win32/filepath.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+file_io/win32/filepath.lo: file_io/win32/filepath.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_lib.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
file_io/win32/filestat.lo: file_io/win32/filestat.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
-file_io/win32/filesys.lo: file_io/win32/filesys.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+file_io/win32/filesys.lo: file_io/win32/filesys.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
file_io/win32/flock.lo: file_io/win32/flock.c .make.dirs
file_io/win32/open.lo: file_io/win32/open.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
file_io/win32/pipe.lo: file_io/win32/pipe.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_escape.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_inherit.h include/apr_pools.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_time.h include/apr_user.h include/apr_want.h
@@ -267,11 +270,11 @@ locks/win32/thread_rwlock.lo: locks/win32/thread_rwlock.c .make.dirs include/apr
OBJECTS_locks_win32 = locks/win32/proc_mutex.lo locks/win32/thread_cond.lo locks/win32/thread_mutex.lo locks/win32/thread_rwlock.lo
misc/win32/charset.lo: misc/win32/charset.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_strings.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
-misc/win32/env.lo: misc/win32/env.c .make.dirs include/apr_allocator.h include/apr_env.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_want.h
+misc/win32/env.lo: misc/win32/env.c .make.dirs include/apr_allocator.h include/apr_env.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_strings.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
misc/win32/internal.lo: misc/win32/internal.c .make.dirs
misc/win32/misc.lo: misc/win32/misc.c .make.dirs include/apr_errno.h include/apr_lib.h
misc/win32/rand.lo: misc/win32/rand.c .make.dirs include/apr_allocator.h include/apr_dso.h include/apr_errno.h include/apr_file_info.h include/apr_file_io.h include/apr_general.h include/apr_global_mutex.h include/apr_inherit.h include/apr_network_io.h include/apr_perms_set.h include/apr_pools.h include/apr_portable.h include/apr_proc_mutex.h include/apr_shm.h include/apr_tables.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_time.h include/apr_user.h include/apr_want.h
-misc/win32/start.lo: misc/win32/start.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_signal.h include/apr_thread_mutex.h include/apr_want.h
+misc/win32/start.lo: misc/win32/start.c .make.dirs include/apr_allocator.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_signal.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
misc/win32/utf8.lo: misc/win32/utf8.c .make.dirs include/apr_errno.h
OBJECTS_misc_win32 = misc/unix/errorcodes.lo misc/unix/getopt.lo misc/unix/otherchild.lo misc/unix/version.lo misc/win32/charset.lo misc/win32/env.lo misc/win32/internal.lo misc/win32/misc.lo misc/win32/rand.lo misc/win32/start.lo misc/win32/utf8.lo
@@ -307,15 +310,16 @@ user/win32/userinfo.lo: user/win32/userinfo.c .make.dirs include/apr_allocator.h
OBJECTS_user_win32 = user/win32/groupinfo.lo user/win32/userinfo.lo
-atomic/win32/apr_atomic.lo: atomic/win32/apr_atomic.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_want.h
+atomic/win32/apr_atomic.lo: atomic/win32/apr_atomic.c .make.dirs
+atomic/win32/apr_atomic64.lo: atomic/win32/apr_atomic64.c .make.dirs include/apr_allocator.h include/apr_atomic.h include/apr_errno.h include/apr_general.h include/apr_pools.h include/apr_thread_mutex.h include/apr_time.h include/apr_want.h
-OBJECTS_atomic_win32 = atomic/win32/apr_atomic.lo
+OBJECTS_atomic_win32 = atomic/win32/apr_atomic.lo atomic/win32/apr_atomic64.lo
OBJECTS_win32 = $(OBJECTS_all) $(OBJECTS_atomic_win32) $(OBJECTS_dso_win32) $(OBJECTS_file_io_win32) $(OBJECTS_locks_win32) $(OBJECTS_memory_unix) $(OBJECTS_misc_win32) $(OBJECTS_mmap_win32) $(OBJECTS_network_io_win32) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_win32) $(OBJECTS_support_unix) $(OBJECTS_threadproc_win32) $(OBJECTS_time_win32) $(OBJECTS_user_win32)
-HEADERS = $(top_srcdir)/include/apr_allocator.h $(top_srcdir)/include/apr_atomic.h $(top_srcdir)/include/apr_cstr.h $(top_srcdir)/include/apr_dso.h $(top_srcdir)/include/apr_env.h $(top_srcdir)/include/apr_errno.h $(top_srcdir)/include/apr_escape.h $(top_srcdir)/include/apr_file_info.h $(top_srcdir)/include/apr_file_io.h $(top_srcdir)/include/apr_fnmatch.h $(top_srcdir)/include/apr_general.h $(top_srcdir)/include/apr_getopt.h $(top_srcdir)/include/apr_global_mutex.h $(top_srcdir)/include/apr_hash.h $(top_srcdir)/include/apr_inherit.h $(top_srcdir)/include/apr_lib.h $(top_srcdir)/include/apr_mmap.h $(top_srcdir)/include/apr_network_io.h $(top_srcdir)/include/apr_perms_set.h $(top_srcdir)/include/apr_poll.h $(top_srcdir)/include/apr_pools.h $(top_srcdir)/include/apr_portable.h $(top_srcdir)/include/apr_proc_mutex.h $(top_srcdir)/include/apr_random.h $(top_srcdir)/include/apr_ring.h $(top_srcdir)/include/apr_shm.h $(top_srcdir)/include/apr_signal.h $(top_srcdir)/include/apr_skiplist.h $(top_srcdir)/include/apr_strings.h $(top_srcdir)/include/apr_support.h $(top_srcdir)/include/apr_tables.h $(top_srcdir)/include/apr_thread_cond.h $(top_srcdir)/include/apr_thread_mutex.h $(top_srcdir)/include/apr_thread_proc.h $(top_srcdir)/include/apr_thread_rwlock.h $(top_srcdir)/include/apr_time.h $(top_srcdir)/include/apr_user.h $(top_srcdir)/include/apr_version.h $(top_srcdir)/include/apr_want.h
+HEADERS = $(top_srcdir)/include/apr_allocator.h $(top_srcdir)/include/apr_atomic.h $(top_srcdir)/include/apr_cstr.h $(top_srcdir)/include/apr_dso.h $(top_srcdir)/include/apr_encode.h $(top_srcdir)/include/apr_env.h $(top_srcdir)/include/apr_errno.h $(top_srcdir)/include/apr_escape.h $(top_srcdir)/include/apr_file_info.h $(top_srcdir)/include/apr_file_io.h $(top_srcdir)/include/apr_fnmatch.h $(top_srcdir)/include/apr_general.h $(top_srcdir)/include/apr_getopt.h $(top_srcdir)/include/apr_global_mutex.h $(top_srcdir)/include/apr_hash.h $(top_srcdir)/include/apr_inherit.h $(top_srcdir)/include/apr_lib.h $(top_srcdir)/include/apr_mmap.h $(top_srcdir)/include/apr_network_io.h $(top_srcdir)/include/apr_perms_set.h $(top_srcdir)/include/apr_poll.h $(top_srcdir)/include/apr_pools.h $(top_srcdir)/include/apr_portable.h $(top_srcdir)/include/apr_proc_mutex.h $(top_srcdir)/include/apr_random.h $(top_srcdir)/include/apr_ring.h $(top_srcdir)/include/apr_shm.h $(top_srcdir)/include/apr_signal.h $(top_srcdir)/include/apr_skiplist.h $(top_srcdir)/include/apr_strings.h $(top_srcdir)/include/apr_support.h $(top_srcdir)/include/apr_tables.h $(top_srcdir)/include/apr_thread_cond.h $(top_srcdir)/include/apr_thread_mutex.h $(top_srcdir)/include/apr_thread_proc.h $(top_srcdir)/include/apr_thread_rwlock.h $(top_srcdir)/include/apr_time.h $(top_srcdir)/include/apr_user.h $(top_srcdir)/include/apr_version.h $(top_srcdir)/include/apr_want.h
-SOURCE_DIRS = random/unix misc/win32 encoding dso/os2 time/unix network_io/win32 dso/win32 locks/unix user/unix time/win32 locks/beos tables support/unix file_io/unix mmap/unix atomic/unix threadproc/win32 poll/os2 atomic/win32 dso/os390 atomic/os390 dso/beos poll/unix passwd network_io/beos threadproc/os2 network_io/os2 shmem/win32 threadproc/beos shmem/unix network_io/unix file_io/os2 mmap/win32 dso/aix file_io/win32 threadproc/unix misc/unix locks/win32 shmem/beos dso/unix locks/os2 user/win32 shmem/os2 memory/unix strings $(EXTRA_SOURCE_DIRS)
+SOURCE_DIRS = encoding passwd strings tables dso/unix file_io/unix locks/unix memory/unix misc/unix mmap/unix network_io/unix poll/unix random/unix shmem/unix support/unix threadproc/unix time/unix user/unix atomic/unix dso/aix dso/beos locks/beos network_io/beos shmem/beos threadproc/beos dso/os2 file_io/os2 locks/os2 network_io/os2 poll/os2 shmem/os2 threadproc/os2 dso/os390 atomic/os390 dso/win32 file_io/win32 locks/win32 misc/win32 mmap/win32 network_io/win32 shmem/win32 threadproc/win32 time/win32 user/win32 atomic/win32 $(EXTRA_SOURCE_DIRS)
BUILD_DIRS = atomic atomic/os390 atomic/unix atomic/win32 dso dso/aix dso/beos dso/os2 dso/os390 dso/unix dso/win32 encoding file_io file_io/os2 file_io/unix file_io/win32 locks locks/beos locks/os2 locks/unix locks/win32 memory memory/unix misc misc/unix misc/win32 mmap mmap/unix mmap/win32 network_io network_io/beos network_io/os2 network_io/unix network_io/win32 passwd poll poll/os2 poll/unix random random/unix shmem shmem/beos shmem/os2 shmem/unix shmem/win32 strings support support/unix tables threadproc threadproc/beos threadproc/os2 threadproc/unix threadproc/win32 time time/unix time/win32 user user/unix user/win32
diff --git a/buildconf b/buildconf
index b70fa53eca16..fa52bd11b4f6 100755
--- a/buildconf
+++ b/buildconf
@@ -112,8 +112,10 @@ ${AUTOCONF:-autoconf} $verbose
# Remove autoconf 2.5x's cache directory
rm -rf autom4te*.cache
+PYTHON=${PYTHON-`build/PrintPath python3 python2 python`}
+
echo "buildconf: generating 'make' outputs ..."
-build/gen-build.py $verbose make
+${PYTHON} build/gen-build.py $verbose make
# Create RPM Spec file
if [ -f `which cut` ]; then
diff --git a/configure b/configure
index ade76d97a0ae..724af6b394a8 100755
--- a/configure
+++ b/configure
@@ -655,6 +655,7 @@ apr_thread_func
apr_procattr_user_set_requires_password
apr_has_xthread_files
have_unicode_fs
+apr_has_timedlocks
have_ipv6
have_sockaddr_un
have_sa_storage
@@ -678,6 +679,8 @@ hasfcntlser
hasposixser
hassysvser
hasflockser
+have_pthread_condattr_setpshared
+have_pthread_mutex_timedlock
have_union_semun
struct_rlimit
have_proc_invoked
@@ -708,8 +711,8 @@ socklen_t_value
ssize_t_value
size_t_value
off_t_value
+uint64_value
int64_value
-long_value
int_value
short_value
voidp_size
@@ -744,6 +747,7 @@ sys_syslimitsh
netdbh
limitsh
ioh
+inttypesh
fcntlh
direnth
errnoh
@@ -934,6 +938,7 @@ enable_other_child
with_egd
with_devrandom
enable_ipv6
+enable_timedlocks
'
ac_precious_vars='build_alias
host_alias
@@ -1580,6 +1585,7 @@ Optional Features:
--disable-dso Disable DSO support
--enable-other-child Enable reliable child processes
--disable-ipv6 Disable IPv6 support in APR.
+ --disable-timedlocks Disable timed locks
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -2920,6 +2926,8 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
#
# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc.
@@ -7285,6 +7293,16 @@ if test "x$apr_preload_done" != "xyes" ; then
done
fi
+ if test $PLATOSVERS -eq 10; then
+ # pthread_mutex_timedlock is broken on Solaris 10.
+ # It can block without timeout in case of EDEADLK.
+
+ if test -z "$ac_cv_func_pthread_mutex_timedlock"; then
+ test "x$silent" != "xyes" && echo " setting ac_cv_func_pthread_mutex_timedlock to \"no\""
+ ac_cv_func_pthread_mutex_timedlock="no"
+ fi
+
+ fi
if test $PLATOSVERS -ge 10; then
if test -z "$apr_lock_method"; then
@@ -18285,8 +18303,12 @@ CC=$lt_save_CC
# get libtool's setting of shlibpath_var
- eval `grep "^shlibpath_var=[A-Z_]*$" $apr_builddir/libtool`
if test "x$shlibpath_var" = "x"; then
+ eval `grep "^shlibpath_var=[A-Z_]*$" $apr_builddir/libtool`
+ fi
+ if test "x$shlibpath_var" = "x"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: SHLIBPATH variable could not be determined" >&5
+$as_echo "$as_me: SHLIBPATH variable could not be determined" >&6;}
shlibpath_var=REPLACE_WITH_YOUR_SHLIBPATH_VAR
fi
fi
@@ -20545,54 +20567,15 @@ done
fi
fi
-ac_cv_define_READDIR_IS_THREAD_SAFE=no
+ac_cv_define_READDIR_IS_THREAD_SAFE=yes
ac_cv_define_GETHOSTBYNAME_IS_THREAD_SAFE=no
ac_cv_define_GETHOSTBYADDR_IS_THREAD_SAFE=no
ac_cv_define_GETSERVBYNAME_IS_THREAD_SAFE=no
if test "$threads" = "1"; then
echo "APR will use threads"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readdir in -lc_r" >&5
-$as_echo_n "checking for readdir in -lc_r... " >&6; }
-if ${ac_cv_lib_c_r_readdir+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc_r $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char readdir ();
-int
-main ()
-{
-return readdir ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_c_r_readdir=yes
-else
- ac_cv_lib_c_r_readdir=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_readdir" >&5
-$as_echo "$ac_cv_lib_c_r_readdir" >&6; }
-if test "x$ac_cv_lib_c_r_readdir" = xyes; then :
$as_echo "#define READDIR_IS_THREAD_SAFE 1" >>confdefs.h
-fi
-
if test "x$apr_gethostbyname_is_thread_safe" = "x"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lc_r" >&5
$as_echo_n "checking for gethostbyname in -lc_r... " >&6; }
@@ -23211,6 +23194,7 @@ for ac_header in ByteOrder.h \
errno.h \
fcntl.h \
grp.h \
+ inttypes.h \
io.h \
limits.h \
mach-o/dyld.h \
@@ -23288,6 +23272,7 @@ for aprt_i in ByteOrder.h \
errno.h \
fcntl.h \
grp.h \
+ inttypes.h \
io.h \
limits.h \
mach-o/dyld.h \
@@ -23426,6 +23411,7 @@ fi
+
# Checking for h_errno in <netdb.h>
if test "$netdbh" = "1"; then
@@ -24004,32 +23990,32 @@ _ACEOF
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
-$as_echo_n "checking size of int... " >&6; }
-if ${ac_cv_sizeof_int+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
+$as_echo_n "checking size of short... " >&6; }
+if ${ac_cv_sizeof_short+:} false; then :
$as_echo_n "(cached) " >&6
else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then :
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then :
else
- if test "$ac_cv_type_int" = yes; then
+ if test "$ac_cv_type_short" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (int)
+as_fn_error 77 "cannot compute sizeof (short)
See \`config.log' for more details" "$LINENO" 5; }
else
- ac_cv_sizeof_int=0
+ ac_cv_sizeof_short=0
fi
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
-$as_echo "$ac_cv_sizeof_int" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
+$as_echo "$ac_cv_sizeof_short" >&6; }
cat >>confdefs.h <<_ACEOF
-#define SIZEOF_INT $ac_cv_sizeof_int
+#define SIZEOF_SHORT $ac_cv_sizeof_short
_ACEOF
@@ -24037,32 +24023,32 @@ _ACEOF
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
-$as_echo_n "checking size of long... " >&6; }
-if ${ac_cv_sizeof_long+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
+if ${ac_cv_sizeof_int+:} false; then :
$as_echo_n "(cached) " >&6
else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then :
else
- if test "$ac_cv_type_long" = yes; then
+ if test "$ac_cv_type_int" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (long)
+as_fn_error 77 "cannot compute sizeof (int)
See \`config.log' for more details" "$LINENO" 5; }
else
- ac_cv_sizeof_long=0
+ ac_cv_sizeof_int=0
fi
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
-$as_echo "$ac_cv_sizeof_long" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
+#define SIZEOF_INT $ac_cv_sizeof_int
_ACEOF
@@ -24070,32 +24056,32 @@ _ACEOF
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
-$as_echo_n "checking size of short... " >&6; }
-if ${ac_cv_sizeof_short+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if ${ac_cv_sizeof_long+:} false; then :
$as_echo_n "(cached) " >&6
else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then :
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
else
- if test "$ac_cv_type_short" = yes; then
+ if test "$ac_cv_type_long" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (short)
+as_fn_error 77 "cannot compute sizeof (long)
See \`config.log' for more details" "$LINENO" 5; }
else
- ac_cv_sizeof_short=0
+ ac_cv_sizeof_long=0
fi
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
-$as_echo "$ac_cv_sizeof_short" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
cat >>confdefs.h <<_ACEOF
-#define SIZEOF_SHORT $ac_cv_sizeof_short
+#define SIZEOF_LONG $ac_cv_sizeof_long
_ACEOF
@@ -24139,16 +24125,227 @@ fi
if test "$ac_cv_sizeof_int" = "4"; then
int_value=int
fi
+
# Now we need to find what apr_int64_t (sizeof == 8) will be.
-# The first match is our preference.
-if test "$ac_cv_sizeof_int" = "8"; then
+# The first match is our preference (use inttypes if available).
+ac_rc=yes
+for ac_spec in header:stdint.h header:inttypes.h; do
+ ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
+ ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
+ case $ac_type in
+ header )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_header_$ac_item"
+ ;;
+ file )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_file_$ac_item"
+ ;;
+ func ) ac_var="ac_cv_func_$ac_item" ;;
+ struct ) ac_var="ac_cv_struct_$ac_item" ;;
+ define ) ac_var="ac_cv_define_$ac_item" ;;
+ custom ) ac_var="$ac_item" ;;
+ esac
+ eval "ac_val=\$$ac_var"
+ if test ".$ac_val" != .yes; then
+ ac_rc=no
+ break
+ fi
+done
+if test ".$ac_rc" = .yes; then
+ :
+ hasinttypes="1"
+else
+ :
+ hasinttypes="0"
+fi
+
+if test "$hasinttypes" = "1"; then
+ int64_literal='#define APR_INT64_C(val) INT64_C(val)'
+ uint64_literal='#define APR_UINT64_C(val) UINT64_C(val)'
+ int64_t_fmt='#define APR_INT64_T_FMT PRId64'
+ uint64_t_fmt='#define APR_UINT64_T_FMT PRIu64'
+ uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT PRIx64'
+ int64_value="int64_t"
+ uint64_value="uint64_t"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether int64_t and int use fmt %d" >&5
+$as_echo_n "checking whether int64_t and int use fmt %d... " >&6; }
+if ${apr_cv_typematch_int64_t_int_d+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_c_compiler_gnu" = "yes"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include "confdefs.h"
+
+ #include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+ int main(int argc, const char *const *argv) {
+
+ int64_t chk1, *ptr1;
+ int chk2, *ptr2 = &chk1;
+ ptr1 = &chk2;
+ *ptr1 = *ptr2 = 0;
+ printf("%d %d", chk1, chk2);
+
+ return 0; }
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_int64_t_int_d=yes
+else
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_int64_t_int_d=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_int64_t_int_d" >&5
+$as_echo "$apr_cv_typematch_int64_t_int_d" >&6; }
+if test "$apr_cv_typematch_int64_t_int_d" = "yes"; then
+ :
+
+ int64_strfn="strtoi"
+
+else
+ :
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether int64_t and long use fmt %ld" >&5
+$as_echo_n "checking whether int64_t and long use fmt %ld... " >&6; }
+if ${apr_cv_typematch_int64_t_long_ld+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_c_compiler_gnu" = "yes"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include "confdefs.h"
+
+ #include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+ int main(int argc, const char *const *argv) {
+
+ int64_t chk1, *ptr1;
+ long chk2, *ptr2 = &chk1;
+ ptr1 = &chk2;
+ *ptr1 = *ptr2 = 0;
+ printf("%ld %ld", chk1, chk2);
+
+ return 0; }
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_int64_t_long_ld=yes
+else
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_int64_t_long_ld=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_int64_t_long_ld" >&5
+$as_echo "$apr_cv_typematch_int64_t_long_ld" >&6; }
+if test "$apr_cv_typematch_int64_t_long_ld" = "yes"; then
+ :
+
+ int64_strfn="strtol"
+
+else
+ :
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether int64_t and long long use fmt %lld" >&5
+$as_echo_n "checking whether int64_t and long long use fmt %lld... " >&6; }
+if ${apr_cv_typematch_int64_t_long_long_lld+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_c_compiler_gnu" = "yes"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include "confdefs.h"
+
+ #include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+ int main(int argc, const char *const *argv) {
+
+ int64_t chk1, *ptr1;
+ long long chk2, *ptr2 = &chk1;
+ ptr1 = &chk2;
+ *ptr1 = *ptr2 = 0;
+ printf("%lld %lld", chk1, chk2);
+
+ return 0; }
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_int64_t_long_long_lld=yes
+else
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_int64_t_long_long_lld=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_int64_t_long_long_lld" >&5
+$as_echo "$apr_cv_typematch_int64_t_long_long_lld" >&6; }
+if test "$apr_cv_typematch_int64_t_long_long_lld" = "yes"; then
+ :
+
+ int64_strfn="strtoll"
+
+else
+ :
+
+ as_fn_error $? "could not determine the string function for int64_t" "$LINENO" 5
+
+fi
+
+fi
+
+fi
+
+elif test "$ac_cv_sizeof_int" = "8"; then
int64_literal='#define APR_INT64_C(val) (val)'
uint64_literal='#define APR_UINT64_C(val) (val##U)'
int64_t_fmt='#define APR_INT64_T_FMT "d"'
uint64_t_fmt='#define APR_UINT64_T_FMT "u"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "x"'
int64_value="int"
- long_value=int
+ uint64_value="unsigned int"
int64_strfn="strtoi"
elif test "$ac_cv_sizeof_long" = "8"; then
int64_literal='#define APR_INT64_C(val) (val##L)'
@@ -24157,7 +24354,7 @@ elif test "$ac_cv_sizeof_long" = "8"; then
uint64_t_fmt='#define APR_UINT64_T_FMT "lu"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "lx"'
int64_value="long"
- long_value=long
+ uint64_value="unsigned long"
int64_strfn="strtol"
elif test "$ac_cv_sizeof_long_long" = "8"; then
int64_literal='#define APR_INT64_C(val) (val##LL)'
@@ -24170,7 +24367,7 @@ elif test "$ac_cv_sizeof_long_long" = "8"; then
uint64_t_fmt='#define APR_UINT64_T_FMT "llu"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "llx"'
int64_value="long long"
- long_value="long long"
+ uint64_value="unsigned long long"
int64_strfn="strtoll"
elif test "$ac_cv_sizeof_longlong" = "8"; then
int64_literal='#define APR_INT64_C(val) (val##LL)'
@@ -24179,7 +24376,7 @@ elif test "$ac_cv_sizeof_longlong" = "8"; then
uint64_t_fmt='#define APR_UINT64_T_FMT "qu"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "qx"'
int64_value="__int64"
- long_value="__int64"
+ uint64_value="unsigned __int64"
int64_strfn="strtoll"
else
# int64_literal may be overriden if your compiler thinks you have
@@ -24368,138 +24565,228 @@ case $host in
uint64_t_fmt='#define APR_UINT64_T_FMT "I64u"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "I64x"'
int64_value="__int64"
- long_value="__int64"
+ uint64_value="unsigned __int64"
int64_strfn="_strtoi64"
;;
esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ssize_t and int are the same" >&5
-$as_echo_n "checking whether ssize_t and int are the same... " >&6; }
-if ${apr_cv_typematch_ssize_t_int+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ssize_t and long use fmt %ld" >&5
+$as_echo_n "checking whether ssize_t and long use fmt %ld... " >&6; }
+if ${apr_cv_typematch_ssize_t_long_ld+:} false; then :
$as_echo_n "(cached) " >&6
else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_c_compiler_gnu" = "yes"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
+#include "confdefs.h"
- int foo[0 - !__builtin_types_compatible_p(ssize_t, int)];
+ #include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+ int main(int argc, const char *const *argv) {
+
+ ssize_t chk1, *ptr1;
+ long chk2, *ptr2 = &chk1;
+ ptr1 = &chk2;
+ *ptr1 = *ptr2 = 0;
+ printf("%ld %ld", chk1, chk2);
+
+ return 0; }
- ;
- return 0;
-}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- apr_cv_typematch_ssize_t_int=yes
-ssize_t_fmt="d"
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_ssize_t_long_ld=yes
else
- apr_cv_typematch_ssize_t_int=no
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_ssize_t_long_ld=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_ssize_t_int" >&5
-$as_echo "$apr_cv_typematch_ssize_t_int" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_ssize_t_long_ld" >&5
+$as_echo "$apr_cv_typematch_ssize_t_long_ld" >&6; }
+if test "$apr_cv_typematch_ssize_t_long_ld" = "yes"; then
+ :
+ ssize_t_fmt="ld"
+else
+ :
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ssize_t and long are the same" >&5
-$as_echo_n "checking whether ssize_t and long are the same... " >&6; }
-if ${apr_cv_typematch_ssize_t_long+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ssize_t and int use fmt %d" >&5
+$as_echo_n "checking whether ssize_t and int use fmt %d... " >&6; }
+if ${apr_cv_typematch_ssize_t_int_d+:} false; then :
$as_echo_n "(cached) " >&6
else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_c_compiler_gnu" = "yes"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
+#include "confdefs.h"
- int foo[0 - !__builtin_types_compatible_p(ssize_t, long)];
+ #include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+ int main(int argc, const char *const *argv) {
+
+ ssize_t chk1, *ptr1;
+ int chk2, *ptr2 = &chk1;
+ ptr1 = &chk2;
+ *ptr1 = *ptr2 = 0;
+ printf("%d %d", chk1, chk2);
+
+ return 0; }
- ;
- return 0;
-}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- apr_cv_typematch_ssize_t_long=yes
-ssize_t_fmt="ld"
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_ssize_t_int_d=yes
else
- apr_cv_typematch_ssize_t_long=no
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_ssize_t_int_d=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_ssize_t_int_d" >&5
+$as_echo "$apr_cv_typematch_ssize_t_int_d" >&6; }
+if test "$apr_cv_typematch_ssize_t_int_d" = "yes"; then
+ :
+ ssize_t_fmt="d"
+else
+ :
+
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_ssize_t_long" >&5
-$as_echo "$apr_cv_typematch_ssize_t_long" >&6; }
+fi
+
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether size_t and unsigned int are the same" >&5
-$as_echo_n "checking whether size_t and unsigned int are the same... " >&6; }
-if ${apr_cv_typematch_size_t_unsigned_int+:} false; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether size_t and unsigned long use fmt %lu" >&5
+$as_echo_n "checking whether size_t and unsigned long use fmt %lu... " >&6; }
+if ${apr_cv_typematch_size_t_unsigned_long_lu+:} false; then :
$as_echo_n "(cached) " >&6
else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_c_compiler_gnu" = "yes"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
+#include "confdefs.h"
+
+ #include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
- int foo[0 - !__builtin_types_compatible_p(size_t, unsigned int)];
+ int main(int argc, const char *const *argv) {
+
+ size_t chk1, *ptr1;
+ unsigned long chk2, *ptr2 = &chk1;
+ ptr1 = &chk2;
+ *ptr1 = *ptr2 = 0;
+ printf("%lu %lu", chk1, chk2);
+
+ return 0; }
- ;
- return 0;
-}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- apr_cv_typematch_size_t_unsigned_int=yes
-size_t_fmt="u"
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_size_t_unsigned_long_lu=yes
else
- apr_cv_typematch_size_t_unsigned_int=no
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_size_t_unsigned_long_lu=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_size_t_unsigned_int" >&5
-$as_echo "$apr_cv_typematch_size_t_unsigned_int" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_size_t_unsigned_long_lu" >&5
+$as_echo "$apr_cv_typematch_size_t_unsigned_long_lu" >&6; }
+if test "$apr_cv_typematch_size_t_unsigned_long_lu" = "yes"; then
+ :
+ size_t_fmt="lu"
+else
+ :
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether size_t and unsigned long are the same" >&5
-$as_echo_n "checking whether size_t and unsigned long are the same... " >&6; }
-if ${apr_cv_typematch_size_t_unsigned_long+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether size_t and unsigned int use fmt %u" >&5
+$as_echo_n "checking whether size_t and unsigned int use fmt %u... " >&6; }
+if ${apr_cv_typematch_size_t_unsigned_int_u+:} false; then :
$as_echo_n "(cached) " >&6
else
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_c_compiler_gnu" = "yes"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
+#include "confdefs.h"
- int foo[0 - !__builtin_types_compatible_p(size_t, unsigned long)];
+ #include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+ int main(int argc, const char *const *argv) {
+
+ size_t chk1, *ptr1;
+ unsigned int chk2, *ptr2 = &chk1;
+ ptr1 = &chk2;
+ *ptr1 = *ptr2 = 0;
+ printf("%u %u", chk1, chk2);
+
+ return 0; }
- ;
- return 0;
-}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- apr_cv_typematch_size_t_unsigned_long=yes
-size_t_fmt="lu"
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_size_t_unsigned_int_u=yes
else
- apr_cv_typematch_size_t_unsigned_long=no
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_size_t_unsigned_int_u=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_size_t_unsigned_int_u" >&5
+$as_echo "$apr_cv_typematch_size_t_unsigned_int_u" >&6; }
+if test "$apr_cv_typematch_size_t_unsigned_int_u" = "yes"; then
+ :
+ size_t_fmt="u"
+else
+ :
+
+fi
+
+
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_size_t_unsigned_long" >&5
-$as_echo "$apr_cv_typematch_size_t_unsigned_long" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of ssize_t" >&5
@@ -24609,6 +24896,7 @@ _ACEOF
+# else cases below should no longer occur;
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which format to use for apr_size_t" >&5
$as_echo_n "checking which format to use for apr_size_t... " >&6; }
if test -n "$size_t_fmt"; then
@@ -24728,21 +25016,229 @@ elif test "${ac_cv_sizeof_off_t}x${ac_cv_sizeof_long}" = "4x4"; then
off_t_fmt='#define APR_OFF_T_FMT "ld"'
off_t_strfn='strtol'
elif test "$ac_cv_type_off_t" = "yes"; then
- off_t_value=off_t
# off_t is more commonly a long than an int; prefer that case
- # where int and long are the same size.
- if test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long"; then
- off_t_fmt='#define APR_OFF_T_FMT "ld"'
+ # where int and long are the same size and interchangable.
+ off_t_value=off_t
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether off_t and long use fmt %ld" >&5
+$as_echo_n "checking whether off_t and long use fmt %ld... " >&6; }
+if ${apr_cv_typematch_off_t_long_ld+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_c_compiler_gnu" = "yes"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include "confdefs.h"
+
+ #include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+ int main(int argc, const char *const *argv) {
+
+ off_t chk1, *ptr1;
+ long chk2, *ptr2 = &chk1;
+ ptr1 = &chk2;
+ *ptr1 = *ptr2 = 0;
+ printf("%ld %ld", chk1, chk2);
+
+ return 0; }
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_off_t_long_ld=yes
+else
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_off_t_long_ld=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_off_t_long_ld" >&5
+$as_echo "$apr_cv_typematch_off_t_long_ld" >&6; }
+if test "$apr_cv_typematch_off_t_long_ld" = "yes"; then
+ :
+
+ off_t_fmt="#define APR_OFF_T_FMT \"ld\""
off_t_strfn='strtol'
- elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_int"; then
- off_t_fmt='#define APR_OFF_T_FMT "d"'
+
+else
+ :
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether off_t and int use fmt %d" >&5
+$as_echo_n "checking whether off_t and int use fmt %d... " >&6; }
+if ${apr_cv_typematch_off_t_int_d+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_c_compiler_gnu" = "yes"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include "confdefs.h"
+
+ #include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+ int main(int argc, const char *const *argv) {
+
+ off_t chk1, *ptr1;
+ int chk2, *ptr2 = &chk1;
+ ptr1 = &chk2;
+ *ptr1 = *ptr2 = 0;
+ printf("%d %d", chk1, chk2);
+
+ return 0; }
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_off_t_int_d=yes
+else
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_off_t_int_d=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_off_t_int_d" >&5
+$as_echo "$apr_cv_typematch_off_t_int_d" >&6; }
+if test "$apr_cv_typematch_off_t_int_d" = "yes"; then
+ :
+
+ off_t_fmt="#define APR_OFF_T_FMT \"d\""
off_t_strfn='strtoi'
- elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long"; then
- off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT'
+
+else
+ :
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether off_t and long long use fmt %lld" >&5
+$as_echo_n "checking whether off_t and long long use fmt %lld... " >&6; }
+if ${apr_cv_typematch_off_t_long_long_lld+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_c_compiler_gnu" = "yes"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include "confdefs.h"
+
+ #include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+ int main(int argc, const char *const *argv) {
+
+ off_t chk1, *ptr1;
+ long long chk2, *ptr2 = &chk1;
+ ptr1 = &chk2;
+ *ptr1 = *ptr2 = 0;
+ printf("%lld %lld", chk1, chk2);
+
+ return 0; }
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_off_t_long_long_lld=yes
+else
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_off_t_long_long_lld=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_typematch_off_t_long_long_lld" >&5
+$as_echo "$apr_cv_typematch_off_t_long_long_lld" >&6; }
+if test "$apr_cv_typematch_off_t_long_long_lld" = "yes"; then
+ :
+
+ off_t_fmt="#define APR_OFF_T_FMT \"lld\""
+ off_t_strfn='strtoll'
+
+else
+ :
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether off_t and $int64_value use fmt %I64d" >&5
+$as_echo_n "checking whether off_t and $int64_value use fmt %I64d... " >&6; }
+if eval \${apr_cv_typematch_off_t_$int64_value_I64d+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+apr_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS $CFLAGS_WARN"
+ if test "$ac_cv_c_compiler_gnu" = "yes"; then
+ CFLAGS="$CFLAGS -Werror"
+ fi
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include "confdefs.h"
+
+ #include <sys/types.h>
+#include <stdio.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+ int main(int argc, const char *const *argv) {
+
+ off_t chk1, *ptr1;
+ $int64_value chk2, *ptr2 = &chk1;
+ ptr1 = &chk2;
+ *ptr1 = *ptr2 = 0;
+ printf("%I64d %I64d", chk1, chk2);
+
+ return 0; }
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_off_t_$int64_value_I64d=yes
+else
+ CFLAGS=$apr_save_CFLAGS
+apr_cv_typematch_off_t_$int64_value_I64d=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+eval ac_res=\$apr_cv_typematch_off_t_$int64_value_I64d
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test "$apr_cv_typematch_off_t_$int64_value_I64d" = "yes"; then
+ :
+
+ off_t_fmt="#define APR_OFF_T_FMT APR_INT64_T_FMT"
off_t_strfn='apr_strtoi64'
- else
- as_fn_error $? "could not determine the size of off_t" "$LINENO" 5
- fi
+else
+ :
+
# Per OS tuning...
case $host in
*-mingw*)
@@ -24750,7 +25246,19 @@ elif test "$ac_cv_type_off_t" = "yes"; then
off_t_fmt='#define APR_OFF_T_FMT "I64d"'
off_t_strfn='_strtoi64'
;;
+ *)
+ as_fn_error $? "could not determine the size of off_t" "$LINENO" 5
+ ;;
esac
+
+fi
+
+fi
+
+fi
+
+fi
+
else
# Fallback on int
off_t_value=apr_int32_t
@@ -25671,12 +26179,13 @@ apr_save_CFLAGS=$CFLAGS
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- vla_msg=yes
+ CFLAGS=$apr_save_CFLAGS
+vla_msg=yes
else
- vla_msg=no
+ CFLAGS=$apr_save_CFLAGS
+vla_msg=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- CFLAGS=$apr_save_CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $vla_msg" >&5
$as_echo "$vla_msg" >&6; }
@@ -25730,7 +26239,7 @@ test "x$ac_cv_struct_rlimit" = xyes && struct_rlimit=1
echo "${nl}Checking for Locking..."
-for ac_func in semget semctl flock
+for ac_func in semget semctl semop semtimedop flock
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -25742,13 +26251,45 @@ _ACEOF
fi
done
-for ac_header in semaphore.h OS.h
+ac_rc=yes
+for ac_spec in func:semtimedop; do
+ ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
+ ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
+ case $ac_type in
+ header )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_header_$ac_item"
+ ;;
+ file )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_file_$ac_item"
+ ;;
+ func ) ac_var="ac_cv_func_$ac_item" ;;
+ struct ) ac_var="ac_cv_struct_$ac_item" ;;
+ define ) ac_var="ac_cv_define_$ac_item" ;;
+ custom ) ac_var="$ac_item" ;;
+ esac
+ eval "ac_val=\$$ac_var"
+ if test ".$ac_val" != .yes; then
+ ac_rc=no
+ break
+ fi
+done
+if test ".$ac_rc" = .yes; then
+ :
+ have_semtimedop="1"
+else
+ :
+ have_semtimedop="0"
+fi
+
+
+for ac_header in semaphore.h
do :
- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ ac_fn_c_check_header_mongrel "$LINENO" "semaphore.h" "ac_cv_header_semaphore_h" "$ac_includes_default"
+if test "x$ac_cv_header_semaphore_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_SEMAPHORE_H 1
_ACEOF
fi
@@ -25811,7 +26352,64 @@ if test "$ac_res" != no; then :
fi
-for ac_func in sem_close sem_unlink sem_post sem_wait create_sem
+for ac_func in sem_close sem_unlink sem_post sem_wait sem_timedwait
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+ac_rc=yes
+for ac_spec in func:sem_timedwait; do
+ ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
+ ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
+ case $ac_type in
+ header )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_header_$ac_item"
+ ;;
+ file )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_file_$ac_item"
+ ;;
+ func ) ac_var="ac_cv_func_$ac_item" ;;
+ struct ) ac_var="ac_cv_struct_$ac_item" ;;
+ define ) ac_var="ac_cv_define_$ac_item" ;;
+ custom ) ac_var="$ac_item" ;;
+ esac
+ eval "ac_val=\$$ac_var"
+ if test ".$ac_val" != .yes; then
+ ac_rc=no
+ break
+ fi
+done
+if test ".$ac_rc" = .yes; then
+ :
+ have_sem_timedwait="1"
+else
+ :
+ have_sem_timedwait="0"
+fi
+
+
+for ac_header in OS.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "OS.h" "ac_cv_header_OS_h" "$ac_includes_default"
+if test "x$ac_cv_header_OS_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_OS_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_func in create_sem acquire_sem acquire_sem_etc
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -25823,6 +26421,38 @@ _ACEOF
fi
done
+ac_rc=yes
+for ac_spec in header:OS.h func:acquire_sem_etc; do
+ ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
+ ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
+ case $ac_type in
+ header )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_header_$ac_item"
+ ;;
+ file )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_file_$ac_item"
+ ;;
+ func ) ac_var="ac_cv_func_$ac_item" ;;
+ struct ) ac_var="ac_cv_struct_$ac_item" ;;
+ define ) ac_var="ac_cv_define_$ac_item" ;;
+ custom ) ac_var="$ac_item" ;;
+ esac
+ eval "ac_val=\$$ac_var"
+ if test ".$ac_val" != .yes; then
+ ac_rc=no
+ break
+ fi
+done
+if test ".$ac_rc" = .yes; then
+ :
+ have_acquire_sem_etc="1"
+else
+ :
+ have_acquire_sem_etc="0"
+fi
+
# Some systems return ENOSYS from sem_open.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working sem_open" >&5
@@ -26087,17 +26717,51 @@ $as_echo "#define HAVE_PTHREAD_PROCESS_SHARED 1" >>confdefs.h
fi
- for ac_func in pthread_mutexattr_setpshared
+ for ac_func in pthread_mutex_timedlock pthread_mutexattr_setpshared
do :
- ac_fn_c_check_func "$LINENO" "pthread_mutexattr_setpshared" "ac_cv_func_pthread_mutexattr_setpshared"
-if test "x$ac_cv_func_pthread_mutexattr_setpshared" = xyes; then :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_PTHREAD_MUTEXATTR_SETPSHARED 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
+ ac_rc=yes
+for ac_spec in header:pthread.h func:pthread_mutex_timedlock; do
+ ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
+ ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
+ case $ac_type in
+ header )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_header_$ac_item"
+ ;;
+ file )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_file_$ac_item"
+ ;;
+ func ) ac_var="ac_cv_func_$ac_item" ;;
+ struct ) ac_var="ac_cv_struct_$ac_item" ;;
+ define ) ac_var="ac_cv_define_$ac_item" ;;
+ custom ) ac_var="$ac_item" ;;
+ esac
+ eval "ac_val=\$$ac_var"
+ if test ".$ac_val" != .yes; then
+ ac_rc=no
+ break
+ fi
+done
+if test ".$ac_rc" = .yes; then
+ :
+ have_pthread_mutex_timedlock="1"
+else
+ :
+ have_pthread_mutex_timedlock="0"
+fi
+
+
# Some systems have setpshared and define PROCESS_SHARED, but don't
# really support PROCESS_SHARED locks. So, we must validate that we
# can go through the steps without receiving some sort of system error.
@@ -26212,7 +26876,7 @@ int main(int argc, char **argv)
exit(1);
if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED))
exit(2);
- if (pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP))
+ if (pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST))
exit(3);
if (pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT))
exit(4);
@@ -26229,12 +26893,58 @@ _ACEOF
if ac_fn_c_try_run "$LINENO"; then :
apr_cv_mutex_robust_shared=yes
else
+
+if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <sys/types.h>
+#include <pthread.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+ pthread_mutex_t mutex;
+ pthread_mutexattr_t attr;
+
+ if (pthread_mutexattr_init(&attr))
+ exit(1);
+ if (pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED))
+ exit(2);
+ if (pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP))
+ exit(3);
+ if (pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT))
+ exit(4);
+ if (pthread_mutex_init(&mutex, &attr))
+ exit(5);
+ if (pthread_mutexattr_destroy(&attr))
+ exit(6);
+ if (pthread_mutex_destroy(&mutex))
+ exit(7);
+
+ exit(0);
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ apr_cv_mutex_robust_shared=np
+else
apr_cv_mutex_robust_shared=no
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_cv_mutex_robust_shared" >&5
$as_echo "$apr_cv_mutex_robust_shared" >&6; }
@@ -26243,6 +26953,10 @@ if test "$apr_cv_mutex_robust_shared" = "yes"; then
$as_echo "#define HAVE_PTHREAD_MUTEX_ROBUST 1" >>confdefs.h
+elif test "$apr_cv_mutex_robust_shared" = "np"; then
+
+$as_echo "#define HAVE_PTHREAD_MUTEX_ROBUST_NP 1" >>confdefs.h
+
fi
fi
@@ -26282,7 +26996,7 @@ else
fi
ac_rc=yes
-for ac_spec in func:semget func:semctl define:SEM_UNDO; do
+for ac_spec in func:semget func:semctl func:semop define:SEM_UNDO; do
ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
case $ac_type in
@@ -26443,6 +27157,51 @@ else
fi
+for ac_func in pthread_condattr_setpshared
+do :
+ ac_fn_c_check_func "$LINENO" "pthread_condattr_setpshared" "ac_cv_func_pthread_condattr_setpshared"
+if test "x$ac_cv_func_pthread_condattr_setpshared" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_PTHREAD_CONDATTR_SETPSHARED 1
+_ACEOF
+
+fi
+done
+
+ac_rc=yes
+for ac_spec in header:pthread.h func:pthread_condattr_setpshared; do
+ ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
+ ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
+ case $ac_type in
+ header )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_header_$ac_item"
+ ;;
+ file )
+ ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'`
+ ac_var="ac_cv_file_$ac_item"
+ ;;
+ func ) ac_var="ac_cv_func_$ac_item" ;;
+ struct ) ac_var="ac_cv_struct_$ac_item" ;;
+ define ) ac_var="ac_cv_define_$ac_item" ;;
+ custom ) ac_var="$ac_item" ;;
+ esac
+ eval "ac_val=\$$ac_var"
+ if test ".$ac_val" != .yes; then
+ ac_rc=no
+ break
+ fi
+done
+if test ".$ac_rc" = .yes; then
+ :
+ have_pthread_condattr_setpshared="1"
+else
+ :
+ have_pthread_condattr_setpshared="0"
+fi
+
+
+
# See which lock mechanism we'll select by default on this system.
# The last APR_DECIDE to execute sets the default.
# At this stage, we match the ordering in Apache 1.3
@@ -26532,7 +27291,7 @@ else
fi
ac_rc=yes
-for ac_spec in func:semget func:semctl define:SEM_UNDO; do
+for ac_spec in func:semget func:semctl func:semop define:SEM_UNDO; do
ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
case $ac_type in
@@ -26569,7 +27328,7 @@ else
fi
ac_rc=yes
-for ac_spec in header:OS.h func:create_sem; do
+for ac_spec in header:OS.h func:create_sem func:acquire_sem func:acquire_sem_etc; do
ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'`
ac_item=`echo "$ac_spec" | sed -e 's/^.*://'`
case $ac_type in
@@ -26605,6 +27364,19 @@ else
fi
+# pthread mutex both pshared and robust[_np] is the best default
+case "$apr_cv_mutex_robust_shared" in
+"yes"|"np")
+
+ac_decision='USE_PROC_PTHREAD_SERIALIZE'
+ac_decision_msg='pthread pshared mutex'
+ac_decision_USE_PROC_PTHREAD_SERIALIZE=yes
+ac_decision_USE_PROC_PTHREAD_SERIALIZE_msg='pthread pshared mutex'
+
+ ;;
+*)
+ ;;
+esac
if test "x$apr_lock_method" != "x"; then
ac_decision="$apr_lock_method"
eval "ac_decision_msg=\"\$ac_decision_${ac_decision}_msg\""
@@ -26821,6 +27593,79 @@ else
$as_echo "no" >&6; }
fi
+for ac_header in sys/random.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/random.h" "ac_cv_header_sys_random_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_random_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_RANDOM_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_func in getrandom
+do :
+ ac_fn_c_check_func "$LINENO" "getrandom" "ac_cv_func_getrandom"
+if test "x$ac_cv_func_getrandom" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_GETRANDOM 1
+_ACEOF
+
+fi
+done
+
+
+for ac_header in sys/syscall.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "sys/syscall.h" "ac_cv_header_sys_syscall_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_syscall_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_SYSCALL_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in linux/random.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "linux/random.h" "ac_cv_header_linux_random_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_random_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LINUX_RANDOM_H 1
+_ACEOF
+
+fi
+
+done
+
+ac_fn_c_check_decl "$LINENO" "SYS_getrandom" "ac_cv_have_decl_SYS_getrandom" "#include <sys/syscall.h>
+"
+if test "x$ac_cv_have_decl_SYS_getrandom" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SYS_GETRANDOM $ac_have_decl
+_ACEOF
+
+
+for ac_func in arc4random_buf
+do :
+ ac_fn_c_check_func "$LINENO" "arc4random_buf" "ac_cv_func_arc4random_buf"
+if test "x$ac_cv_func_arc4random_buf" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_ARC4RANDOM_BUF 1
+_ACEOF
+
+fi
+done
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for entropy source" >&5
$as_echo_n "checking for entropy source... " >&6; }
@@ -26852,14 +27697,31 @@ fi
if test "$rand" != "1"; then
+ if test "$ac_cv_func_getrandom" = yes; then
+ rand="getrandom"
+ elif test "$ac_cv_have_decl_SYS_getrandom" = yes; then
+ rand="SYS_getrandom"
+ elif test "$ac_cv_func_arc4random_buf" = yes; then
+ rand="arc4random"
+ fi
+fi
+
+if test "$rand" != "1"; then
# Check whether --with-devrandom was given.
if test "${with_devrandom+set}" = set; then :
withval=$with_devrandom; apr_devrandom="$withval"
else
- apr_devrandom="yes"
+ apr_devrandom="no"
fi
+ if test "$apr_devrandom" = "no"; then
+ if test -z "$rand"; then
+ apr_devrandom="yes"
+ else
+ apr_devrandom="no"
+ fi
+ fi
if test "$apr_devrandom" = "yes"; then
# /dev/random on OpenBSD doesn't provide random data, so
@@ -26867,7 +27729,7 @@ fi
for f in /dev/arandom /dev/urandom /dev/random; do
if test -r $f; then
apr_devrandom=$f
- rand=1
+ rand="1"
break
fi
done
@@ -26898,6 +27760,15 @@ _ACEOF
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $apr_devrandom" >&5
$as_echo "$apr_devrandom" >&6; }
+ elif test -n "$rand"; then
+
+cat >>confdefs.h <<_ACEOF
+#define SYS_RANDOM "$rand"
+_ACEOF
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $rand" >&5
+$as_echo "$rand" >&6; }
+ rand="1"
fi
fi
@@ -27608,12 +28479,13 @@ tmp=0;
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_gethostbyname_r_style=glibc2
+ CFLAGS=$apr_save_CFLAGS
+ac_cv_gethostbyname_r_style=glibc2
else
- ac_cv_gethostbyname_r_style=none
+ CFLAGS=$apr_save_CFLAGS
+ac_cv_gethostbyname_r_style=none
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- CFLAGS=$apr_save_CFLAGS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gethostbyname_r_style" >&5
@@ -27667,12 +28539,13 @@ tmp=0;
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_gethostbyname_r_arg=hostent_data
+ CFLAGS=$apr_save_CFLAGS
+ac_cv_gethostbyname_r_arg=hostent_data
else
- ac_cv_gethostbyname_r_arg=char
+ CFLAGS=$apr_save_CFLAGS
+ac_cv_gethostbyname_r_arg=char
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- CFLAGS=$apr_save_CFLAGS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gethostbyname_r_arg" >&5
@@ -27734,12 +28607,13 @@ tmp=0;
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_getservbyname_r_style=glibc2
+ CFLAGS=$apr_save_CFLAGS
+ac_cv_getservbyname_r_style=glibc2
else
- ac_cv_getservbyname_r_style=none
+ CFLAGS=$apr_save_CFLAGS
+ac_cv_getservbyname_r_style=none
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- CFLAGS=$apr_save_CFLAGS
if test "$ac_cv_getservbyname_r_style" = "none"; then
@@ -27780,12 +28654,13 @@ if test "$ac_cv_getservbyname_r_style" = "none"; then
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_getservbyname_r_style=solaris
+ CFLAGS=$apr_save_CFLAGS
+ac_cv_getservbyname_r_style=solaris
else
- ac_cv_getservbyname_r_style=none
+ CFLAGS=$apr_save_CFLAGS
+ac_cv_getservbyname_r_style=none
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- CFLAGS=$apr_save_CFLAGS
fi
@@ -27827,12 +28702,13 @@ if test "$ac_cv_getservbyname_r_style" = "none"; then
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_getservbyname_r_style=osf1
+ CFLAGS=$apr_save_CFLAGS
+ac_cv_getservbyname_r_style=osf1
else
- ac_cv_getservbyname_r_style=none
+ CFLAGS=$apr_save_CFLAGS
+ac_cv_getservbyname_r_style=none
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- CFLAGS=$apr_save_CFLAGS
fi
@@ -28683,12 +29559,13 @@ if test "$ac_res" != no; then :
fi
-for ac_func in gai_strerror
+for ac_func in gai_strerror if_nametoindex if_indextoname
do :
- ac_fn_c_check_func "$LINENO" "gai_strerror" "ac_cv_func_gai_strerror"
-if test "x$ac_cv_func_gai_strerror" = xyes; then :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
-#define HAVE_GAI_STRERROR 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
@@ -29120,6 +29997,16 @@ $as_echo "$ipv6_result" >&6; }
+# Check whether --enable-timedlocks was given.
+if test "${enable_timedlocks+set}" = set; then :
+ enableval=$enable_timedlocks; apr_has_timedlocks="0"
+else
+ apr_has_timedlocks="1"
+
+fi
+
+
+
# hstrerror is only needed if IPv6 is not enabled,
# so getaddrinfo/gai_strerror are not used.
if test $have_ipv6 = 0; then
diff --git a/configure.in b/configure.in
index be6777f7b20b..6833b32d04de 100644
--- a/configure.in
+++ b/configure.in
@@ -264,8 +264,11 @@ case $host in
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
# get libtool's setting of shlibpath_var
- eval `grep "^shlibpath_var=[[A-Z_]]*$" $apr_builddir/libtool`
if test "x$shlibpath_var" = "x"; then
+ eval `grep "^shlibpath_var=[[A-Z_]]*$" $apr_builddir/libtool`
+ fi
+ if test "x$shlibpath_var" = "x"; then
+ AC_MSG_NOTICE([SHLIBPATH variable could not be determined])
shlibpath_var=REPLACE_WITH_YOUR_SHLIBPATH_VAR
fi
fi
@@ -807,15 +810,13 @@ else
fi
fi
-ac_cv_define_READDIR_IS_THREAD_SAFE=no
+ac_cv_define_READDIR_IS_THREAD_SAFE=yes
ac_cv_define_GETHOSTBYNAME_IS_THREAD_SAFE=no
ac_cv_define_GETHOSTBYADDR_IS_THREAD_SAFE=no
ac_cv_define_GETSERVBYNAME_IS_THREAD_SAFE=no
if test "$threads" = "1"; then
echo "APR will use threads"
- AC_CHECK_LIB(c_r, readdir,
- AC_DEFINE(READDIR_IS_THREAD_SAFE, 1,
- [Define if readdir is thread safe]))
+ AC_DEFINE(READDIR_IS_THREAD_SAFE, 1, [Modern readdir is thread safe])
if test "x$apr_gethostbyname_is_thread_safe" = "x"; then
AC_CHECK_LIB(c_r, gethostbyname, apr_gethostbyname_is_thread_safe=yes)
fi
@@ -1490,6 +1491,7 @@ APR_FLAG_HEADERS(
errno.h \
fcntl.h \
grp.h \
+ inttypes.h \
io.h \
limits.h \
mach-o/dyld.h \
@@ -1569,6 +1571,7 @@ AC_SUBST(crypth)
AC_SUBST(errnoh)
AC_SUBST(direnth)
AC_SUBST(fcntlh)
+AC_SUBST(inttypesh)
AC_SUBST(ioh)
AC_SUBST(limitsh)
AC_SUBST(netdbh)
@@ -1664,9 +1667,9 @@ fi
dnl Checks for integer size
AC_CHECK_SIZEOF(char, 1)
+AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
-AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(long long, 8)
if test "$ac_cv_sizeof_short" = "2"; then
@@ -1675,16 +1678,37 @@ fi
if test "$ac_cv_sizeof_int" = "4"; then
int_value=int
fi
+
# Now we need to find what apr_int64_t (sizeof == 8) will be.
-# The first match is our preference.
-if test "$ac_cv_sizeof_int" = "8"; then
+# The first match is our preference (use inttypes if available).
+APR_IFALLYES(header:stdint.h header:inttypes.h, hasinttypes="1", hasinttypes="0")
+if test "$hasinttypes" = "1"; then
+ int64_literal='#define APR_INT64_C(val) INT64_C(val)'
+ uint64_literal='#define APR_UINT64_C(val) UINT64_C(val)'
+ int64_t_fmt='#define APR_INT64_T_FMT PRId64'
+ uint64_t_fmt='#define APR_UINT64_T_FMT PRIu64'
+ uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT PRIx64'
+ int64_value="int64_t"
+ uint64_value="uint64_t"
+ APR_CHECK_TYPES_FMT_COMPATIBLE(int64_t, int, d, [
+ int64_strfn="strtoi"
+ ], [
+ APR_CHECK_TYPES_FMT_COMPATIBLE(int64_t, long, ld, [
+ int64_strfn="strtol"
+ ], [
+ APR_CHECK_TYPES_FMT_COMPATIBLE(int64_t, long long, lld, [
+ int64_strfn="strtoll"
+ ], [
+ AC_ERROR([could not determine the string function for int64_t])
+ ])])])
+elif test "$ac_cv_sizeof_int" = "8"; then
int64_literal='#define APR_INT64_C(val) (val)'
uint64_literal='#define APR_UINT64_C(val) (val##U)'
int64_t_fmt='#define APR_INT64_T_FMT "d"'
uint64_t_fmt='#define APR_UINT64_T_FMT "u"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "x"'
int64_value="int"
- long_value=int
+ uint64_value="unsigned int"
int64_strfn="strtoi"
elif test "$ac_cv_sizeof_long" = "8"; then
int64_literal='#define APR_INT64_C(val) (val##L)'
@@ -1693,7 +1717,7 @@ elif test "$ac_cv_sizeof_long" = "8"; then
uint64_t_fmt='#define APR_UINT64_T_FMT "lu"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "lx"'
int64_value="long"
- long_value=long
+ uint64_value="unsigned long"
int64_strfn="strtol"
elif test "$ac_cv_sizeof_long_long" = "8"; then
int64_literal='#define APR_INT64_C(val) (val##LL)'
@@ -1706,7 +1730,7 @@ elif test "$ac_cv_sizeof_long_long" = "8"; then
uint64_t_fmt='#define APR_UINT64_T_FMT "llu"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "llx"'
int64_value="long long"
- long_value="long long"
+ uint64_value="unsigned long long"
int64_strfn="strtoll"
elif test "$ac_cv_sizeof_longlong" = "8"; then
int64_literal='#define APR_INT64_C(val) (val##LL)'
@@ -1715,7 +1739,7 @@ elif test "$ac_cv_sizeof_longlong" = "8"; then
uint64_t_fmt='#define APR_UINT64_T_FMT "qu"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "qx"'
int64_value="__int64"
- long_value="__int64"
+ uint64_value="unsigned __int64"
int64_strfn="strtoll"
else
# int64_literal may be overriden if your compiler thinks you have
@@ -1833,18 +1857,22 @@ case $host in
uint64_t_fmt='#define APR_UINT64_T_FMT "I64u"'
uint64_t_hex_fmt='#define APR_UINT64_T_HEX_FMT "I64x"'
int64_value="__int64"
- long_value="__int64"
+ uint64_value="unsigned __int64"
int64_strfn="_strtoi64"
;;
esac
-APR_CHECK_TYPES_COMPATIBLE(ssize_t, int, [ssize_t_fmt="d"])
-APR_CHECK_TYPES_COMPATIBLE(ssize_t, long, [ssize_t_fmt="ld"])
-APR_CHECK_TYPES_COMPATIBLE(size_t, unsigned int, [size_t_fmt="u"])
-APR_CHECK_TYPES_COMPATIBLE(size_t, unsigned long, [size_t_fmt="lu"])
+dnl I would expect much of the above to go away with new compile test
+APR_CHECK_TYPES_FMT_COMPATIBLE(ssize_t, long, ld, [ssize_t_fmt="ld"], [
+APR_CHECK_TYPES_FMT_COMPATIBLE(ssize_t, int, d, [ssize_t_fmt="d"])
+])
+APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, unsigned long, lu, [size_t_fmt="lu"], [
+APR_CHECK_TYPES_FMT_COMPATIBLE(size_t, unsigned int, u, [size_t_fmt="u"])
+])
APR_CHECK_SIZEOF_EXTENDED([#include <sys/types.h>], ssize_t, 8)
+dnl the else cases below should no longer occur;
AC_MSG_CHECKING([which format to use for apr_ssize_t])
if test -n "$ssize_t_fmt"; then
AC_MSG_RESULT(%$ssize_t_fmt)
@@ -1862,6 +1890,7 @@ ssize_t_fmt="#define APR_SSIZE_T_FMT \"$ssize_t_fmt\""
APR_CHECK_SIZEOF_EXTENDED([#include <stddef.h>], size_t, 8)
+# else cases below should no longer occur;
AC_MSG_CHECKING([which format to use for apr_size_t])
if test -n "$size_t_fmt"; then
AC_MSG_RESULT(%$size_t_fmt)
@@ -1914,21 +1943,24 @@ elif test "${ac_cv_sizeof_off_t}x${ac_cv_sizeof_long}" = "4x4"; then
off_t_fmt='#define APR_OFF_T_FMT "ld"'
off_t_strfn='strtol'
elif test "$ac_cv_type_off_t" = "yes"; then
- off_t_value=off_t
# off_t is more commonly a long than an int; prefer that case
- # where int and long are the same size.
- if test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long"; then
- off_t_fmt='#define APR_OFF_T_FMT "ld"'
+ # where int and long are the same size and interchangable.
+ off_t_value=off_t
+ APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, long, ld, [
+ off_t_fmt="#define APR_OFF_T_FMT \"ld\""
off_t_strfn='strtol'
- elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_int"; then
- off_t_fmt='#define APR_OFF_T_FMT "d"'
+ ], [
+ APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, int, d, [
+ off_t_fmt="#define APR_OFF_T_FMT \"d\""
off_t_strfn='strtoi'
- elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long"; then
- off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT'
- off_t_strfn='apr_strtoi64'
- else
- AC_ERROR([could not determine the size of off_t])
- fi
+ ], [
+ APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, long long, lld, [
+ off_t_fmt="#define APR_OFF_T_FMT \"lld\""
+ off_t_strfn='strtoll'
+ ], [
+ APR_CHECK_TYPES_FMT_COMPATIBLE(off_t, $int64_value, I64d, [
+ off_t_fmt="#define APR_OFF_T_FMT APR_INT64_T_FMT"
+ off_t_strfn='apr_strtoi64'], [
# Per OS tuning...
case $host in
*-mingw*)
@@ -1936,7 +1968,11 @@ elif test "$ac_cv_type_off_t" = "yes"; then
off_t_fmt='#define APR_OFF_T_FMT "I64d"'
off_t_strfn='_strtoi64'
;;
+ *)
+ AC_ERROR([could not determine the size of off_t])
+ ;;
esac
+ ])])])])
else
# Fallback on int
off_t_value=apr_int32_t
@@ -1995,8 +2031,8 @@ fi
AC_SUBST(voidp_size)
AC_SUBST(short_value)
AC_SUBST(int_value)
-AC_SUBST(long_value)
AC_SUBST(int64_value)
+AC_SUBST(uint64_value)
AC_SUBST(off_t_value)
AC_SUBST(size_t_value)
AC_SUBST(ssize_t_value)
@@ -2189,10 +2225,17 @@ AC_SUBST(struct_rlimit)
dnl ----------------------------- Checking for Locking Characteristics
echo "${nl}Checking for Locking..."
-AC_CHECK_FUNCS(semget semctl flock)
-AC_CHECK_HEADERS(semaphore.h OS.h)
+AC_CHECK_FUNCS(semget semctl semop semtimedop flock)
+APR_IFALLYES(func:semtimedop, have_semtimedop="1", have_semtimedop="0")
+
+AC_CHECK_HEADERS(semaphore.h)
AC_SEARCH_LIBS(sem_open, rt)
-AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait create_sem)
+AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait sem_timedwait)
+APR_IFALLYES(func:sem_timedwait, have_sem_timedwait="1", have_sem_timedwait="0")
+
+AC_CHECK_HEADERS(OS.h)
+AC_CHECK_FUNCS(create_sem acquire_sem acquire_sem_etc)
+APR_IFALLYES(header:OS.h func:acquire_sem_etc, have_acquire_sem_etc="1", have_acquire_sem_etc="0")
# Some systems return ENOSYS from sem_open.
AC_CACHE_CHECK(for working sem_open,ac_cv_func_sem_open,[
@@ -2251,7 +2294,10 @@ APR_CHECK_DEFINE_FILES(POLLIN, poll.h sys/poll.h)
if test "$threads" = "1"; then
APR_CHECK_DEFINE(PTHREAD_PROCESS_SHARED, pthread.h)
- AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
+ AC_CHECK_FUNCS(pthread_mutex_timedlock pthread_mutexattr_setpshared)
+ APR_IFALLYES(header:pthread.h func:pthread_mutex_timedlock,
+ have_pthread_mutex_timedlock="1", have_pthread_mutex_timedlock="0")
+ AC_SUBST(have_pthread_mutex_timedlock)
# Some systems have setpshared and define PROCESS_SHARED, but don't
# really support PROCESS_SHARED locks. So, we must validate that we
# can go through the steps without receiving some sort of system error.
@@ -2289,8 +2335,8 @@ fi
APR_IFALLYES(header:semaphore.h func:sem_open func:sem_close dnl
func:sem_unlink func:sem_post func:sem_wait,
hasposixser="1", hasposixser="0")
-APR_IFALLYES(func:semget func:semctl define:SEM_UNDO, hassysvser="1",
- hassysvser="0")
+APR_IFALLYES(func:semget func:semctl func:semop define:SEM_UNDO,
+ hassysvser="1", hassysvser="0")
APR_IFALLYES(func:flock define:LOCK_EX, hasflockser="1", hasflockser="0")
APR_IFALLYES(header:fcntl.h define:F_SETLK, hasfcntlser="1", hasfcntlser="0")
# note: the current APR use of shared mutex requires /dev/zero
@@ -2300,6 +2346,11 @@ APR_IFALLYES(header:pthread.h define:PTHREAD_PROCESS_SHARED dnl
hasprocpthreadser="1", hasprocpthreadser="0")
APR_IFALLYES(header:OS.h func:create_sem, hasbeossem="1", hasbeossem="0")
+AC_CHECK_FUNCS(pthread_condattr_setpshared)
+APR_IFALLYES(header:pthread.h func:pthread_condattr_setpshared,
+ have_pthread_condattr_setpshared="1", have_pthread_condattr_setpshared="0")
+AC_SUBST(have_pthread_condattr_setpshared)
+
# See which lock mechanism we'll select by default on this system.
# The last APR_DECIDE to execute sets the default.
# At this stage, we match the ordering in Apache 1.3
@@ -2315,10 +2366,18 @@ APR_IFALLYES(func:flock define:LOCK_EX,
APR_DECIDE(USE_FLOCK_SERIALIZE, [4.2BSD-style flock()]))
APR_IFALLYES(header:fcntl.h define:F_SETLK,
APR_DECIDE(USE_FCNTL_SERIALIZE, [SVR4-style fcntl()]))
-APR_IFALLYES(func:semget func:semctl define:SEM_UNDO,
+APR_IFALLYES(func:semget func:semctl func:semop define:SEM_UNDO,
APR_DECIDE(USE_SYSVSEM_SERIALIZE, [SysV IPC semget()]))
-APR_IFALLYES(header:OS.h func:create_sem,
+APR_IFALLYES(header:OS.h func:create_sem func:acquire_sem func:acquire_sem_etc,
APR_DECIDE(USE_BEOSSEM, [BeOS Semaphores]))
+# pthread mutex both pshared and robust[_np] is the best default
+case "$apr_cv_mutex_robust_shared" in
+"yes"|"np")
+ APR_DECIDE(USE_PROC_PTHREAD_SERIALIZE, [pthread pshared mutex])
+ ;;
+*)
+ ;;
+esac
if test "x$apr_lock_method" != "x"; then
APR_DECISION_FORCE($apr_lock_method)
fi
@@ -2478,6 +2537,15 @@ else
fi
dnl ----------------------------- Checking for /dev/random
+AC_CHECK_HEADERS(sys/random.h)
+AC_CHECK_FUNCS(getrandom)
+
+AC_CHECK_HEADERS(sys/syscall.h)
+AC_CHECK_HEADERS(linux/random.h)
+AC_CHECK_DECLS([SYS_getrandom], [], [], [#include <sys/syscall.h>])
+
+AC_CHECK_FUNCS(arc4random_buf)
+
AC_MSG_CHECKING(for entropy source)
why_no_rand=""
@@ -2496,9 +2564,26 @@ AC_ARG_WITH(egd,
])
if test "$rand" != "1"; then
+ if test "$ac_cv_func_getrandom" = yes; then
+ rand="getrandom"
+ elif test "$ac_cv_have_decl_SYS_getrandom" = yes; then
+ rand="SYS_getrandom"
+ elif test "$ac_cv_func_arc4random_buf" = yes; then
+ rand="arc4random"
+ fi
+fi
+
+if test "$rand" != "1"; then
AC_ARG_WITH(devrandom,
[ --with-devrandom[[=DEV]] use /dev/random or compatible [[searches by default]]],
- [ apr_devrandom="$withval" ], [ apr_devrandom="yes" ])
+ [ apr_devrandom="$withval" ], [ apr_devrandom="no" ])
+ if test "$apr_devrandom" = "no"; then
+ if test -z "$rand"; then
+ apr_devrandom="yes"
+ else
+ apr_devrandom="no"
+ fi
+ fi
if test "$apr_devrandom" = "yes"; then
# /dev/random on OpenBSD doesn't provide random data, so
@@ -2506,7 +2591,7 @@ if test "$rand" != "1"; then
for f in /dev/arandom /dev/urandom /dev/random; do
if test -r $f; then
apr_devrandom=$f
- rand=1
+ rand="1"
break
fi
done
@@ -2532,6 +2617,10 @@ if test "$rand" != "1"; then
if test "$rand" = "1"; then
AC_DEFINE_UNQUOTED(DEV_RANDOM, ["$apr_devrandom"], [Define to path of random device])
AC_MSG_RESULT([$apr_devrandom])
+ elif test -n "$rand"; then
+ AC_DEFINE_UNQUOTED(SYS_RANDOM, ["$rand"], [Define system call of random])
+ AC_MSG_RESULT([$rand])
+ rand="1"
fi
fi
@@ -2749,7 +2838,7 @@ esac
AC_SEARCH_LIBS(getaddrinfo, socket inet6)
AC_SEARCH_LIBS(gai_strerror, socket inet6)
AC_SEARCH_LIBS(getnameinfo, socket inet6)
-AC_CHECK_FUNCS(gai_strerror)
+AC_CHECK_FUNCS(gai_strerror if_nametoindex if_indextoname)
APR_CHECK_WORKING_GETADDRINFO
APR_CHECK_NEGATIVE_EAI
APR_CHECK_WORKING_GETNAMEINFO
@@ -2787,6 +2876,12 @@ AC_MSG_RESULT($ipv6_result)
AC_SUBST(have_ipv6)
+AC_ARG_ENABLE(timedlocks,
+ [ --disable-timedlocks Disable timed locks ],
+ [apr_has_timedlocks="0"], [apr_has_timedlocks="1"]
+)
+AC_SUBST(apr_has_timedlocks)
+
# hstrerror is only needed if IPv6 is not enabled,
# so getaddrinfo/gai_strerror are not used.
if test $have_ipv6 = 0; then
diff --git a/encoding/apr_encode.c b/encoding/apr_encode.c
new file mode 100644
index 000000000000..905185921d91
--- /dev/null
+++ b/encoding/apr_encode.c
@@ -0,0 +1,1419 @@
+/* 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.
+ */
+
+/* encode/decode functions.
+ *
+ * These functions perform various encoding operations, and are provided in
+ * pairs, a function to query the length of and encode existing buffers, as
+ * well as companion functions to perform the same process to memory
+ * allocated from a pool.
+ *
+ * The API is designed to have the smallest possible RAM footprint, and so
+ * will only allocate the exact amount of RAM needed for each conversion.
+ */
+
+#include "apr_encode.h"
+#include "apr_lib.h"
+#include "apr_strings.h"
+#include "apr_encode_private.h"
+
+/* lookup table: fast and const should make it shared text page. */
+static const unsigned char pr2six[256] =
+{
+#if !APR_CHARSET_EBCDIC
+ /* ASCII table */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 62, 64, 63,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 128, 64, 64,
+ 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 63,
+ 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64
+#else /* APR_CHARSET_EBCDIC */
+ /* EBCDIC table */
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 62, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 63, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 128, 64,
+ 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 64, 64, 64, 64, 64, 64,
+ 64, 35, 36, 37, 38, 39, 40, 41, 42, 43, 64, 64, 64, 64, 64, 64,
+ 64, 64, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, 64,
+ 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+ 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 64, 64, 64, 64, 64, 64,
+ 64, 9, 10, 11, 12, 13, 14, 15, 16, 17, 64, 64, 64, 64, 64, 64,
+ 64, 64, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, 64,
+ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64
+#endif /* APR_CHARSET_EBCDIC */
+};
+
+static const unsigned char pr2five[256] =
+{
+#if !APR_CHARSET_EBCDIC
+ /* ASCII table */
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 26, 27, 28, 29, 30, 31, 32, 32, 32, 32, 32, 128, 32, 32,
+ 32, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
+#else /* APR_CHARSET_EBCDIC */
+ /* EBCDIC table */
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 128, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 0, 1, 2, 3, 4, 5, 6, 7, 8, 32, 32, 32, 32, 32, 32,
+ 32, 9, 10, 11, 12, 13, 14, 15, 16, 17, 32, 32, 32, 32, 32, 32,
+ 32, 32, 18, 19, 20, 21, 22, 23, 24, 25, 32, 32, 32, 32, 32, 32,
+ 32, 32, 26, 27, 28, 29, 30, 31, 32, 32, 32, 32, 32, 32, 32, 32
+#endif /* APR_CHARSET_EBCDIC */
+};
+
+static const unsigned char pr2fivehex[256] =
+{
+#if !APR_CHARSET_EBCDIC
+ /* ASCII table */
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 32, 32, 32, 128, 32, 32,
+ 32, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
+#else /* APR_CHARSET_EBCDIC */
+ /* EBCDIC table */
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 128, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 32, 10, 11, 12, 13, 14, 15, 16, 17, 18, 32, 32, 32, 32, 32, 32,
+ 32, 19, 20, 21, 22, 23, 24, 25, 26, 27, 32, 32, 32, 32, 32, 32,
+ 32, 32, 28, 29, 30, 31, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 32, 32, 32, 32, 32, 32
+#endif /* APR_CHARSET_EBCDIC */
+};
+
+static const unsigned char pr2two[256] =
+{
+#if !APR_CHARSET_EBCDIC
+ /* ASCII table */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 32, 16, 16, 16, 16, 16,
+ 16, 10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16
+#else /* APR_CHARSET_EBCDIC */
+ /* EBCDIC table */
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 32, 16, 16, 16, 16, 16,
+ 16, 10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 16, 16, 16, 16, 16
+#endif /* APR_CHARSET_EBCDIC */
+};
+
+static const char base64[] =
+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char base64url[] =
+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
+
+static const char base32[] =
+"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
+static const char base32hex[] =
+"0123456789ABCDEFGHIJKLMNOPQRSTUV";
+
+static const char base16[] = "0123456789ABCDEF";
+static const char base16lower[] = "0123456789abcdef";
+
+APR_DECLARE(apr_status_t) apr_encode_base64(char *dest, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ const char *base;
+
+ if (!src) {
+ return APR_NOTFOUND;
+ }
+
+ if (APR_ENCODE_STRING == slen) {
+ slen = strlen(src);
+ }
+
+ if (dest) {
+ register char *bufout = dest;
+ int i;
+
+ if (0 == ((flags & APR_ENCODE_BASE64URL))) {
+ base = base64;
+ }
+ else {
+ base = base64url;
+ }
+
+ for (i = 0; i < slen - 2; i += 3) {
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i]) >> 2) & 0x3F)];
+ *bufout++ = base[ENCODE_TO_ASCII((((src[i]) & 0x3) << 4)
+ | ((int)((src[i + 1]) & 0xF0) >> 4))];
+ *bufout++ = base[ENCODE_TO_ASCII((((src[i + 1]) & 0xF) << 2)
+ | ((int)(ENCODE_TO_ASCII(src[i + 2]) & 0xC0) >> 6))];
+ *bufout++ = base[ENCODE_TO_ASCII((src[i + 2]) & 0x3F)];
+ }
+ if (i < slen) {
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i]) >> 2) & 0x3F)];
+ if (i == (slen - 1)) {
+ *bufout++ = base[ENCODE_TO_ASCII((((src[i]) & 0x3) << 4))];
+ if (!(flags & APR_ENCODE_NOPADDING)) {
+ *bufout++ = '=';
+ }
+ }
+ else {
+ *bufout++ = base[ENCODE_TO_ASCII((((src[i]) & 0x3) << 4)
+ | ((int)((src[i + 1]) & 0xF0) >> 4))];
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i + 1]) & 0xF) << 2)];
+ }
+ if (!(flags & APR_ENCODE_NOPADDING)) {
+ *bufout++ = '=';
+ }
+ }
+
+ if (len) {
+ *len = bufout - dest;
+ }
+
+ *bufout++ = '\0';
+
+ return APR_SUCCESS;
+ }
+
+ if (len) {
+ *len = ((slen + 2) / 3 * 4) + 1;
+ }
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_encode_base64_binary(char *dest, const unsigned char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ const char *base;
+
+ if (!src) {
+ return APR_NOTFOUND;
+ }
+
+ if (dest) {
+ register char *bufout = dest;
+ int i;
+
+ if (0 == ((flags & APR_ENCODE_BASE64URL))) {
+ base = base64;
+ }
+ else {
+ base = base64url;
+ }
+
+ for (i = 0; i < slen - 2; i += 3) {
+ *bufout++ = base[(src[i] >> 2) & 0x3F];
+ *bufout++ = base[((src[i] & 0x3) << 4)
+ | ((int)(src[i + 1] & 0xF0) >> 4)];
+ *bufout++ = base[((src[i + 1] & 0xF) << 2)
+ | ((int)(src[i + 2] & 0xC0) >> 6)];
+ *bufout++ = base[src[i + 2] & 0x3F];
+ }
+ if (i < slen) {
+ *bufout++ = base[(src[i] >> 2) & 0x3F];
+ if (i == (slen - 1)) {
+ *bufout++ = base[((src[i] & 0x3) << 4)];
+ if (!(flags & APR_ENCODE_NOPADDING)) {
+ *bufout++ = '=';
+ }
+ }
+ else {
+ *bufout++ = base[((src[i] & 0x3) << 4)
+ | ((int)(src[i + 1] & 0xF0) >> 4)];
+ *bufout++ = base[((src[i + 1] & 0xF) << 2)];
+ }
+ if (!(flags & APR_ENCODE_NOPADDING)) {
+ *bufout++ = '=';
+ }
+ }
+
+ if (len) {
+ *len = bufout - dest;
+ }
+
+ *bufout++ = '\0';
+
+ return APR_SUCCESS;
+ }
+
+ if (len) {
+ *len = ((slen + 2) / 3 * 4) + 1;
+ }
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(const char *)apr_pencode_base64(apr_pool_t * p, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ apr_size_t size;
+
+ switch (apr_encode_base64(NULL, src, slen, flags, &size)) {
+ case APR_SUCCESS:{
+ char *cmd = apr_palloc(p, size);
+ apr_encode_base64(cmd, src, slen, flags, len);
+ return cmd;
+ }
+ case APR_NOTFOUND:{
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+APR_DECLARE(const char *)apr_pencode_base64_binary(apr_pool_t * p, const unsigned char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ apr_size_t size;
+
+ switch (apr_encode_base64_binary(NULL, src, slen, flags, &size)) {
+ case APR_SUCCESS:{
+ char *cmd = apr_palloc(p, size);
+ apr_encode_base64_binary(cmd, src, slen, flags, len);
+ return cmd;
+ }
+ case APR_NOTFOUND:{
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+APR_DECLARE(apr_status_t) apr_decode_base64(char *dest, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ if (!src) {
+ return APR_NOTFOUND;
+ }
+
+ if (APR_ENCODE_STRING == slen) {
+ slen = strlen(src);
+ }
+
+ if (dest) {
+ register const unsigned char *bufin;
+ register unsigned char *bufout;
+ register apr_size_t nprbytes;
+ register apr_size_t count = slen;
+
+ apr_status_t status;
+
+ bufin = (const unsigned char *)src;
+ while (pr2six[*(bufin++)] < 64 && count)
+ count--;
+ nprbytes = (bufin - (const unsigned char *)src) - 1;
+ while (pr2six[*(bufin++)] > 64 && count)
+ count--;
+
+ status = flags & APR_ENCODE_RELAXED ? APR_SUCCESS :
+ count ? APR_BADCH : APR_SUCCESS;
+
+ bufout = (unsigned char *)dest;
+ bufin = (const unsigned char *)src;
+
+ while (nprbytes > 4) {
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(pr2six[bufin[0]] << 2
+ | pr2six[bufin[1]] >> 4);
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(
+ pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(
+ pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
+ bufin += 4;
+ nprbytes -= 4;
+ }
+
+ if (nprbytes == 1) {
+ status = APR_BADCH;
+ }
+ if (nprbytes > 1) {
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(
+ pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
+ }
+ if (nprbytes > 2) {
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(
+ pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
+ }
+ if (nprbytes > 3) {
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(
+ pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
+ }
+
+ if (len) {
+ *len = bufout - (unsigned char *)dest;
+ }
+
+ *(bufout++) = 0;
+
+ return status;
+ }
+
+ if (len) {
+ *len = (((int)slen + 3) / 4) * 3 + 1;
+ }
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_decode_base64_binary(unsigned char *dest,
+ const char *src, apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ if (!src) {
+ return APR_NOTFOUND;
+ }
+
+ if (APR_ENCODE_STRING == slen) {
+ slen = strlen(src);
+ }
+
+ if (dest) {
+ register const unsigned char *bufin;
+ register unsigned char *bufout;
+ register apr_size_t nprbytes;
+ register apr_size_t count = slen;
+
+ apr_status_t status;
+
+ bufin = (const unsigned char *)src;
+ while (pr2six[*(bufin++)] < 64 && count)
+ count--;
+ nprbytes = (bufin - (const unsigned char *)src) - 1;
+ while (pr2six[*(bufin++)] > 64 && count)
+ count--;
+
+ status = flags & APR_ENCODE_RELAXED ? APR_SUCCESS :
+ count ? APR_BADCH : APR_SUCCESS;
+
+ bufout = (unsigned char *)dest;
+ bufin = (const unsigned char *)src;
+
+ while (nprbytes > 4) {
+ *(bufout++) = (unsigned char)(pr2six[bufin[0]] << 2
+ | pr2six[bufin[1]] >> 4);
+ *(bufout++) = (unsigned char)(pr2six[bufin[1]] << 4
+ | pr2six[bufin[2]] >> 2);
+ *(bufout++) = (unsigned char)(pr2six[bufin[2]] << 6
+ | pr2six[bufin[3]]);
+ bufin += 4;
+ nprbytes -= 4;
+ }
+
+ if (nprbytes == 1) {
+ status = APR_BADCH;
+ }
+ if (nprbytes > 1) {
+ *(bufout++) = (unsigned char)(pr2six[bufin[0]] << 2
+ | pr2six[bufin[1]] >> 4);
+ }
+ if (nprbytes > 2) {
+ *(bufout++) = (unsigned char)(pr2six[bufin[1]] << 4
+ | pr2six[bufin[2]] >> 2);
+ }
+ if (nprbytes > 3) {
+ *(bufout++) = (unsigned char)(pr2six[bufin[2]] << 6
+ | pr2six[bufin[3]]);
+ }
+
+ if (len) {
+ *len = bufout - dest;
+ }
+
+ return status;
+ }
+
+ if (len) {
+ *len = (((int)slen + 3) / 4) * 3;
+ }
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(const char *)apr_pdecode_base64(apr_pool_t * p, const char *str,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ apr_size_t size;
+
+ switch (apr_decode_base64(NULL, str, slen, flags, &size)) {
+ case APR_SUCCESS:{
+ void *cmd = apr_palloc(p, size);
+ apr_decode_base64(cmd, str, slen, flags, len);
+ return cmd;
+ }
+ case APR_BADCH:
+ case APR_NOTFOUND:{
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+APR_DECLARE(const unsigned char *)apr_pdecode_base64_binary(apr_pool_t * p,
+ const char *str, apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ apr_size_t size;
+
+ switch (apr_decode_base64_binary(NULL, str, slen, flags, &size)) {
+ case APR_SUCCESS:{
+ unsigned char *cmd = apr_palloc(p, size + 1);
+ cmd[size] = 0;
+ apr_decode_base64_binary(cmd, str, slen, flags, len);
+ return cmd;
+ }
+ case APR_BADCH:
+ case APR_NOTFOUND:{
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+APR_DECLARE(apr_status_t) apr_encode_base32(char *dest, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ const char *base;
+
+ if (!src) {
+ return APR_NOTFOUND;
+ }
+
+ if (APR_ENCODE_STRING == slen) {
+ slen = strlen(src);
+ }
+
+ if (dest) {
+ register char *bufout = dest;
+ int i;
+
+ if (!((flags & APR_ENCODE_BASE32HEX))) {
+ base = base32;
+ }
+ else {
+ base = base32hex;
+ }
+
+ for (i = 0; i < slen - 4; i += 5) {
+ *bufout++ = base[ENCODE_TO_ASCII((src[i] >> 3) & 0x1F)];
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i] << 2) & 0x1C)
+ | ((src[i + 1] >> 6) & 0x3))];
+ *bufout++ = base[ENCODE_TO_ASCII((src[i + 1] >> 1) & 0x1F)];
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i + 1] << 4) & 0x10)
+ | ((src[i + 2] >> 4) & 0xF))];
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i + 2] << 1) & 0x1E)
+ | ((src[i + 3] >> 7) & 0x1))];
+ *bufout++ = base[ENCODE_TO_ASCII((src[i + 3] >> 2) & 0x1F)];
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i + 3] << 3) & 0x18)
+ | ((src[i + 4] >> 5) & 0x7))];
+ *bufout++ = base[ENCODE_TO_ASCII(src[i + 4] & 0x1F)];
+ }
+ if (i < slen) {
+ *bufout++ = base[ENCODE_TO_ASCII(src[i] >> 3) & 0x1F];
+ if (i == (slen - 1)) {
+ *bufout++ = base[ENCODE_TO_ASCII((src[i] << 2) & 0x1C)];
+ if (!(flags & APR_ENCODE_NOPADDING)) {
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ }
+ }
+ else if (i == (slen - 2)) {
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i] << 2) & 0x1C)
+ | ((src[i + 1] >> 6) & 0x3))];
+ *bufout++ = base[ENCODE_TO_ASCII((src[i + 1] >> 1) & 0x1F)];
+ *bufout++ = base[ENCODE_TO_ASCII((src[i + 1] << 4) & 0x10)];
+ if (!(flags & APR_ENCODE_NOPADDING)) {
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ }
+ }
+ else if (i == (slen - 3)) {
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i] << 2) & 0x1C)
+ | ((src[i + 1] >> 6) & 0x3))];
+ *bufout++ = base[ENCODE_TO_ASCII((src[i + 1] >> 1) & 0x1F)];
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i + 1] << 4) & 0x10)
+ | ((src[i + 2] >> 4) & 0xF))];
+ *bufout++ = base[ENCODE_TO_ASCII((src[i + 2] << 1) & 0x1E)];
+ if (!(flags & APR_ENCODE_NOPADDING)) {
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ }
+ }
+ else {
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i] << 2) & 0x1C)
+ | ((src[i + 1] >> 6) & 0x3))];
+ *bufout++ = base[ENCODE_TO_ASCII((src[i + 1] >> 1) & 0x1F)];
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i + 1] << 4) & 0x10)
+ | ((src[i + 2] >> 4) & 0xF))];
+ *bufout++ = base[ENCODE_TO_ASCII(((src[i + 2] << 1) & 0x1E)
+ | ((src[i + 3] >> 7) & 0x1))];
+ *bufout++ = base[ENCODE_TO_ASCII((src[i + 3] >> 2) & 0x1F)];
+ *bufout++ = base[ENCODE_TO_ASCII((src[i + 3] << 3) & 0x18)];
+ if (!(flags & APR_ENCODE_NOPADDING)) {
+ *bufout++ = '=';
+ }
+ }
+ }
+
+ if (len) {
+ *len = bufout - dest;
+ }
+
+ *bufout++ = '\0';
+
+ return APR_SUCCESS;
+ }
+
+ if (len) {
+ *len = ((slen + 2) / 3 * 4) + 1;
+ }
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_encode_base32_binary(char *dest, const unsigned char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ const char *base;
+
+ if (!src) {
+ return APR_NOTFOUND;
+ }
+
+ if (dest) {
+ register char *bufout = dest;
+ int i;
+
+ if (!((flags & APR_ENCODE_BASE32HEX))) {
+ base = base32;
+ }
+ else {
+ base = base32hex;
+ }
+
+ for (i = 0; i < slen - 4; i += 5) {
+ *bufout++ = base[((src[i] >> 3) & 0x1F)];
+ *bufout++ = base[(((src[i] << 2) & 0x1C)
+ | ((src[i + 1] >> 6) & 0x3))];
+ *bufout++ = base[((src[i + 1] >> 1) & 0x1F)];
+ *bufout++ = base[(((src[i + 1] << 4) & 0x10)
+ | ((src[i + 2] >> 4) & 0xF))];
+ *bufout++ = base[(((src[i + 2] << 1) & 0x1E)
+ | ((src[i + 3] >> 7) & 0x1))];
+ *bufout++ = base[((src[i + 3] >> 2) & 0x1F)];
+ *bufout++ = base[(((src[i + 3] << 3) & 0x18)
+ | ((src[i + 4] >> 5) & 0x7))];
+ *bufout++ = base[(src[i + 4] & 0x1F)];
+ }
+ if (i < slen) {
+ *bufout++ = base[(src[i] >> 3) & 0x1F];
+ if (i == (slen - 1)) {
+ *bufout++ = base[((src[i] << 2) & 0x1C)];
+ if (!(flags & APR_ENCODE_NOPADDING)) {
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ }
+ }
+ else if (i == (slen - 2)) {
+ *bufout++ = base[(((src[i] << 2) & 0x1C)
+ | ((src[i + 1] >> 6) & 0x3))];
+ *bufout++ = base[((src[i + 1] >> 1) & 0x1F)];
+ *bufout++ = base[((src[i + 1] << 4) & 0x10)];
+ if (!(flags & APR_ENCODE_NOPADDING)) {
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ }
+ }
+ else if (i == (slen - 3)) {
+ *bufout++ = base[(((src[i] << 2) & 0x1C)
+ | ((src[i + 1] >> 6) & 0x3))];
+ *bufout++ = base[((src[i + 1] >> 1) & 0x1F)];
+ *bufout++ = base[(((src[i + 1] << 4) & 0x10)
+ | ((int)(src[i + 2] >> 4) & 0xF))];
+ *bufout++ = base[((src[i + 2] << 1) & 0x1E)];
+ if (!(flags & APR_ENCODE_NOPADDING)) {
+ *bufout++ = '=';
+ *bufout++ = '=';
+ *bufout++ = '=';
+ }
+ }
+ else {
+ *bufout++ = base[(((src[i] << 2) & 0x1C)
+ | ((src[i + 1] >> 6) & 0x3))];
+ *bufout++ = base[((src[i + 1] >> 1) & 0x1F)];
+ *bufout++ = base[(((src[i + 1] << 4) & 0x10)
+ | ((src[i + 2] >> 4) & 0xF))];
+ *bufout++ = base[(((src[i + 2] << 1) & 0x1E)
+ | ((src[i + 3] >> 7) & 0x1))];
+ *bufout++ = base[((src[i + 3] >> 2) & 0x1F)];
+ *bufout++ = base[((src[i + 3] << 3) & 0x18)];
+ if (!(flags & APR_ENCODE_NOPADDING)) {
+ *bufout++ = '=';
+ }
+ }
+ }
+
+ if (len) {
+ *len = bufout - dest;
+ }
+
+ *bufout++ = '\0';
+
+ return APR_SUCCESS;
+ }
+
+ if (len) {
+ *len = ((slen + 4) / 5 * 8) + 1;
+ }
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(const char *)apr_pencode_base32(apr_pool_t * p, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ apr_size_t size;
+
+ switch (apr_encode_base32(NULL, src, slen, flags, &size)) {
+ case APR_SUCCESS:{
+ char *cmd = apr_palloc(p, size);
+ apr_encode_base32(cmd, src, slen, flags, len);
+ return cmd;
+ }
+ case APR_NOTFOUND:{
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+APR_DECLARE(const char *)apr_pencode_base32_binary(apr_pool_t * p, const unsigned char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ apr_size_t size;
+
+ switch (apr_encode_base32_binary(NULL, src, slen, flags, &size)) {
+ case APR_SUCCESS:{
+ char *cmd = apr_palloc(p, size);
+ apr_encode_base32_binary(cmd, src, slen, flags, len);
+ return cmd;
+ }
+ case APR_NOTFOUND:{
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+APR_DECLARE(apr_status_t) apr_decode_base32(char *dest, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ if (!src) {
+ return APR_NOTFOUND;
+ }
+
+ if (APR_ENCODE_STRING == slen) {
+ slen = strlen(src);
+ }
+
+ if (dest) {
+ register const unsigned char *bufin;
+ register unsigned char *bufout;
+ register apr_size_t nprbytes;
+ register apr_size_t count = slen;
+
+ const unsigned char *pr2;
+
+ apr_status_t status;
+
+ if ((flags & APR_ENCODE_BASE32HEX)) {
+ pr2 = pr2fivehex;
+ }
+ else {
+ pr2 = pr2five;
+ }
+
+ bufin = (const unsigned char *)src;
+ while (pr2[*(bufin++)] < 32 && count)
+ count--;
+ nprbytes = (bufin - (const unsigned char *)src) - 1;
+ while (pr2[*(bufin++)] > 32 && count)
+ count--;
+
+ status = flags & APR_ENCODE_RELAXED ? APR_SUCCESS :
+ count ? APR_BADCH : APR_SUCCESS;
+
+ bufout = (unsigned char *)dest;
+ bufin = (const unsigned char *)src;
+
+ while (nprbytes > 8) {
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(pr2[bufin[0]] << 3
+ | pr2[bufin[1]] >> 2);
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(pr2[bufin[1]] << 6
+ | pr2[bufin[2]] << 1 | pr2[bufin[3]] >> 4);
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(pr2[bufin[3]] << 4
+ | pr2[bufin[4]] >> 1);
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(pr2[bufin[4]] << 7
+ | pr2[bufin[5]] << 2 | pr2[bufin[6]] >> 3);
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(pr2[bufin[6]] << 5
+ | pr2[bufin[7]]);
+ bufin += 8;
+ nprbytes -= 8;
+ }
+
+ if (nprbytes == 1) {
+ status = APR_BADCH;
+ }
+ if (nprbytes >= 2) {
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(
+ pr2[bufin[0]] << 3 | pr2[bufin[1]] >> 2);
+ }
+ if (nprbytes == 3) {
+ status = APR_BADCH;
+ }
+ if (nprbytes >= 4) {
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(
+ pr2[bufin[1]] << 6 | pr2[bufin[2]] << 1
+ | pr2[bufin[3]] >> 4);
+ }
+ if (nprbytes >= 5) {
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(pr2[bufin[3]] << 4
+ | pr2[bufin[4]] >> 1);
+ }
+ if (nprbytes == 6) {
+ status = APR_BADCH;
+ }
+ if (nprbytes >= 7) {
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(pr2[bufin[4]] << 7
+ | pr2[bufin[5]] << 2 | pr2[bufin[6]] >> 3);
+ }
+ if (nprbytes == 8) {
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(pr2[bufin[6]] << 5
+ | pr2[bufin[7]]);
+ }
+
+ if (len) {
+ *len = bufout - (unsigned char *)dest;
+ }
+
+ *(bufout++) = 0;
+
+ return status;
+ }
+
+ if (len) {
+ *len = (((int)slen + 7) / 8) * 5 + 1;
+ }
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_decode_base32_binary(unsigned char *dest,
+ const char *src, apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ if (!src) {
+ return APR_NOTFOUND;
+ }
+
+ if (APR_ENCODE_STRING == slen) {
+ slen = strlen(src);
+ }
+
+ if (dest) {
+ register const unsigned char *bufin;
+ register unsigned char *bufout;
+ register apr_size_t nprbytes;
+ register apr_size_t count = slen;
+
+ const unsigned char *pr2;
+
+ apr_status_t status;
+
+ if ((flags & APR_ENCODE_BASE32HEX)) {
+ pr2 = pr2fivehex;
+ }
+ else {
+ pr2 = pr2five;
+ }
+
+ bufin = (const unsigned char *)src;
+ while (pr2[*(bufin++)] < 32 && count)
+ count--;
+ nprbytes = (bufin - (const unsigned char *)src) - 1;
+ while (pr2[*(bufin++)] > 32 && count)
+ count--;
+
+ status = flags & APR_ENCODE_RELAXED ? APR_SUCCESS :
+ count ? APR_BADCH : APR_SUCCESS;
+
+ bufout = (unsigned char *)dest;
+ bufin = (const unsigned char *)src;
+
+ while (nprbytes > 8) {
+ *(bufout++) = (unsigned char)(pr2[bufin[0]] << 3
+ | pr2[bufin[1]] >> 2);
+ *(bufout++) = (unsigned char)(pr2[bufin[1]] << 6
+ | pr2[bufin[2]] << 1 | pr2[bufin[3]] >> 4);
+ *(bufout++) = (unsigned char)(pr2[bufin[3]] << 4
+ | pr2[bufin[4]] >> 1);
+ *(bufout++) = (unsigned char)(pr2[bufin[4]] << 7
+ | pr2[bufin[5]] << 2 | pr2[bufin[6]] >> 3);
+ *(bufout++) = (unsigned char)(pr2[bufin[6]] << 5
+ | pr2[bufin[7]]);
+ bufin += 8;
+ nprbytes -= 8;
+ }
+
+ if (nprbytes == 1) {
+ status = APR_BADCH;
+ }
+ if (nprbytes >= 2) {
+ *(bufout++) = (unsigned char)(
+ pr2[bufin[0]] << 3 | pr2[bufin[1]] >> 2);
+ }
+ if (nprbytes == 3) {
+ status = APR_BADCH;
+ }
+ if (nprbytes >= 4) {
+ *(bufout++) = (unsigned char)(
+ pr2[bufin[1]] << 6 | pr2[bufin[2]] << 1
+ | pr2[bufin[3]] >> 4);
+ }
+ if (nprbytes >= 5) {
+ *(bufout++) = (unsigned char)(pr2[bufin[3]] << 4
+ | pr2[bufin[4]] >> 1);
+ }
+ if (nprbytes == 6) {
+ status = APR_BADCH;
+ }
+ if (nprbytes >= 7) {
+ *(bufout++) = (unsigned char)(pr2[bufin[4]] << 7
+ | pr2[bufin[5]] << 2 | pr2[bufin[6]] >> 3);
+ }
+ if (nprbytes == 8) {
+ *(bufout++) = (unsigned char)(pr2[bufin[6]] << 5
+ | pr2[bufin[7]]);
+ }
+
+ if (len) {
+ *len = bufout - dest;
+ }
+
+ return status;
+ }
+
+ if (len) {
+ *len = (((int)slen + 7) / 8) * 5;
+ }
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(const char *)apr_pdecode_base32(apr_pool_t * p, const char *str,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ apr_size_t size;
+
+ switch (apr_decode_base32(NULL, str, slen, flags, &size)) {
+ case APR_SUCCESS:{
+ void *cmd = apr_palloc(p, size);
+ apr_decode_base32(cmd, str, slen, flags, len);
+ return cmd;
+ }
+ case APR_BADCH:
+ case APR_NOTFOUND:{
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+APR_DECLARE(const unsigned char *)apr_pdecode_base32_binary(apr_pool_t * p,
+ const char *str, apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ apr_size_t size;
+
+ switch (apr_decode_base32_binary(NULL, str, slen, flags, &size)) {
+ case APR_SUCCESS:{
+ unsigned char *cmd = apr_palloc(p, size + 1);
+ cmd[size] = 0;
+ apr_decode_base32_binary(cmd, str, slen, flags, len);
+ return cmd;
+ }
+ case APR_BADCH:
+ case APR_NOTFOUND:{
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+APR_DECLARE(apr_status_t) apr_encode_base16(char *dest,
+ const char *src, apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ const char *in = src;
+ apr_size_t size;
+
+ if (!src) {
+ return APR_NOTFOUND;
+ }
+
+ if (dest) {
+ register char *bufout = dest;
+ const char *base;
+
+ if ((flags & APR_ENCODE_LOWER)) {
+ base = base16lower;
+ }
+ else {
+ base = base16;
+ }
+
+ for (size = 0; (APR_ENCODE_STRING == slen) ? in[size] : size < slen; size++) {
+ if ((flags & APR_ENCODE_COLON) && size) {
+ *(bufout++) = ':';
+ }
+ *(bufout++) = base[(const unsigned char)(ENCODE_TO_ASCII(in[size])) >> 4];
+ *(bufout++) = base[(const unsigned char)(ENCODE_TO_ASCII(in[size])) & 0xf];
+ }
+
+ if (len) {
+ *len = bufout - dest;
+ }
+
+ *bufout = '\0';
+
+ return APR_SUCCESS;
+ }
+
+ if (len) {
+ if (APR_ENCODE_STRING == slen) {
+ slen = strlen(src);
+ }
+ if ((flags & APR_ENCODE_COLON) && slen) {
+ *len = slen * 3;
+ }
+ else {
+ *len = slen * 2 + 1;
+ }
+ }
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_encode_base16_binary(char *dest,
+ const unsigned char *src, apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ const unsigned char *in = src;
+ apr_size_t size;
+
+ if (!src) {
+ return APR_NOTFOUND;
+ }
+
+ if (dest) {
+ register char *bufout = dest;
+ const char *base;
+
+ if ((flags & APR_ENCODE_LOWER)) {
+ base = base16lower;
+ }
+ else {
+ base = base16;
+ }
+
+ for (size = 0; size < slen; size++) {
+ if ((flags & APR_ENCODE_COLON) && size) {
+ *(bufout++) = ':';
+ }
+ *(bufout++) = base[in[size] >> 4];
+ *(bufout++) = base[in[size] & 0xf];
+ }
+
+ if (len) {
+ *len = bufout - dest;
+ }
+
+ *bufout = 0;
+
+ return APR_SUCCESS;
+ }
+
+ if (len) {
+ if ((flags & APR_ENCODE_COLON) && slen) {
+ *len = slen * 3;
+ }
+ else {
+ *len = slen * 2 + 1;
+ }
+ }
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(const char *)apr_pencode_base16(apr_pool_t * p,
+ const char *src, apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ apr_size_t size;
+
+ switch (apr_encode_base16(NULL, src, slen, flags, &size)) {
+ case APR_SUCCESS:{
+ char *cmd = apr_palloc(p, size);
+ apr_encode_base16(cmd, src, slen, flags, len);
+ return cmd;
+ }
+ case APR_NOTFOUND:{
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+APR_DECLARE(const char *)apr_pencode_base16_binary(apr_pool_t * p,
+ const unsigned char *src, apr_ssize_t slen, int flags,
+ apr_size_t * len)
+{
+ apr_size_t size;
+
+ switch (apr_encode_base16_binary(NULL, src, slen, flags, &size)) {
+ case APR_SUCCESS:{
+ char *cmd = apr_palloc(p, size);
+ apr_encode_base16_binary(cmd, src, slen, flags, len);
+ return cmd;
+ }
+ case APR_NOTFOUND:{
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+APR_DECLARE(apr_status_t) apr_decode_base16(char *dest,
+ const char *src, apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ register const unsigned char *bufin;
+ register unsigned char *bufout;
+ register apr_size_t nprbytes;
+ register apr_size_t count;
+
+ apr_status_t status;
+
+ if (!src) {
+ return APR_NOTFOUND;
+ }
+
+ if (APR_ENCODE_STRING == slen) {
+ slen = strlen(src);
+ }
+
+ count = slen;
+ bufin = (const unsigned char *)src;
+ while (pr2two[*(bufin++)] != 16 && count)
+ count--;
+ nprbytes = (bufin - (const unsigned char *)src) - 1;
+ while (pr2two[*(bufin++)] > 16 && count)
+ count--;
+
+ status = flags & APR_ENCODE_RELAXED ? APR_SUCCESS :
+ count ? APR_BADCH : APR_SUCCESS;
+
+ if (dest) {
+
+ bufout = (unsigned char *)dest;
+ bufin = (const unsigned char *)src;
+
+ while (nprbytes >= 2) {
+ if (pr2two[bufin[0]] > 16) {
+ bufin += 1;
+ nprbytes -= 1;
+ }
+ else {
+ *(bufout++) = (unsigned char)ENCODE_TO_NATIVE(
+ pr2two[bufin[0]] << 4 | pr2two[bufin[1]]);
+ bufin += 2;
+ nprbytes -= 2;
+ }
+ }
+
+ if (nprbytes == 1) {
+ status = APR_BADCH;
+ }
+
+ if (len) {
+ *len = bufout - (unsigned char *)dest;
+ }
+
+ *(bufout++) = 0;
+
+ return status;
+ }
+
+ else {
+
+ count = 0;
+ bufin = (const unsigned char *)src;
+
+ while (nprbytes >= 2) {
+ if (pr2two[bufin[0]] > 16) {
+ bufin += 1;
+ nprbytes -= 1;
+ }
+ else {
+ count++;
+ bufin += 2;
+ nprbytes -= 2;
+ }
+ }
+
+ if (nprbytes == 1) {
+ status = APR_BADCH;
+ }
+
+ if (len) {
+ *len = count + 1;
+ }
+
+ return status;
+ }
+
+}
+
+APR_DECLARE(apr_status_t) apr_decode_base16_binary(unsigned char *dest,
+ const char *src, apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ register const unsigned char *bufin;
+ register unsigned char *bufout;
+ register apr_size_t nprbytes;
+ register apr_size_t count;
+
+ apr_status_t status;
+
+ if (!src) {
+ return APR_NOTFOUND;
+ }
+
+ if (APR_ENCODE_STRING == slen) {
+ slen = strlen(src);
+ }
+
+ count = slen;
+ bufin = (const unsigned char *)src;
+ while (pr2two[*(bufin++)] != 16 && count)
+ count--;
+ nprbytes = (bufin - (const unsigned char *)src) - 1;
+ while (pr2two[*(bufin++)] > 16 && count)
+ count--;
+
+ status = flags & APR_ENCODE_RELAXED ? APR_SUCCESS :
+ count ? APR_BADCH : APR_SUCCESS;
+
+ if (dest) {
+
+ bufout = (unsigned char *)dest;
+ bufin = (const unsigned char *)src;
+
+ while (nprbytes >= 2) {
+ if (pr2two[bufin[0]] > 16) {
+ bufin += 1;
+ nprbytes -= 1;
+ }
+ else {
+ *(bufout++) = (unsigned char)(
+ pr2two[bufin[0]] << 4 | pr2two[bufin[1]]);
+ bufin += 2;
+ nprbytes -= 2;
+ }
+ }
+
+ if (nprbytes == 1) {
+ status = APR_BADCH;
+ }
+
+ if (len) {
+ *len = bufout - (unsigned char *)dest;
+ }
+
+ return status;
+ }
+
+ else {
+
+ count = 0;
+ bufin = (const unsigned char *)src;
+
+ while (nprbytes >= 2) {
+ if (pr2two[bufin[0]] > 16) {
+ bufin += 1;
+ nprbytes -= 1;
+ }
+ else {
+ count++;
+ bufin += 2;
+ nprbytes -= 2;
+ }
+ }
+
+ if (nprbytes == 1) {
+ status = APR_BADCH;
+ }
+
+ if (len) {
+ *len = count;
+ }
+
+ return status;
+ }
+}
+
+APR_DECLARE(const char *)apr_pdecode_base16(apr_pool_t * p,
+ const char *str, apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ apr_size_t size;
+
+ switch (apr_decode_base16(NULL, str, slen, flags, &size)) {
+ case APR_SUCCESS:{
+ void *cmd = apr_palloc(p, size);
+ apr_decode_base16(cmd, str, slen, flags, len);
+ return cmd;
+ }
+ case APR_BADCH:
+ case APR_NOTFOUND:{
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+APR_DECLARE(const unsigned char *)apr_pdecode_base16_binary(apr_pool_t * p,
+ const char *str, apr_ssize_t slen, int flags, apr_size_t * len)
+{
+ apr_size_t size;
+
+ switch (apr_decode_base16_binary(NULL, str, slen, flags, &size)) {
+ case APR_SUCCESS:{
+ unsigned char *cmd = apr_palloc(p, size + 1);
+ cmd[size] = 0;
+ apr_decode_base16_binary(cmd, str, slen, flags, len);
+ return cmd;
+ }
+ case APR_BADCH:
+ case APR_NOTFOUND:{
+ break;
+ }
+ }
+
+ return NULL;
+}
diff --git a/encoding/apr_escape.c b/encoding/apr_escape.c
index 3be9eb99ec10..b3bc82d359f4 100644
--- a/encoding/apr_escape.c
+++ b/encoding/apr_escape.c
@@ -27,50 +27,10 @@
#include "apr_escape.h"
#include "apr_escape_test_char.h"
+#include "apr_encode_private.h"
#include "apr_lib.h"
#include "apr_strings.h"
-#if APR_CHARSET_EBCDIC
-static int convert_a2e[256] = {
- 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F,
- 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61,
- 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F,
- 0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,
- 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D,
- 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
- 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07,
- 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x09, 0x0A, 0x1B,
- 0x30, 0x31, 0x1A, 0x33, 0x34, 0x35, 0x36, 0x08, 0x38, 0x39, 0x3A, 0x3B, 0x04, 0x14, 0x3E, 0xFF,
- 0x41, 0xAA, 0x4A, 0xB1, 0x9F, 0xB2, 0x6A, 0xB5, 0xBB, 0xB4, 0x9A, 0x8A, 0xB0, 0xCA, 0xAF, 0xBC,
- 0x90, 0x8F, 0xEA, 0xFA, 0xBE, 0xA0, 0xB6, 0xB3, 0x9D, 0xDA, 0x9B, 0x8B, 0xB7, 0xB8, 0xB9, 0xAB,
- 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9E, 0x68, 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
- 0xAC, 0x69, 0xED, 0xEE, 0xEB, 0xEF, 0xEC, 0xBF, 0x80, 0xFD, 0xFE, 0xFB, 0xFC, 0xBA, 0xAE, 0x59,
- 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9C, 0x48, 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
- 0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, 0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF };
-
-static int convert_e2a[256] = {
- 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
- 0x10, 0x11, 0x12, 0x13, 0x9D, 0x0A, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F,
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1B, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07,
- 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, 0x98, 0x99, 0x9A, 0x9B, 0x14, 0x15, 0x9E, 0x1A,
- 0x20, 0xA0, 0xE2, 0xE4, 0xE0, 0xE1, 0xE3, 0xE5, 0xE7, 0xF1, 0xA2, 0x2E, 0x3C, 0x28, 0x2B, 0x7C,
- 0x26, 0xE9, 0xEA, 0xEB, 0xE8, 0xED, 0xEE, 0xEF, 0xEC, 0xDF, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0x5E,
- 0x2D, 0x2F, 0xC2, 0xC4, 0xC0, 0xC1, 0xC3, 0xC5, 0xC7, 0xD1, 0xA6, 0x2C, 0x25, 0x5F, 0x3E, 0x3F,
- 0xF8, 0xC9, 0xCA, 0xCB, 0xC8, 0xCD, 0xCE, 0xCF, 0xCC, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22,
- 0xD8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0xAB, 0xBB, 0xF0, 0xFD, 0xFE, 0xB1,
- 0xB0, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0xAA, 0xBA, 0xE6, 0xB8, 0xC6, 0xA4,
- 0xB5, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0xA1, 0xBF, 0xD0, 0x5B, 0xDE, 0xAE,
- 0xAC, 0xA3, 0xA5, 0xB7, 0xA9, 0xA7, 0xB6, 0xBC, 0xBD, 0xBE, 0xDD, 0xA8, 0xAF, 0x5D, 0xB4, 0xD7,
- 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0xAD, 0xF4, 0xF6, 0xF2, 0xF3, 0xF5,
- 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0xB9, 0xFB, 0xFC, 0xF9, 0xFA, 0xFF,
- 0x5C, 0xF7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0xB2, 0xD4, 0xD6, 0xD2, 0xD3, 0xD5,
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F };
-#define RAW_ASCII_CHAR(ch) convert_e2a[(unsigned char)ch]
-#else /* APR_CHARSET_EBCDIC */
-#define RAW_ASCII_CHAR(ch) (ch)
-#endif /* !APR_CHARSET_EBCDIC */
-
/* we assume the folks using this ensure 0 <= c < 256... which means
* you need a cast to (unsigned char) first, you can't just plug a
* char in here and get it to work, because if char is signed then it
@@ -171,7 +131,7 @@ static char x2c(const char *what)
xstr[2]=what[0];
xstr[3]=what[1];
xstr[4]='\0';
- digit = convert_a2e[0xFF & strtol(xstr, NULL, 16)];
+ digit = ENCODE_TO_NATIVE[0xFF & strtol(xstr, NULL, 16)];
#endif /*APR_CHARSET_EBCDIC*/
return (digit);
}
@@ -756,7 +716,7 @@ APR_DECLARE(apr_status_t) apr_unescape_entity(char *unescaped, const char *str,
size--;
}
else {
- *d = RAW_ASCII_CHAR(val);
+ *d = ENCODE_TO_ASCII(val);
found = 1;
}
}
@@ -777,7 +737,7 @@ APR_DECLARE(apr_status_t) apr_unescape_entity(char *unescaped, const char *str,
*d = '&'; /* unknown */
}
else {
- *d = RAW_ASCII_CHAR(((const unsigned char *) ents)[j]);
+ *d = ENCODE_TO_ASCII(((const unsigned char *) ents)[j]);
s += i;
slen -= i;
found = 1;
diff --git a/file_io/unix/dir.c b/file_io/unix/dir.c
index 28d9e0699288..d9b344f3085b 100644
--- a/file_io/unix/dir.c
+++ b/file_io/unix/dir.c
@@ -24,6 +24,10 @@
#include <limits.h>
#endif
+#ifndef NAME_MAX
+#define NAME_MAX 255
+#endif
+
static apr_status_t dir_cleanup(void *thedir)
{
apr_dir_t *dir = thedir;
@@ -71,14 +75,6 @@ static char *path_remove_last_component (const char *path, apr_pool_t *pool)
apr_status_t apr_dir_open(apr_dir_t **new, const char *dirname,
apr_pool_t *pool)
{
- /* On some platforms (e.g., Linux+GNU libc), d_name[] in struct
- * dirent is declared with enough storage for the name. On other
- * platforms (e.g., Solaris 8 for Intel), d_name is declared as a
- * one-byte array. Note: gcc evaluates this at compile time.
- */
- apr_size_t dirent_size =
- sizeof(*(*new)->entry) +
- (sizeof((*new)->entry->d_name) > 1 ? 0 : 255);
DIR *dir = opendir(dirname);
if (!dir) {
@@ -90,7 +86,20 @@ apr_status_t apr_dir_open(apr_dir_t **new, const char *dirname,
(*new)->pool = pool;
(*new)->dirname = apr_pstrdup(pool, dirname);
(*new)->dirstruct = dir;
- (*new)->entry = apr_pcalloc(pool, dirent_size);
+
+#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \
+ && !defined(READDIR_IS_THREAD_SAFE)
+ /* On some platforms (e.g., Linux+GNU libc), d_name[] in struct
+ * dirent is declared with enough storage for the name. On other
+ * platforms (e.g., Solaris 8 for Intel), d_name is declared as a
+ * one-byte array. Note: gcc evaluates this at compile time.
+ */
+ (*new)->entry = apr_pcalloc(pool, sizeof(*(*new)->entry) +
+ (sizeof((*new)->entry->d_name) > 1
+ ? 0 : NAME_MAX));
+#else
+ (*new)->entry = NULL;
+#endif
apr_pool_cleanup_register((*new)->pool, *new, dir_cleanup,
apr_pool_cleanup_null);
diff --git a/include/apr.h.in b/include/apr.h.in
index 4d188853b259..ee99deff1036 100644
--- a/include/apr.h.in
+++ b/include/apr.h.in
@@ -93,6 +93,7 @@
#define APR_HAVE_STDLIB_H @stdlibh@
#define APR_HAVE_STRING_H @stringh@
#define APR_HAVE_STRINGS_H @stringsh@
+#define APR_HAVE_INTTYPES_H @inttypesh@
#define APR_HAVE_SYS_IOCTL_H @sys_ioctlh@
#define APR_HAVE_SYS_SENDFILE_H @sys_sendfileh@
#define APR_HAVE_SYS_SIGNAL_H @sys_signalh@
@@ -168,16 +169,25 @@
#include <sys/socket.h>
#endif
-#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS)
+#if APR_HAVE_STDINT_H
+#ifdef __cplusplus
/* C99 7.18.4 requires that stdint.h only exposes INT64_C
* and UINT64_C for C++ implementations if this is defined: */
+#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
-
-#if APR_HAVE_STDINT_H
+/* C++ needs this too for PRI*NN formats: */
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS
+#endif
+#endif /* __cplusplus */
#include <stdint.h>
#endif
+#if APR_HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+
#if APR_HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
@@ -197,6 +207,13 @@
#endif
#endif
+/* __APPLE__ is now the official pre-defined macro for macOS */
+#ifdef __APPLE__
+#undef DARWIN
+#undef DARWIN_10
+#define DARWIN
+#define DARWIN_10
+#endif /* __APPLE__ */
#ifdef __cplusplus
extern "C" {
@@ -280,6 +297,7 @@ extern "C" {
#define APR_HAS_LARGE_FILES @aprlfs@
#define APR_HAS_XTHREAD_FILES @apr_has_xthread_files@
#define APR_HAS_OS_UUID @osuuid@
+#define APR_HAS_TIMEDLOCKS @apr_has_timedlocks@
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD @apr_procattr_user_set_requires_password@
@@ -334,24 +352,28 @@ typedef unsigned @int_value@ apr_uint32_t;
*/
#ifdef DARWIN_10
#undef APR_SIZEOF_VOIDP
-#undef INT64_C
-#undef UINT64_C
+#undef APR_INT64_C
+#undef APR_UINT64_C
#ifdef __LP64__
typedef long apr_int64_t;
typedef unsigned long apr_uint64_t;
#define APR_SIZEOF_VOIDP 8
- #define INT64_C(v) (v ## L)
- #define UINT64_C(v) (v ## UL)
+ #define APR_INT64_C(v) (v ## L)
+ #define APR_UINT64_C(v) (v ## UL)
#else
typedef long long apr_int64_t;
typedef unsigned long long apr_uint64_t;
#define APR_SIZEOF_VOIDP 4
- #define INT64_C(v) (v ## LL)
- #define UINT64_C(v) (v ## ULL)
+ #define APR_INT64_C(v) (v ## LL)
+ #define APR_UINT64_C(v) (v ## ULL)
#endif
#else
- typedef @long_value@ apr_int64_t;
- typedef unsigned @long_value@ apr_uint64_t;
+ typedef @int64_value@ apr_int64_t;
+ typedef @uint64_value@ apr_uint64_t;
+
+ /* Mechanisms to properly type numeric literals */
+ @int64_literal@
+ @uint64_literal@
#endif
typedef @size_t_value@ apr_size_t;
@@ -369,10 +391,6 @@ typedef apr_uint32_t apr_uintptr_t;
/* Are we big endian? */
#define APR_IS_BIGENDIAN @bigendian@
-/* Mechanisms to properly type numeric literals */
-@int64_literal@
-@uint64_literal@
-
#ifdef INT16_MIN
#define APR_INT16_MIN INT16_MIN
#else
diff --git a/include/apr.hnw b/include/apr.hnw
index 540263126092..5df7d9d51858 100644
--- a/include/apr.hnw
+++ b/include/apr.hnw
@@ -214,6 +214,7 @@ extern "C" {
#define APR_HAS_LARGE_FILES 1
#define APR_HAS_XTHREAD_FILES 0
#define APR_HAS_OS_UUID 0
+#define APR_HAS_TIMEDLOCKS 1
#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 0
diff --git a/include/apr.hw b/include/apr.hw
index 300b2c8af0b5..35a9589885ed 100644
--- a/include/apr.hw
+++ b/include/apr.hw
@@ -339,6 +339,7 @@ extern "C" {
#define APR_HAS_UNICODE_FS 1
#define APR_HAS_PROC_INVOKED 1
#define APR_HAS_OS_UUID 1
+#define APR_HAS_TIMEDLOCKS 1
#ifndef _WIN32_WCE
#define APR_HAS_SENDFILE 1
diff --git a/include/apr.hwc b/include/apr.hwc
index 5f025bdd2db8..331c31774242 100644
--- a/include/apr.hwc
+++ b/include/apr.hwc
@@ -336,6 +336,7 @@ extern "C" {
#define APR_HAS_UNICODE_FS 1
#define APR_HAS_PROC_INVOKED 1
#define APR_HAS_OS_UUID 1
+#define APR_HAS_TIMEDLOCKS 1
#ifndef _WIN32_WCE
#define APR_HAS_SENDFILE 1
diff --git a/include/apr_atomic.h b/include/apr_atomic.h
index 7ea257123ae2..3d203edc30a6 100644
--- a/include/apr_atomic.h
+++ b/include/apr_atomic.h
@@ -113,6 +113,73 @@ APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint3
*/
APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val);
+/*
+ * Atomic operations on 64-bit values
+ * Note: Each of these functions internally implements a memory barrier
+ * on platforms that require it
+ */
+
+/**
+ * atomically read an apr_uint64_t from memory
+ * @param mem the pointer
+ */
+APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem);
+
+/**
+ * atomically set an apr_uint64_t in memory
+ * @param mem pointer to the object
+ * @param val value that the object will assume
+ */
+APR_DECLARE(void) apr_atomic_set64(volatile apr_uint64_t *mem, apr_uint64_t val);
+
+/**
+ * atomically add 'val' to an apr_uint64_t
+ * @param mem pointer to the object
+ * @param val amount to add
+ * @return old value pointed to by mem
+ */
+APR_DECLARE(apr_uint64_t) apr_atomic_add64(volatile apr_uint64_t *mem, apr_uint64_t val);
+
+/**
+ * atomically subtract 'val' from an apr_uint64_t
+ * @param mem pointer to the object
+ * @param val amount to subtract
+ */
+APR_DECLARE(void) apr_atomic_sub64(volatile apr_uint64_t *mem, apr_uint64_t val);
+
+/**
+ * atomically increment an apr_uint64_t by 1
+ * @param mem pointer to the object
+ * @return old value pointed to by mem
+ */
+APR_DECLARE(apr_uint64_t) apr_atomic_inc64(volatile apr_uint64_t *mem);
+
+/**
+ * atomically decrement an apr_uint64_t by 1
+ * @param mem pointer to the atomic value
+ * @return zero if the value becomes zero on decrement, otherwise non-zero
+ */
+APR_DECLARE(int) apr_atomic_dec64(volatile apr_uint64_t *mem);
+
+/**
+ * compare an apr_uint64_t's value with 'cmp'.
+ * If they are the same swap the value with 'with'
+ * @param mem pointer to the value
+ * @param with what to swap it with
+ * @param cmp the value to compare it to
+ * @return the old value of *mem
+ */
+APR_DECLARE(apr_uint64_t) apr_atomic_cas64(volatile apr_uint64_t *mem, apr_uint64_t with,
+ apr_uint64_t cmp);
+
+/**
+ * exchange an apr_uint64_t's value with 'val'.
+ * @param mem pointer to the value
+ * @param val what to swap it with
+ * @return the old value of *mem
+ */
+APR_DECLARE(apr_uint64_t) apr_atomic_xchg64(volatile apr_uint64_t *mem, apr_uint64_t val);
+
/**
* compare the pointer's value with cmp.
* If they are the same swap the value with 'with'
diff --git a/include/apr_encode.h b/include/apr_encode.h
new file mode 100644
index 000000000000..20fc932f6f54
--- /dev/null
+++ b/include/apr_encode.h
@@ -0,0 +1,569 @@
+/* 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.
+ */
+
+/**
+ * @file apr_encode.h
+ * @brief APR-UTIL Encoding
+ */
+#ifndef APR_ENCODE_H
+#define APR_ENCODE_H
+
+#include "apr.h"
+#include "apr_general.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @defgroup APR_Util_Encode Base64/Base64Url/Base32/Base32Hex/Base16 Encoding
+ * @ingroup APR_Util
+ * @{
+ */
+
+/**
+ * RFC4648 and RFC7515 compliant BASE64, BASE64URL, BASE32, BASE32HEX
+ * and BASE16 encode/decode functions.
+ *
+ * The following encodings are supported:
+ *
+ * - Base 64 Encoding
+ *
+ * o Use flag APR_ENCODE_NONE
+ * o https://tools.ietf.org/html/rfc4648#section-4
+ *
+ * - Base 64 Encoding with URL and Filename Safe Alphabet
+ *
+ * o Use flag APR_ENCODE_URL
+ * o https://tools.ietf.org/html/rfc4648#section-5
+ *
+ * - Base 64 URL Encoding without Padding
+ *
+ * o Use flag APR_ENCODE_BASE64URL
+ * o https://tools.ietf.org/html/rfc7515#appendix-C
+ *
+ * - Base 32 Encoding
+ *
+ * o Use flag APR_ENCODE_NONE
+ * o https://tools.ietf.org/html/rfc4648#section-6
+ *
+ * - Base 32 Encoding with Extended Hex Alphabet
+ *
+ * o Use flag APR_ENCODE_BASE32HEX
+ * o https://tools.ietf.org/html/rfc4648#section-7
+ *
+ * - Base 16 Encoding
+ *
+ * o Use flags APR_ENCODE_NONE/APR_ENCODE_COLON
+ * o https://tools.ietf.org/html/rfc4648#section-8
+ *
+ * If a non valid character of any kind including whitespace is passed to any
+ * of the decoder functions, APR_BADCH will be returned. In this case decoding
+ * will still take place, but the results can not be trusted.
+ *
+ * If APR_ENCODE_RELAXED is passed to the decoder functions, decoding will be
+ * attempted up until the first non valid character. If this results in an
+ * invalid state in the decoder, such as but not limited to an odd number of
+ * base16 characters, APR_BADCH will still be returned.
+ *
+ * If APR_ENCODE_RELAXED is not passed to a decoder function, the decoding will
+ * be done in constant time regardless of whether the result returns APR_SUCCESS
+ * or APR_BADCH.
+ *
+ * If the dest parameter is NULL, the maximum theoretical buffer size is
+ * returned in the len field, including space for a terminating zero character
+ * if the destination is a string. This value can be used to allocate buffers
+ * of a suitable safe size.
+ *
+ * If the dest parameter is provided, the encoding or decoding will take place,
+ * and the actual number of characters written is returned in the len field,
+ * ignoring any terminating zero.
+ *
+ * Plain strings are not assumed '\0' terminated unless APR_ENCODE_STRING is
+ * provided.
+ *
+ */
+
+/**
+ * When passing a string to one of the encode functions, this value can be
+ * passed to indicate a string-valued key, and have the length computed
+ * automatically.
+ */
+#define APR_ENCODE_STRING (-1)
+
+/**
+ * Generate RFC4648 base16/base32/base64.
+ */
+#define APR_ENCODE_NONE 0
+
+/**
+ * If relaxed, decode up until the first non base16/base32/base64 character.
+ */
+#define APR_ENCODE_RELAXED 1
+
+/**
+ * Omit the padding character (=) while encoding.
+ */
+#define APR_ENCODE_NOPADDING 2
+
+/**
+ * Generate RFC4648 Base 64 Encoding with URL and Filename Safe Alphabet
+ */
+#define APR_ENCODE_URL 4
+
+/**
+ * Generate RFC7515 BASE64URL
+ */
+#define APR_ENCODE_BASE64URL (APR_ENCODE_NOPADDING | APR_ENCODE_URL)
+
+/**
+ * Generate base32hex encoding instead of base32 encoding
+ */
+#define APR_ENCODE_BASE32HEX 8
+
+/**
+ * Generate base16 with colons between each token.
+ */
+#define APR_ENCODE_COLON 16
+
+/**
+ * Generate base16 with lower case characters.
+ */
+#define APR_ENCODE_LOWER 32
+
+/**
+ * Convert text data to base64.
+ * @param dest The destination string, can be NULL.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, emit RFC4648 Base 64 Encoding. If
+ * APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_URL,
+ * use RFC4648 Base 64 Encoding with URL and Filename Safe Alphabet.
+ * If APR_ENCODE_BASE64URL, use RFC7515 base64url Encoding.
+ * @param len If present and src is NULL, returns the maximum possible length
+ * of the destination string, including a zero pad. If present and src is
+ * not NULL, returns the number of characters actually written.
+ * @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL.
+ */
+APR_DECLARE(apr_status_t) apr_encode_base64(char *dest, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len);
+
+/**
+ * Convert binary data to base64.
+ * @param dest The destination string, can be NULL.
+ * @param src The original buffer.
+ * @param slen The length of the original buffer.
+ * @param flags If APR_ENCODE_NONE, emit RFC4648 Base 64 Encoding. If
+ * APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_URL,
+ * use RFC4648 Base 64 Encoding with URL and Filename Safe Alphabet.
+ * If APR_ENCODE_BASE64URL, use RFC7515 base64url Encoding.
+ * @param len If present and src is NULL, returns the maximum possible length
+ * of the destination string, including a zero pad. If present and src is
+ * not NULL, returns the number of characters actually written.
+ * @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL.
+ */
+APR_DECLARE(apr_status_t) apr_encode_base64_binary(char *dest, const unsigned char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len);
+
+/**
+ * Convert text data to base64, and return the results from a pool.
+ * @param p Pool to allocate from.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, emit RFC4648 Base 64 Encoding. If
+ * APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_URL,
+ * use RFC4648 Base 64 Encoding with URL and Filename Safe Alphabet.
+ * If APR_ENCODE_BASE64URL, use RFC7515 base64url Encoding.
+ * @param len If present, returns the number of characters written excluding
+ * the zero pad.
+ * @return A zero padded string allocated from the pool on success, or
+ * NULL if src was NULL.
+ */
+APR_DECLARE(const char *)apr_pencode_base64(apr_pool_t * p, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)__attribute__((nonnull(1)));
+
+/**
+ * Convert binary data to base64, and return the results from a pool.
+ * @param p Pool to allocate from.
+ * @param src The original buffer.
+ * @param slen The length of the original buffer.
+ * @param flags If APR_ENCODE_NONE, emit RFC4648 Base 64 Encoding. If
+ * APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_URL,
+ * use RFC4648 Base 64 Encoding with URL and Filename Safe Alphabet.
+ * If APR_ENCODE_BASE64URL, use RFC7515 base64url Encoding.
+ * @param len If present, returns the number of characters written excluding
+ * the zero pad.
+ * @return A zero padded string allocated from the pool on success, or
+ * NULL if src was NULL.
+ */
+APR_DECLARE(const char *)apr_pencode_base64_binary(apr_pool_t * p, const unsigned char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)__attribute__((nonnull(1)));
+
+/**
+ * Convert base64 or base64url with or without padding to text data.
+ * @param dest The destination string, can be NULL.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, attempt to decode the full original buffer,
+ * and return NULL if any bad character is detected. If APR_ENCODE_RELAXED,
+ * decode until the first non base64/base64url character.
+ * @param len If present and src is NULL, returns the maximum possible length
+ * of the destination string, including a zero pad. If present and src is
+ * not NULL, returns the number of characters actually written.
+ * @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL, or APR_BADCH
+ * if a non hex character is present.
+ */
+APR_DECLARE(apr_status_t) apr_decode_base64(char *dest, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len);
+
+/**
+ * Convert base64 or base64url with or without padding to binary data.
+ * @param dest The destination buffer, can be NULL.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, attempt to decode the full original buffer,
+ * and return NULL if any bad character is detected. If APR_ENCODE_RELAXED,
+ * decode until the first non base64/base64url character.
+ * @param len If present and src is NULL, returns the maximum possible length
+ * of the destination buffer, including a zero pad. If present and src is
+ * not NULL, returns the number of characters actually written.
+ * @return APR_SUCCESS, or APR_NOTFOUND if the src was NULL, or APR_BADCH
+ * if a non base64 character is present.
+ */
+APR_DECLARE(apr_status_t) apr_decode_base64_binary(unsigned char *dest,
+ const char *src, apr_ssize_t slen, int flags, apr_size_t * len);
+
+/**
+ * Convert base64 or base64url with or without padding to text data, and
+ * return the results from a pool.
+ * @param p Pool to allocate from.
+ * @param src The base64 string to decode.
+ * @param slen The length of the base64 string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, attempt to decode the full original buffer,
+ * and return NULL if any bad character is detected. If APR_ENCODE_RELAXED,
+ * decode until the first non base64/base64url character.
+ * @param len If present, returns the number of characters written, excluding
+ * the zero padding.
+ * @return A string allocated from the pool containing the result with a zero
+ * pad. If src was NULL, or an error occurred, NULL is returned.
+ */
+APR_DECLARE(const char *)apr_pdecode_base64(apr_pool_t * p, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+ __attribute__((nonnull(1)));
+
+/**
+ * Convert base64 or base64url with or without padding to binary data, and
+ * return the results from a pool.
+ * @param p Pool to allocate from.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, attempt to decode the full original buffer,
+ * and return NULL if any bad character is detected. If APR_ENCODE_RELAXED,
+ * decode until the first non base64/base64url character.
+ * @param len If present, returns the number of characters written, excluding
+ * the zero padding.
+ * @return A buffer allocated from the pool containing the result with a zero
+ * pad. If src was NULL, or an error occurred, NULL is returned.
+ */
+APR_DECLARE(const unsigned char *)apr_pdecode_base64_binary(apr_pool_t * p,
+ const char *src, apr_ssize_t slen, int flags, apr_size_t * len)
+ __attribute__((nonnull(1)));
+
+/**
+ * Convert text data to base32.
+ * @param dest The destination string, can be NULL.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, emit RFC4648 Base 32 Encoding. If
+ * APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_BASE32HEX,
+ * use RFC4648 base32hex Encoding.
+ * @param len If present and src is NULL, returns the maximum possible length
+ * of the destination string, including a zero pad. If present and src is
+ * not NULL, returns the number of characters actually written.
+ * @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL.
+ */
+APR_DECLARE(apr_status_t) apr_encode_base32(char *dest, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len);
+
+/**
+ * Convert binary data to base32.
+ * @param dest The destination string, can be NULL.
+ * @param src The original buffer.
+ * @param slen The length of the original buffer.
+ * @param flags If APR_ENCODE_NONE, emit RFC4648 Base 32 Encoding. If
+ * APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_BASE32HEX,
+ * use RFC4648 base32hex Encoding.
+ * @param len If present and src is NULL, returns the maximum possible length
+ * of the destination string, including a zero pad. If present and src is
+ * not NULL, returns the number of characters actually written.
+ * @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL.
+ */
+APR_DECLARE(apr_status_t) apr_encode_base32_binary(char *dest, const unsigned char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len);
+
+/**
+ * Convert text data to base32, and return the results from a pool.
+ * @param p Pool to allocate from.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, emit RFC4648 Base 32 Encoding. If
+ * APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_BASE32HEX,
+ * use RFC4648 base32hex Encoding.
+ * @param len If present, returns the number of characters written excluding
+ * the zero pad.
+ * @return A zero padded string allocated from the pool on success, or
+ * NULL if src was NULL.
+ */
+APR_DECLARE(const char *)apr_pencode_base32(apr_pool_t * p, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+ __attribute__((nonnull(1)));
+
+/**
+ * Convert binary data to base32, and return the results from a pool.
+ * @param p Pool to allocate from.
+ * @param src The original buffer.
+ * @param slen The length of the original buffer.
+ * @param flags If APR_ENCODE_NONE, emit RFC4648 Base 32 Encoding. If
+ * APR_ENCODE_NOPADDING, omit the = padding character. If APR_ENCODE_BASE32HEX,
+ * use RFC7515 base32hex Encoding.
+ * @param len If present, returns the number of characters written excluding
+ * the zero pad.
+ * @return A zero padded string allocated from the pool on success, or
+ * NULL if src was NULL.
+ */
+APR_DECLARE(const char *)apr_pencode_base32_binary(apr_pool_t * p, const unsigned char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+ __attribute__((nonnull(1)));
+
+/**
+ * Convert base32 or base32hex with or without padding to text data.
+ * @param dest The destination string, can be NULL.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, parse RFC4648 Base 32 Encoding. If
+ * APR_ENCODE_BASE32HEX, use RFC4648 base32hex Encoding.
+ * @param len If present and src is NULL, returns the maximum possible length
+ * of the destination buffer, including a zero pad. If present and src is
+ * not NULL, returns the number of characters actually written.
+ * @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL, or APR_BADCH
+ * if a non base32 character is present.
+ */
+APR_DECLARE(apr_status_t) apr_decode_base32(char *dest, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len);
+
+/**
+ * Convert base32 or base32hex with or without padding to binary data.
+ * @param dest The destination buffer, can be NULL.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, parse RFC4648 Base 32 Encoding. If
+ * APR_ENCODE_BASE32HEX, use RFC4648 base32hex Encoding.
+ * @param len If present and src is NULL, returns the maximum possible length
+ * of the destination buffer, including a zero pad. If present and src is
+ * not NULL, returns the number of characters actually written.
+ * @return APR_SUCCESS, or APR_NOTFOUND if the src was NULL, or APR_BADCH
+ * if a non base32 character is present.
+ */
+APR_DECLARE(apr_status_t) apr_decode_base32_binary(unsigned char *dest,
+ const char *src, apr_ssize_t slen, int flags, apr_size_t * len);
+
+/**
+ * Convert base32 or base32hex with or without padding to text data, and
+ * return the results from a pool.
+ * @param p Pool to allocate from.
+ * @param src The base32 string to decode.
+ * @param slen The length of the base32 string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, parse RFC4648 Base 32 Encoding. If
+ * APR_ENCODE_BASE32HEX, use RFC4648 base32hex Encoding.
+ * @param len If present, returns the number of characters written, excluding
+ * the zero padding.
+ * @return A string allocated from the pool containing the result with a zero
+ * pad. If src was NULL, or an error occurred, NULL is returned.
+ */
+APR_DECLARE(const char *)apr_pdecode_base32(apr_pool_t * p, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+ __attribute__((nonnull(1)));
+
+/**
+ * Convert base32 or base32hex with or without padding to binary data, and
+ * return the results from a pool.
+ * @param p Pool to allocate from.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, parse RFC4648 Base 32 Encoding. If
+ * APR_ENCODE_BASE32HEX, use RFC4648 base32hex Encoding.
+ * @param len If present, returns the number of characters written, excluding
+ * the zero padding.
+ * @return A buffer allocated from the pool containing the result with a zero
+ * pad. If src was NULL, or an error occurred, NULL is returned.
+ */
+APR_DECLARE(const unsigned char *)apr_pdecode_base32_binary(apr_pool_t * p,
+ const char *src, apr_ssize_t slen, int flags, apr_size_t * len)
+ __attribute__((nonnull(1)));
+
+/**
+ * Convert text data to base16 (hex).
+ * @param dest The destination string, can be NULL.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, emit RFC4648 Base 16 Encoding. If
+ * APR_ENCODE_COLON, separate each token with a colon.
+ * @param len If present and src is NULL, returns the maximum possible length
+ * of the destination buffer, including a zero pad. If present and src is
+ * not NULL, returns the number of characters actually written.
+ * @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL.
+ */
+APR_DECLARE(apr_status_t) apr_encode_base16(char *dest, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len);
+
+/**
+ * Convert binary data to base16 (hex).
+ * @param dest The destination string, can be NULL.
+ * @param src The original buffer.
+ * @param slen The length of the original buffer.
+ * @param flags If APR_ENCODE_NONE, emit RFC4648 Base 16 Encoding. If
+ * APR_ENCODE_COLON, separate each token with a colon.
+ * @param len If present and src is NULL, returns the maximum possible length
+ * of the destination buffer, including a zero pad. If present and src is
+ * not NULL, returns the number of characters actually written.
+ * @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL.
+ */
+APR_DECLARE(apr_status_t) apr_encode_base16_binary(char *dest,
+ const unsigned char *src, apr_ssize_t slen, int flags,
+ apr_size_t * len);
+
+/**
+ * Convert text data to base16 (hex), and return the results from a
+ * pool.
+ * @param p Pool to allocate from.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, emit RFC4648 Base 16 Encoding. If
+ * APR_ENCODE_COLON, separate each token with a colon.
+ * @param len If present, returns the number of characters written, excluding
+ * the zero padding.
+ * @return A string allocated from the pool containing the result with a zero
+ * pad. If src was NULL, or an error occurred, NULL is returned.
+ */
+APR_DECLARE(const char *)apr_pencode_base16(apr_pool_t * p, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+ __attribute__((nonnull(1)));
+
+/**
+ * Convert binary data to base16 (hex), and return the results from a
+ * pool.
+ * @param p Pool to allocate from.
+ * @param src The original buffer.
+ * @param slen The length of the original buffer.
+ * @param flags If APR_ENCODE_NONE, emit RFC4648 Base 16 Encoding. If
+ * APR_ENCODE_COLON, separate each token with a colon.
+ * @param len If present, returns the number of characters written, excluding
+ * the zero padding.
+ * @return A string allocated from the pool containing the result with a zero
+ * pad. If src was NULL, or an error occurred, NULL is returned.
+ */
+APR_DECLARE(const char *)apr_pencode_base16_binary(apr_pool_t * p,
+ const unsigned char *src, apr_ssize_t slen,
+ int flags, apr_size_t * len)__attribute__((nonnull(1)));
+
+/**
+ * Convert base16 (hex) to text data.
+ * @param dest The destination string, can be NULL.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, parse RFC4648 Base 16 Encoding. If
+ * APR_ENCODE_COLON, allow tokens to be separated with a colon.
+ * @param len If present and src is NULL, returns the maximum possible length
+ * of the destination buffer, including a zero pad. If present and src is
+ * not NULL, returns the number of characters actually written.
+ * @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL, or APR_BADCH
+ * if a non hex character is present. A zero pad is appended to the buffer.
+ */
+APR_DECLARE(apr_status_t) apr_decode_base16(char *dest, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len);
+
+/**
+ * Convert base16 (hex) to binary data.
+ * @param dest The destination buffer, can be NULL.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, parse RFC4648 Base 16 Encoding. If
+ * APR_ENCODE_COLON, allow tokens to be separated with a colon.
+ * @param len If present and src is NULL, returns the maximum possible length
+ * of the destination buffer, including a zero pad. If present and src is
+ * not NULL, returns the number of characters actually written.
+ * @return APR_SUCCESS, or APR_NOTFOUND if the string was NULL, or APR_BADCH
+ * if a non hex character is present. No zero pad is written to the buffer.
+ */
+APR_DECLARE(apr_status_t) apr_decode_base16_binary(unsigned char *dest,
+ const char *src, apr_ssize_t slen, int flags, apr_size_t * len);
+
+/**
+ * Convert base16 (hex) and return the results from a pool.
+ * @param p Pool to allocate from.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, parse RFC4648 Base 16 Encoding. If
+ * APR_ENCODE_COLON, allow tokens to be separated with a colon.
+ * @param len If present, returns the number of characters written, excluding
+ * the zero padding.
+ * @return A buffer allocated from the pool containing the result with a zero
+ * pad. If src was NULL, or an error occurred, NULL is returned.
+ */
+APR_DECLARE(const char *)apr_pdecode_base16(apr_pool_t * p, const char *src,
+ apr_ssize_t slen, int flags, apr_size_t * len)
+ __attribute__((nonnull(1)));
+
+/**
+ * Convert base16 (hex) to binary data, and return the results from a pool.
+ * @param p Pool to allocate from.
+ * @param src The original string.
+ * @param slen The length of the original string, or APR_ENCODE_STRING if
+ * NUL terminated.
+ * @param flags If APR_ENCODE_NONE, parse RFC4648 Base 16 Encoding. If
+ * APR_ENCODE_COLON, allow tokens to be separated with a colon.
+ * @param len If present, returns the number of characters written, excluding
+ * the zero padding.
+ * @return A buffer allocated from the pool containing the result with a zero
+ * pad. If src was NULL, or an error occurred, NULL is returned.
+ */
+APR_DECLARE(const unsigned char *)apr_pdecode_base16_binary(apr_pool_t * p,
+ const char *src, apr_ssize_t slen, int flags, apr_size_t * len)
+ __attribute__((nonnull(1)));
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APR_ENCODE_H */
diff --git a/include/apr_escape.h b/include/apr_escape.h
index 428a8cb6bd88..ed048c956d25 100644
--- a/include/apr_escape.h
+++ b/include/apr_escape.h
@@ -33,6 +33,19 @@ extern "C" {
/* Simple escape/unescape functions.
*
+ * The design goal of these functions are:
+ *
+ * - Avoid unnecessary work.
+ *
+ * In most cases the strings passed in do not need to be escaped at all. In
+ * these cases the original string will be returned.
+ *
+ * - Lowest possible memory footprint.
+ *
+ * The amount of memory allocated for a given encoding is calculated based
+ * on the exact amount of memory needed, and not the theoretical worst case
+ * scenario.
+ *
*/
/**
diff --git a/include/apr_global_mutex.h b/include/apr_global_mutex.h
index 90d9c55b0484..e3cba23ff202 100644
--- a/include/apr_global_mutex.h
+++ b/include/apr_global_mutex.h
@@ -29,6 +29,7 @@
#if APR_PROC_MUTEX_IS_GLOBAL
#include "apr_proc_mutex.h"
#endif
+#include "apr_time.h"
#ifdef __cplusplus
extern "C" {
@@ -66,6 +67,7 @@ typedef struct apr_global_mutex_t apr_global_mutex_t;
* APR_LOCK_POSIXSEM
* APR_LOCK_PROC_PTHREAD
* APR_LOCK_DEFAULT pick the default mechanism for the platform
+ * APR_LOCK_DEFAULT_TIMED pick the default timed mechanism
* </PRE>
* @param pool the pool from which to allocate the mutex.
* @warning Check APR_HAS_foo_SERIALIZE defines to see if the platform supports
@@ -109,6 +111,17 @@ APR_DECLARE(apr_status_t) apr_global_mutex_lock(apr_global_mutex_t *mutex);
APR_DECLARE(apr_status_t) apr_global_mutex_trylock(apr_global_mutex_t *mutex);
/**
+ * Attempt to acquire the lock for the given mutex until timeout expires.
+ * If the acquisition time outs, the call returns with APR_TIMEUP.
+ * @param mutex the mutex on which to attempt the lock acquiring.
+ * @param timeout the relative timeout (microseconds).
+ * @note A negative or nul timeout means immediate attempt, returning
+ * APR_TIMEUP without blocking if it the lock is already acquired.
+ */
+APR_DECLARE(apr_status_t) apr_global_mutex_timedlock(apr_global_mutex_t *mutex,
+ apr_interval_time_t timeout);
+
+/**
* Release the lock for the given mutex.
* @param mutex the mutex from which to release the lock.
*/
diff --git a/include/apr_network_io.h b/include/apr_network_io.h
index 43e578aca47e..7d6957bc763e 100644
--- a/include/apr_network_io.h
+++ b/include/apr_network_io.h
@@ -441,6 +441,31 @@ APR_DECLARE(apr_status_t) apr_sockaddr_info_copy(apr_sockaddr_t **dst,
const apr_sockaddr_t *src,
apr_pool_t *p);
+/* Set the zone of an IPv6 link-local address object.
+ * @param sa Socket address object
+ * @param zone_id Zone ID (textual "eth0" or numeric "3").
+ * @return Returns APR_EBADIP for non-IPv6 socket or an IPv6 address
+ * which isn't link-local.
+ */
+APR_DECLARE(apr_status_t) apr_sockaddr_zone_set(apr_sockaddr_t *sa,
+ const char *zone_id);
+
+
+/* Retrieve the zone of an IPv6 link-local address object.
+ * @param sa Socket address object
+ * @param name If non-NULL, set to the textual representation of the zone id
+ * @param id If non-NULL, set to the integer zone id
+ * @param p Pool from which *name is allocated if used.
+ * @return Returns APR_EBADIP for non-IPv6 socket or socket without any zone id
+ * set, or other error if the interface could not be mapped to a name.
+ * @remark Both name and id may be NULL, neither are modified if
+ * non-NULL in error cases.
+ */
+APR_DECLARE(apr_status_t) apr_sockaddr_zone_get(const apr_sockaddr_t *sa,
+ const char **name,
+ apr_uint32_t *id,
+ apr_pool_t *p);
+
/**
* Look up the host name from an apr_sockaddr_t.
* @param hostname The hostname.
diff --git a/include/apr_proc_mutex.h b/include/apr_proc_mutex.h
index bb5b34f0c08c..418c95048a70 100644
--- a/include/apr_proc_mutex.h
+++ b/include/apr_proc_mutex.h
@@ -26,6 +26,7 @@
#include "apr_pools.h"
#include "apr_errno.h"
#include "apr_perms_set.h"
+#include "apr_time.h"
#ifdef __cplusplus
extern "C" {
@@ -48,7 +49,8 @@ typedef enum {
APR_LOCK_SYSVSEM, /**< System V Semaphores */
APR_LOCK_PROC_PTHREAD, /**< POSIX pthread process-based locking */
APR_LOCK_POSIXSEM, /**< POSIX semaphore process-based locking */
- APR_LOCK_DEFAULT /**< Use the default process lock */
+ APR_LOCK_DEFAULT, /**< Use the default process lock */
+ APR_LOCK_DEFAULT_TIMED /**< Use the default process timed lock */
} apr_lockmech_e;
/** Opaque structure representing a process mutex. */
@@ -114,6 +116,17 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex);
APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex);
/**
+ * Attempt to acquire the lock for the given mutex until timeout expires.
+ * If the acquisition time outs, the call returns with APR_TIMEUP.
+ * @param mutex the mutex on which to attempt the lock acquiring.
+ * @param timeout the relative timeout (microseconds).
+ * @note A negative or nul timeout means immediate attempt, returning
+ * APR_TIMEUP without blocking if it the lock is already acquired.
+ */
+APR_DECLARE(apr_status_t) apr_proc_mutex_timedlock(apr_proc_mutex_t *mutex,
+ apr_interval_time_t timeout);
+
+/**
* Release the lock for the given mutex.
* @param mutex the mutex from which to release the lock.
*/
diff --git a/include/apr_thread_mutex.h b/include/apr_thread_mutex.h
index 193a70a3822c..8eb617291b82 100644
--- a/include/apr_thread_mutex.h
+++ b/include/apr_thread_mutex.h
@@ -43,9 +43,11 @@ typedef struct apr_thread_mutex_t apr_thread_mutex_t;
#define APR_THREAD_MUTEX_DEFAULT 0x0 /**< platform-optimal lock behavior */
#define APR_THREAD_MUTEX_NESTED 0x1 /**< enable nested (recursive) locks */
#define APR_THREAD_MUTEX_UNNESTED 0x2 /**< disable nested locks */
+#define APR_THREAD_MUTEX_TIMED 0x4 /**< enable timed locks */
/* Delayed the include to avoid a circular reference */
#include "apr_pools.h"
+#include "apr_time.h"
/**
* Create and initialize a mutex that can be used to synchronize threads.
@@ -82,6 +84,17 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex);
APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex);
/**
+ * Attempt to acquire the lock for the given mutex until timeout expires.
+ * If the acquisition time outs, the call returns with APR_TIMEUP.
+ * @param mutex the mutex on which to attempt the lock acquiring.
+ * @param timeout the relative timeout (microseconds).
+ * @note A timeout negative or nul means immediate attempt, returning
+ * APR_TIMEUP without blocking if it the lock is already acquired.
+ */
+APR_DECLARE(apr_status_t) apr_thread_mutex_timedlock(apr_thread_mutex_t *mutex,
+ apr_interval_time_t timeout);
+
+/**
* Release the lock for the given mutex.
* @param mutex the mutex from which to release the lock.
*/
diff --git a/include/apr_thread_proc.h b/include/apr_thread_proc.h
index 6b171e9ab639..ea3c43f90507 100644
--- a/include/apr_thread_proc.h
+++ b/include/apr_thread_proc.h
@@ -816,6 +816,13 @@ APR_DECLARE(apr_status_t) apr_setup_signal_thread(void);
* functions should return 1 if the signal has been handled, 0 otherwise.
* @param signal_handler The function to call when a signal is received
* apr_status_t apr_signal_thread((int)(*signal_handler)(int signum))
+ * @note Synchronous signals like SIGABRT/SIGSEGV/SIGBUS/... are ignored by
+ * apr_signal_thread() and thus can't be waited by this function (they remain
+ * handled by the operating system or its native signals interface).
+ * @remark In APR version 1.6 and ealier, SIGUSR2 was part of these ignored
+ * signals and thus was never passed in to the signal_handler. From APR 1.7
+ * this is no more the case so SIGUSR2 can be handled in signal_handler and
+ * acted upon like the other asynchronous signals.
*/
APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum));
diff --git a/include/apr_time.h b/include/apr_time.h
index 15e0b9611527..b0efd791c98a 100644
--- a/include/apr_time.h
+++ b/include/apr_time.h
@@ -23,7 +23,6 @@
*/
#include "apr.h"
-#include "apr_pools.h"
#include "apr_errno.h"
#ifdef __cplusplus
@@ -120,6 +119,9 @@ struct apr_time_exp_t {
apr_int32_t tm_gmtoff;
};
+/* Delayed the include to avoid a circular reference */
+#include "apr_pools.h"
+
/**
* Convert an ansi time_t to an apr_time_t
* @param result the resulting apr_time_t
diff --git a/include/apr_version.h b/include/apr_version.h
index 3dfbe0e07fdc..e96de38357c2 100644
--- a/include/apr_version.h
+++ b/include/apr_version.h
@@ -38,7 +38,7 @@
*/
-#define APR_COPYRIGHT "Copyright (c) 2000-2018 The Apache Software " \
+#define APR_COPYRIGHT "Copyright (c) 2000-2019 The Apache Software " \
"Foundation or its licensors, as applicable."
/* The numeric compile-time version constants. These constants are the
@@ -56,13 +56,13 @@
* Minor API changes that do not cause binary compatibility problems.
* Reset to 0 when upgrading APR_MAJOR_VERSION
*/
-#define APR_MINOR_VERSION 6
+#define APR_MINOR_VERSION 7
/** patch level
* The Patch Level never includes API changes, simply bug fixes.
* Reset to 0 when upgrading APR_MINOR_VERSION
*/
-#define APR_PATCH_VERSION 5
+#define APR_PATCH_VERSION 0
/**
* The symbol APR_IS_DEV_VERSION is only defined for internal,
diff --git a/include/arch/unix/apr_arch_atomic.h b/include/arch/unix/apr_arch_atomic.h
index f8019060e505..559257debb72 100644
--- a/include/arch/unix/apr_arch_atomic.h
+++ b/include/arch/unix/apr_arch_atomic.h
@@ -18,28 +18,36 @@
#define ATOMIC_H
#include "apr.h"
+#include "apr_pools.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
+# define NEED_ATOMICS_GENERIC64
+#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 defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
# define USE_ATOMICS_IA32
+# define NEED_ATOMICS_GENERIC64
#elif defined(__GNUC__) && (defined(__PPC__) || defined(__ppc__))
# define USE_ATOMICS_PPC
+# define NEED_ATOMICS_GENERIC64
#elif defined(__GNUC__) && (defined(__s390__) || defined(__s390x__))
# define USE_ATOMICS_S390
+# define NEED_ATOMICS_GENERIC64
#else
# define USE_ATOMICS_GENERIC
#endif
+#if defined(USE_ATOMICS_GENERIC) || defined (NEED_ATOMICS_GENERIC64)
+apr_status_t apr__atomic_generic64_init(apr_pool_t *p);
+#endif
+
#endif /* ATOMIC_H */
diff --git a/include/arch/unix/apr_arch_proc_mutex.h b/include/arch/unix/apr_arch_proc_mutex.h
index af49c17031f4..cfa0049f754b 100644
--- a/include/arch/unix/apr_arch_proc_mutex.h
+++ b/include/arch/unix/apr_arch_proc_mutex.h
@@ -26,6 +26,7 @@
#include "apr_portable.h"
#include "apr_file_io.h"
#include "apr_arch_file_io.h"
+#include "apr_time.h"
/* System headers required by Locks library */
#if APR_HAVE_SYS_TYPES_H
@@ -69,6 +70,7 @@ struct apr_proc_mutex_unix_lock_methods_t {
apr_status_t (*create)(apr_proc_mutex_t *, const char *);
apr_status_t (*acquire)(apr_proc_mutex_t *);
apr_status_t (*tryacquire)(apr_proc_mutex_t *);
+ apr_status_t (*timedacquire)(apr_proc_mutex_t *, apr_interval_time_t);
apr_status_t (*release)(apr_proc_mutex_t *);
apr_status_t (*cleanup)(void *);
apr_status_t (*child_init)(apr_proc_mutex_t **, apr_pool_t *, const char *);
diff --git a/include/arch/unix/apr_arch_thread_mutex.h b/include/arch/unix/apr_arch_thread_mutex.h
index 40cdef3c656b..4fe46c3b4275 100644
--- a/include/arch/unix/apr_arch_thread_mutex.h
+++ b/include/arch/unix/apr_arch_thread_mutex.h
@@ -21,6 +21,7 @@
#include "apr_private.h"
#include "apr_general.h"
#include "apr_thread_mutex.h"
+#include "apr_thread_cond.h"
#include "apr_portable.h"
#include "apr_atomic.h"
@@ -32,6 +33,8 @@
struct apr_thread_mutex_t {
apr_pool_t *pool;
pthread_mutex_t mutex;
+ apr_thread_cond_t *cond;
+ int locked, num_waiters;
};
#endif
diff --git a/include/arch/unix/apr_private.h.in b/include/arch/unix/apr_private.h.in
index c794b1962ec3..2377fcbf4336 100644
--- a/include/arch/unix/apr_private.h.in
+++ b/include/arch/unix/apr_private.h.in
@@ -89,6 +89,12 @@
/* Define if accept4 function is supported */
#undef HAVE_ACCEPT4
+/* Define to 1 if you have the `acquire_sem' function. */
+#undef HAVE_ACQUIRE_SEM
+
+/* Define to 1 if you have the `acquire_sem_etc' function. */
+#undef HAVE_ACQUIRE_SEM_ETC
+
/* Define if async i/o supports message q's */
#undef HAVE_AIO_MSGQ
@@ -99,6 +105,9 @@
*/
#undef HAVE_ALLOCA_H
+/* Define to 1 if you have the `arc4random_buf' function. */
+#undef HAVE_ARC4RANDOM_BUF
+
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
@@ -129,6 +138,10 @@
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
+/* Define to 1 if you have the declaration of `SYS_getrandom', and to 0 if you
+ don't. */
+#undef HAVE_DECL_SYS_GETRANDOM
+
/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
don't. */
#undef HAVE_DECL_SYS_SIGLIST
@@ -217,6 +230,9 @@
/* Define to 1 if you have the `getpwuid_r' function. */
#undef HAVE_GETPWUID_R
+/* Define to 1 if you have the `getrandom' function. */
+#undef HAVE_GETRANDOM
+
/* Define to 1 if you have the `getrlimit' function. */
#undef HAVE_GETRLIMIT
@@ -232,6 +248,12 @@
/* Define if hstrerror is present */
#undef HAVE_HSTRERROR
+/* Define to 1 if you have the `if_indextoname' function. */
+#undef HAVE_IF_INDEXTONAME
+
+/* Define to 1 if you have the `if_nametoindex' function. */
+#undef HAVE_IF_NAMETOINDEX
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -265,6 +287,9 @@
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
+/* Define to 1 if you have the <linux/random.h> header file. */
+#undef HAVE_LINUX_RANDOM_H
+
/* Define to 1 if you have the `localtime_r' function. */
#undef HAVE_LOCALTIME_R
@@ -361,6 +386,9 @@
/* Define to 1 if you have the `pthread_attr_setguardsize' function. */
#undef HAVE_PTHREAD_ATTR_SETGUARDSIZE
+/* Define to 1 if you have the `pthread_condattr_setpshared' function. */
+#undef HAVE_PTHREAD_CONDATTR_SETPSHARED
+
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
@@ -376,6 +404,12 @@
/* Define if cross-process robust mutexes are available */
#undef HAVE_PTHREAD_MUTEX_ROBUST
+/* Define if non-posix/portable cross-process robust mutexes are available */
+#undef HAVE_PTHREAD_MUTEX_ROBUST_NP
+
+/* Define to 1 if you have the `pthread_mutex_timedlock' function. */
+#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK
+
/* Define if PTHREAD_PROCESS_SHARED is defined in pthread.h */
#undef HAVE_PTHREAD_PROCESS_SHARED
@@ -412,12 +446,21 @@
/* Define to 1 if you have the `semget' function. */
#undef HAVE_SEMGET
+/* Define to 1 if you have the `semop' function. */
+#undef HAVE_SEMOP
+
+/* Define to 1 if you have the `semtimedop' function. */
+#undef HAVE_SEMTIMEDOP
+
/* Define to 1 if you have the `sem_close' function. */
#undef HAVE_SEM_CLOSE
/* Define to 1 if you have the `sem_post' function. */
#undef HAVE_SEM_POST
+/* Define to 1 if you have the `sem_timedwait' function. */
+#undef HAVE_SEM_TIMEDWAIT
+
/* Define if SEM_UNDO is defined in sys/sem.h */
#undef HAVE_SEM_UNDO
@@ -601,6 +644,9 @@
/* Define to 1 if you have the <sys/poll.h> header file. */
#undef HAVE_SYS_POLL_H
+/* Define to 1 if you have the <sys/random.h> header file. */
+#undef HAVE_SYS_RANDOM_H
+
/* Define to 1 if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
@@ -628,6 +674,9 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+#undef HAVE_SYS_SYSCALL_H
+
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#undef HAVE_SYS_SYSCTL_H
@@ -763,7 +812,7 @@
/* Define if pthread_getspecific() has two args */
#undef PTHREAD_GETSPECIFIC_TAKES_TWO_ARGS
-/* Define if readdir is thread safe */
+/* Modern readdir is thread safe */
#undef READDIR_IS_THREAD_SAFE
/* Define to 1 if the `setpgrp' function takes no argument. */
@@ -825,6 +874,9 @@
/* Define if SysV semaphores affect threads within the process */
#undef SYSVSEM_IS_GLOBAL
+/* Define system call of random */
+#undef SYS_RANDOM
+
/* Define if use of generic atomics is requested */
#undef USE_ATOMICS_GENERIC
@@ -837,6 +889,9 @@
/* Define if 4.2BSD-style flock() will be used */
#undef USE_FLOCK_SERIALIZE
+/* Define if pthread pshared mutex will be used */
+#undef USE_PROC_PTHREAD_SERIALIZE
+
/* Define if BeOS areas will be used */
#undef USE_SHMEM_BEOS
diff --git a/include/private/apr_encode_private.h b/include/private/apr_encode_private.h
new file mode 100644
index 000000000000..8db2e016695e
--- /dev/null
+++ b/include/private/apr_encode_private.h
@@ -0,0 +1,84 @@
+/* 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.
+ */
+
+/**
+ * @file apr_encode_private.h
+ * @brief APR-UTIL Encoding Private
+ */
+#ifndef APR_ENCODE_PRIVATE_H
+#define APR_ENCODE_PRIVATE_H
+
+#include "apr.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @defgroup APR_Util_Encode_Private
+ * @ingroup APR_Util
+ * @{
+ */
+
+#if APR_CHARSET_EBCDIC
+ static int convert_a2e[256] = {
+ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F,
+ 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0x7A, 0x5E, 0x4C, 0x7E, 0x6E, 0x6F,
+ 0x7C, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6,
+ 0xD7, 0xD8, 0xD9, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xAD, 0xE0, 0xBD, 0x5F, 0x6D,
+ 0x79, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96,
+ 0x97, 0x98, 0x99, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xC0, 0x4F, 0xD0, 0xA1, 0x07,
+ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x06, 0x17, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x09, 0x0A, 0x1B,
+ 0x30, 0x31, 0x1A, 0x33, 0x34, 0x35, 0x36, 0x08, 0x38, 0x39, 0x3A, 0x3B, 0x04, 0x14, 0x3E, 0xFF,
+ 0x41, 0xAA, 0x4A, 0xB1, 0x9F, 0xB2, 0x6A, 0xB5, 0xBB, 0xB4, 0x9A, 0x8A, 0xB0, 0xCA, 0xAF, 0xBC,
+ 0x90, 0x8F, 0xEA, 0xFA, 0xBE, 0xA0, 0xB6, 0xB3, 0x9D, 0xDA, 0x9B, 0x8B, 0xB7, 0xB8, 0xB9, 0xAB,
+ 0x64, 0x65, 0x62, 0x66, 0x63, 0x67, 0x9E, 0x68, 0x74, 0x71, 0x72, 0x73, 0x78, 0x75, 0x76, 0x77,
+ 0xAC, 0x69, 0xED, 0xEE, 0xEB, 0xEF, 0xEC, 0xBF, 0x80, 0xFD, 0xFE, 0xFB, 0xFC, 0xBA, 0xAE, 0x59,
+ 0x44, 0x45, 0x42, 0x46, 0x43, 0x47, 0x9C, 0x48, 0x54, 0x51, 0x52, 0x53, 0x58, 0x55, 0x56, 0x57,
+ 0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, 0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF};
+
+ static int convert_e2a[256] = {
+ 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
+ 0x10, 0x11, 0x12, 0x13, 0x9D, 0x0A, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F,
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1B, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07,
+ 0x90, 0x91, 0x16, 0x93, 0x94, 0x95, 0x96, 0x04, 0x98, 0x99, 0x9A, 0x9B, 0x14, 0x15, 0x9E, 0x1A,
+ 0x20, 0xA0, 0xE2, 0xE4, 0xE0, 0xE1, 0xE3, 0xE5, 0xE7, 0xF1, 0xA2, 0x2E, 0x3C, 0x28, 0x2B, 0x7C,
+ 0x26, 0xE9, 0xEA, 0xEB, 0xE8, 0xED, 0xEE, 0xEF, 0xEC, 0xDF, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0x5E,
+ 0x2D, 0x2F, 0xC2, 0xC4, 0xC0, 0xC1, 0xC3, 0xC5, 0xC7, 0xD1, 0xA6, 0x2C, 0x25, 0x5F, 0x3E, 0x3F,
+ 0xF8, 0xC9, 0xCA, 0xCB, 0xC8, 0xCD, 0xCE, 0xCF, 0xCC, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22,
+ 0xD8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0xAB, 0xBB, 0xF0, 0xFD, 0xFE, 0xB1,
+ 0xB0, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0xAA, 0xBA, 0xE6, 0xB8, 0xC6, 0xA4,
+ 0xB5, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0xA1, 0xBF, 0xD0, 0x5B, 0xDE, 0xAE,
+ 0xAC, 0xA3, 0xA5, 0xB7, 0xA9, 0xA7, 0xB6, 0xBC, 0xBD, 0xBE, 0xDD, 0xA8, 0xAF, 0x5D, 0xB4, 0xD7,
+ 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0xAD, 0xF4, 0xF6, 0xF2, 0xF3, 0xF5,
+ 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0xB9, 0xFB, 0xFC, 0xF9, 0xFA, 0xFF,
+ 0x5C, 0xF7, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0xB2, 0xD4, 0xD6, 0xD2, 0xD3, 0xD5,
+ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F};
+#define decode ENCODE_TO_ASCII(ch) convert_e2a[(unsigned char)ch]
+#define decode ENCODE_TO_NATIVE(ch) convert_a2e[(unsigned char)ch]
+#else /* APR_CHARSET_EBCDIC */
+#define ENCODE_TO_ASCII(ch) (ch)
+#define ENCODE_TO_NATIVE(ch) (ch)
+#endif /* !APR_CHARSET_EBCDIC */
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !APR_ENCODE_PRIVATE_H */
diff --git a/libapr.dsp b/libapr.dsp
index 3df0ca2637cf..5f933664d51a 100644
--- a/libapr.dsp
+++ b/libapr.dsp
@@ -45,7 +45,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
-# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(INTDIR)\libapr_src" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(INTDIR)\libapr_src" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -77,7 +77,7 @@ PostBuild_Cmds=if exist $(TargetPath).manifest mt.exe -manifest $(TargetPath).ma
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /EHsc /c
-# ADD CPP /nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c
+# ADD CPP /nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -109,7 +109,7 @@ PostBuild_Cmds=if exist $(TargetPath).manifest mt.exe -manifest $(TargetPath).ma
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
-# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(INTDIR)\libapr_src" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(INTDIR)\libapr_src" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL"
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -141,7 +141,7 @@ PostBuild_Cmds=if exist $(TargetPath).manifest mt.exe -manifest $(TargetPath).ma
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /EHsc /c
-# ADD CPP /nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c
+# ADD CPP /nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL"
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -177,6 +177,10 @@ PostBuild_Cmds=if exist $(TargetPath).manifest mt.exe -manifest $(TargetPath).ma
SOURCE=.\atomic\win32\apr_atomic.c
# End Source File
+# Begin Source File
+
+SOURCE=.\atomic\win32\apr_atomic64.c
+# End Source File
# End Group
# Begin Group "dso"
@@ -191,6 +195,10 @@ SOURCE=.\dso\win32\dso.c
# PROP Default_Filter ""
# Begin Source File
+SOURCE=.\encoding\apr_encode.c
+# End Source File
+# Begin Source File
+
SOURCE=.\encoding\apr_escape.c
# End Source File
# End Group
diff --git a/libapr.mak b/libapr.mak
index a643f45d31fe..e998aec28558 100644
--- a/libapr.mak
+++ b/libapr.mak
@@ -36,13 +36,15 @@ DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
OutDir=.\Release
# End Custom Macros
-ALL : ".\Release\gen_test_char.exe" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
+ALL : ".\include\apr.hw" ".\include\apr_escape.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
CLEAN :
-@erase "$(INTDIR)\apr_atomic.obj"
+ -@erase "$(INTDIR)\apr_atomic64.obj"
-@erase "$(INTDIR)\apr_cpystrn.obj"
-@erase "$(INTDIR)\apr_cpstr.obj"
+ -@erase "$(INTDIR)\apr_encode.obj"
-@erase "$(INTDIR)\apr_escape.obj"
-@erase "$(INTDIR)\apr_fnmatch.obj"
-@erase "$(INTDIR)\apr_getpass.obj"
@@ -130,7 +132,7 @@ CLEAN :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /c
+CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
@@ -171,10 +173,12 @@ BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc"
BSC32_SBRS= \
LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X86 /opt:ref
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /opt:ref
LINK32_OBJS= \
"$(INTDIR)\apr_atomic.obj" \
+ "$(INTDIR)\apr_atomic64.obj" \
"$(INTDIR)\dso.obj" \
+ "$(INTDIR)\apr_encode.obj" \
"$(INTDIR)\apr_escape.obj" \
"$(INTDIR)\buffer.obj" \
"$(INTDIR)\copy.obj" \
@@ -276,13 +280,15 @@ DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
OutDir=.\Debug
# End Custom Macros
-ALL : ".\include\apr_escape_test_char.h" ".\Debug\gen_test_char.exe" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
+ALL : ".\include\apr.hw" ".\include\apr_escape.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
CLEAN :
-@erase "$(INTDIR)\apr_atomic.obj"
+ -@erase "$(INTDIR)\apr_atomic64.obj"
-@erase "$(INTDIR)\apr_cpystrn.obj"
-@erase "$(INTDIR)\apr_cpstr.obj"
+ -@erase "$(INTDIR)\apr_encode.obj"
-@erase "$(INTDIR)\apr_escape.obj"
-@erase "$(INTDIR)\apr_fnmatch.obj"
-@erase "$(INTDIR)\apr_getpass.obj"
@@ -370,7 +376,7 @@ CLEAN :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c
+CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
@@ -411,10 +417,12 @@ BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc"
BSC32_SBRS= \
LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X86
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib"
LINK32_OBJS= \
"$(INTDIR)\apr_atomic.obj" \
+ "$(INTDIR)\apr_atomic64.obj" \
"$(INTDIR)\dso.obj" \
+ "$(INTDIR)\apr_encode.obj" \
"$(INTDIR)\apr_escape.obj" \
"$(INTDIR)\buffer.obj" \
"$(INTDIR)\copy.obj" \
@@ -516,13 +524,15 @@ DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
OutDir=.\x64\Release
# End Custom Macros
-ALL : ".\x64\Release\gen_test_char.exe" ".\include\apr_escape_test_char.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
+ALL : ".\include\apr.hw" ".\include\apr_escape.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
CLEAN :
-@erase "$(INTDIR)\apr_atomic.obj"
+ -@erase "$(INTDIR)\apr_atomic64.obj"
-@erase "$(INTDIR)\apr_cpystrn.obj"
-@erase "$(INTDIR)\apr_cpstr.obj"
+ -@erase "$(INTDIR)\apr_encode.obj"
-@erase "$(INTDIR)\apr_escape.obj"
-@erase "$(INTDIR)\apr_fnmatch.obj"
-@erase "$(INTDIR)\apr_getpass.obj"
@@ -610,7 +620,7 @@ CLEAN :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
-CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /c
+CPP_PROJ=/nologo /MD /W3 /Zi /O2 /Oy- /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
@@ -651,10 +661,12 @@ BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc"
BSC32_SBRS= \
LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X64 /opt:ref
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /opt:ref
LINK32_OBJS= \
"$(INTDIR)\apr_atomic.obj" \
+ "$(INTDIR)\apr_atomic64.obj" \
"$(INTDIR)\dso.obj" \
+ "$(INTDIR)\apr_encode.obj" \
"$(INTDIR)\apr_escape.obj" \
"$(INTDIR)\buffer.obj" \
"$(INTDIR)\copy.obj" \
@@ -756,13 +768,15 @@ DS_POSTBUILD_DEP=$(INTDIR)\postbld.dep
OutDir=.\x64\Debug
# End Custom Macros
-ALL : ".\x64\Debug\gen_test_char.exe" ".\include\apr_escape_test_char.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
+ALL : ".\include\apr.hw" ".\include\apr_escape.h" "$(OUTDIR)\libapr-1.dll" "$(DS_POSTBUILD_DEP)"
CLEAN :
-@erase "$(INTDIR)\apr_atomic.obj"
+ -@erase "$(INTDIR)\apr_atomic64.obj"
-@erase "$(INTDIR)\apr_cpystrn.obj"
-@erase "$(INTDIR)\apr_cpstr.obj"
+ -@erase "$(INTDIR)\apr_encode.obj"
-@erase "$(INTDIR)\apr_escape.obj"
-@erase "$(INTDIR)\apr_fnmatch.obj"
-@erase "$(INTDIR)\apr_getpass.obj"
@@ -850,7 +864,7 @@ CLEAN :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
-CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c
+CPP_PROJ=/nologo /MDd /W3 /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /I "./include/private" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "WINNT" /D "_WINDOWS" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\libapr_src" /FD /EHsc /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
@@ -891,10 +905,12 @@ BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.bsc"
BSC32_SBRS= \
LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /MACHINE:X64
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib"
LINK32_OBJS= \
"$(INTDIR)\apr_atomic.obj" \
+ "$(INTDIR)\apr_atomic64.obj" \
"$(INTDIR)\dso.obj" \
+ "$(INTDIR)\apr_encode.obj" \
"$(INTDIR)\apr_escape.obj" \
"$(INTDIR)\buffer.obj" \
"$(INTDIR)\copy.obj" \
@@ -1006,12 +1022,24 @@ SOURCE=.\atomic\win32\apr_atomic.c
$(CPP) $(CPP_PROJ) $(SOURCE)
+SOURCE=.\atomic\win32\apr_atomic64.c
+
+"$(INTDIR)\apr_atomic64.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
SOURCE=.\dso\win32\dso.c
"$(INTDIR)\dso.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr.h"
$(CPP) $(CPP_PROJ) $(SOURCE)
+SOURCE=.\encoding\apr_encode.c
+
+"$(INTDIR)\apr_encode.obj" : $(SOURCE) "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
+
+
SOURCE=.\encoding\apr_escape.c
"$(INTDIR)\apr_escape.obj" : $(SOURCE) "$(INTDIR)" ".\include\apr_escape.h" ".\include\apr_escape_test_char.h" ".\include\apr.h"
@@ -1569,75 +1597,6 @@ InputPath=.\include\apr_escape.h
!ENDIF
-SOURCE=.\include\apr_want.h
-
-!IF "$(CFG)" == "libapr - Win32 Release"
-
-InputPath=.\include\apr_want.h
-
-".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- type .\include\apr.hw > .\include\apr.h
-<<
-
-
-!ELSEIF "$(CFG)" == "libapr - Win32 Debug"
-
-InputPath=.\include\apr_want.h
-
-".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- type .\include\apr.hw > .\include\apr.h
-<<
-
-
-!ELSEIF "$(CFG)" == "libapr - Win32 Release9x"
-
-InputPath=.\include\apr_want.h
-
-".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- type .\include\apr.hw > .\include\apr.h
-<<
-
-
-!ELSEIF "$(CFG)" == "libapr - Win32 Debug9x"
-
-InputPath=.\include\apr_want.h
-
-".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- type .\include\apr.hw > .\include\apr.h
-<<
-
-
-!ELSEIF "$(CFG)" == "libapr - x64 Release"
-
-InputPath=.\include\apr_want.h
-
-".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- type .\include\apr.hw > .\include\apr.h
-<<
-
-
-!ELSEIF "$(CFG)" == "libapr - x64 Debug"
-
-InputPath=.\include\apr_want.h
-
-".\include\apr_escape_test_char.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
- <<tempfile.bat
- @echo off
- type .\include\apr.hw > .\include\apr.h
-<<
-
-
-!ENDIF
SOURCE=.\libapr.rc
diff --git a/locks/unix/global_mutex.c b/locks/unix/global_mutex.c
index 907b5583699b..02173513b7f2 100644
--- a/locks/unix/global_mutex.c
+++ b/locks/unix/global_mutex.c
@@ -142,6 +142,47 @@ APR_DECLARE(apr_status_t) apr_global_mutex_trylock(apr_global_mutex_t *mutex)
return rv;
}
+APR_DECLARE(apr_status_t) apr_global_mutex_timedlock(apr_global_mutex_t *mutex,
+ apr_interval_time_t timeout)
+{
+#if APR_HAS_TIMEDLOCKS
+ apr_status_t rv;
+
+#if APR_HAS_THREADS
+ if (mutex->thread_mutex) {
+ apr_time_t expiry = 0;
+ if (timeout > 0) {
+ expiry = apr_time_now() + timeout;
+ }
+ rv = apr_thread_mutex_timedlock(mutex->thread_mutex, timeout);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+ if (expiry) {
+ timeout = expiry - apr_time_now();
+ if (timeout < 0) {
+ timeout = 0;
+ }
+ }
+ }
+#endif /* APR_HAS_THREADS */
+
+ rv = apr_proc_mutex_timedlock(mutex->proc_mutex, timeout);
+
+#if APR_HAS_THREADS
+ if (rv != APR_SUCCESS) {
+ if (mutex->thread_mutex) {
+ (void)apr_thread_mutex_unlock(mutex->thread_mutex);
+ }
+ }
+#endif /* APR_HAS_THREADS */
+
+ return rv;
+#else /* APR_HAS_TIMEDLOCKS */
+ return APR_ENOTIMPL;
+#endif
+}
+
APR_DECLARE(apr_status_t) apr_global_mutex_unlock(apr_global_mutex_t *mutex)
{
apr_status_t rv;
diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c
index 8fa050af2944..8e2187ff7afe 100644
--- a/locks/unix/proc_mutex.c
+++ b/locks/unix/proc_mutex.c
@@ -46,6 +46,44 @@ static apr_status_t proc_mutex_no_perms_set(apr_proc_mutex_t *mutex,
}
#endif
+#if APR_HAS_FCNTL_SERIALIZE \
+ || APR_HAS_FLOCK_SERIALIZE \
+ || (APR_HAS_SYSVSEM_SERIALIZE \
+ && !defined(HAVE_SEMTIMEDOP)) \
+ || (APR_HAS_POSIXSEM_SERIALIZE \
+ && !defined(HAVE_SEM_TIMEDWAIT)) \
+ || (APR_HAS_PROC_PTHREAD_SERIALIZE \
+ && !defined(HAVE_PTHREAD_MUTEX_TIMEDLOCK) \
+ && !defined(HAVE_PTHREAD_CONDATTR_SETPSHARED))
+static apr_status_t proc_mutex_spinsleep_timedacquire(apr_proc_mutex_t *mutex,
+ apr_interval_time_t timeout)
+{
+#define SLEEP_TIME apr_time_from_msec(10)
+ apr_status_t rv;
+ for (;;) {
+ rv = apr_proc_mutex_trylock(mutex);
+ if (!APR_STATUS_IS_EBUSY(rv)) {
+ if (rv == APR_SUCCESS) {
+ mutex->curr_locked = 1;
+ }
+ break;
+ }
+ if (timeout <= 0) {
+ rv = APR_TIMEUP;
+ break;
+ }
+ if (timeout > SLEEP_TIME) {
+ apr_sleep(SLEEP_TIME);
+ timeout -= SLEEP_TIME;
+ }
+ else {
+ apr_sleep(timeout);
+ timeout = 0;
+ }
+ }
+ return rv;
+}
+#endif
#if APR_HAS_POSIXSEM_SERIALIZE
@@ -183,6 +221,37 @@ static apr_status_t proc_mutex_posix_tryacquire(apr_proc_mutex_t *mutex)
return APR_SUCCESS;
}
+#if defined(HAVE_SEM_TIMEDWAIT)
+static apr_status_t proc_mutex_posix_timedacquire(apr_proc_mutex_t *mutex,
+ apr_interval_time_t timeout)
+{
+ if (timeout <= 0) {
+ apr_status_t rv = proc_mutex_posix_tryacquire(mutex);
+ return (rv == APR_EBUSY) ? APR_TIMEUP : rv;
+ }
+ else {
+ int rc;
+ struct timespec abstime;
+
+ timeout += apr_time_now();
+ abstime.tv_sec = apr_time_sec(timeout);
+ abstime.tv_nsec = apr_time_usec(timeout) * 1000; /* nanoseconds */
+
+ do {
+ rc = sem_timedwait(mutex->os.psem_interproc, &abstime);
+ } while (rc < 0 && errno == EINTR);
+ if (rc < 0) {
+ if (errno == ETIMEDOUT) {
+ return APR_TIMEUP;
+ }
+ return errno;
+ }
+ }
+ mutex->curr_locked = 1;
+ return APR_SUCCESS;
+}
+#endif
+
static apr_status_t proc_mutex_posix_release(apr_proc_mutex_t *mutex)
{
mutex->curr_locked = 0;
@@ -204,6 +273,11 @@ static const apr_proc_mutex_unix_lock_methods_t mutex_posixsem_methods =
proc_mutex_posix_create,
proc_mutex_posix_acquire,
proc_mutex_posix_tryacquire,
+#if defined(HAVE_SEM_TIMEDWAIT)
+ proc_mutex_posix_timedacquire,
+#else
+ proc_mutex_spinsleep_timedacquire,
+#endif
proc_mutex_posix_release,
proc_mutex_posix_cleanup,
proc_mutex_no_child_init,
@@ -302,6 +376,37 @@ static apr_status_t proc_mutex_sysv_tryacquire(apr_proc_mutex_t *mutex)
return APR_SUCCESS;
}
+#if defined(HAVE_SEMTIMEDOP)
+static apr_status_t proc_mutex_sysv_timedacquire(apr_proc_mutex_t *mutex,
+ apr_interval_time_t timeout)
+{
+ if (timeout <= 0) {
+ apr_status_t rv = proc_mutex_sysv_tryacquire(mutex);
+ return (rv == APR_EBUSY) ? APR_TIMEUP : rv;
+ }
+ else {
+ int rc;
+ struct timespec reltime;
+
+ reltime.tv_sec = apr_time_sec(timeout);
+ reltime.tv_nsec = apr_time_usec(timeout) * 1000; /* nanoseconds */
+
+ do {
+ rc = semtimedop(mutex->os.crossproc, &proc_mutex_op_on, 1,
+ &reltime);
+ } while (rc < 0 && errno == EINTR);
+ if (rc < 0) {
+ if (errno == EAGAIN) {
+ return APR_TIMEUP;
+ }
+ return errno;
+ }
+ }
+ mutex->curr_locked = 1;
+ return APR_SUCCESS;
+}
+#endif
+
static apr_status_t proc_mutex_sysv_release(apr_proc_mutex_t *mutex)
{
int rc;
@@ -344,6 +449,11 @@ static const apr_proc_mutex_unix_lock_methods_t mutex_sysv_methods =
proc_mutex_sysv_create,
proc_mutex_sysv_acquire,
proc_mutex_sysv_tryacquire,
+#if defined(HAVE_SEMTIMEDOP)
+ proc_mutex_sysv_timedacquire,
+#else
+ proc_mutex_spinsleep_timedacquire,
+#endif
proc_mutex_sysv_release,
proc_mutex_sysv_cleanup,
proc_mutex_no_child_init,
@@ -356,6 +466,12 @@ static const apr_proc_mutex_unix_lock_methods_t mutex_sysv_methods =
#if APR_HAS_PROC_PTHREAD_SERIALIZE
+#ifndef APR_USE_PROC_PTHREAD_MUTEX_COND
+#define APR_USE_PROC_PTHREAD_MUTEX_COND \
+ (defined(HAVE_PTHREAD_CONDATTR_SETPSHARED) \
+ && !defined(HAVE_PTHREAD_MUTEX_TIMEDLOCK))
+#endif
+
/* The mmap()ed pthread_interproc is the native pthread_mutex_t followed
* by a refcounter to track children using it. We want to avoid calling
* pthread_mutex_destroy() on the shared mutex area while it is in use by
@@ -366,12 +482,29 @@ static const apr_proc_mutex_unix_lock_methods_t mutex_sysv_methods =
* destroy it.
*/
typedef struct {
+#define proc_pthread_cast(m) \
+ ((proc_pthread_mutex_t *)(m)->os.pthread_interproc)
pthread_mutex_t mutex;
+#define proc_pthread_mutex(m) \
+ (proc_pthread_cast(m)->mutex)
+#if APR_USE_PROC_PTHREAD_MUTEX_COND
+ pthread_cond_t cond;
+#define proc_pthread_mutex_cond(m) \
+ (proc_pthread_cast(m)->cond)
+ apr_int32_t cond_locked;
+#define proc_pthread_mutex_cond_locked(m) \
+ (proc_pthread_cast(m)->cond_locked)
+ apr_uint32_t cond_num_waiters;
+#define proc_pthread_mutex_cond_num_waiters(m) \
+ (proc_pthread_cast(m)->cond_num_waiters)
+#define proc_pthread_mutex_is_cond(m) \
+ ((m)->pthread_refcounting && proc_pthread_mutex_cond_locked(m) != -1)
+#endif /* APR_USE_PROC_PTHREAD_MUTEX_COND */
apr_uint32_t refcount;
+#define proc_pthread_mutex_refcount(m) \
+ (proc_pthread_cast(m)->refcount)
} proc_pthread_mutex_t;
-#define proc_pthread_mutex_refcount(m) \
- (((proc_pthread_mutex_t *)(m)->os.pthread_interproc)->refcount)
static APR_INLINE int proc_pthread_mutex_inc(apr_proc_mutex_t *mutex)
{
@@ -395,8 +528,14 @@ static apr_status_t proc_pthread_mutex_unref(void *mutex_)
apr_proc_mutex_t *mutex=mutex_;
apr_status_t rv;
+#if APR_USE_PROC_PTHREAD_MUTEX_COND
+ if (proc_pthread_mutex_is_cond(mutex)) {
+ mutex->curr_locked = 0;
+ }
+ else
+#endif /* APR_USE_PROC_PTHREAD_MUTEX_COND */
if (mutex->curr_locked == 1) {
- if ((rv = pthread_mutex_unlock(mutex->os.pthread_interproc))) {
+ if ((rv = pthread_mutex_unlock(&proc_pthread_mutex(mutex)))) {
#ifdef HAVE_ZOS_PTHREADS
rv = errno;
#endif
@@ -404,7 +543,17 @@ static apr_status_t proc_pthread_mutex_unref(void *mutex_)
}
}
if (!proc_pthread_mutex_dec(mutex)) {
- if ((rv = pthread_mutex_destroy(mutex->os.pthread_interproc))) {
+#if APR_USE_PROC_PTHREAD_MUTEX_COND
+ if (proc_pthread_mutex_is_cond(mutex) &&
+ (rv = pthread_cond_destroy(&proc_pthread_mutex_cond(mutex)))) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ return rv;
+ }
+#endif /* APR_USE_PROC_PTHREAD_MUTEX_COND */
+
+ if ((rv = pthread_mutex_destroy(&proc_pthread_mutex(mutex)))) {
#ifdef HAVE_ZOS_PTHREADS
rv = errno;
#endif
@@ -456,6 +605,9 @@ static apr_status_t proc_mutex_pthread_create(apr_proc_mutex_t *new_mutex,
new_mutex->pthread_refcounting = 1;
new_mutex->curr_locked = -1; /* until the mutex has been created */
+#if APR_USE_PROC_PTHREAD_MUTEX_COND
+ proc_pthread_mutex_cond_locked(new_mutex) = -1;
+#endif
if ((rv = pthread_mutexattr_init(&mattr))) {
#ifdef HAVE_ZOS_PTHREADS
@@ -473,9 +625,13 @@ static apr_status_t proc_mutex_pthread_create(apr_proc_mutex_t *new_mutex,
return rv;
}
+#if defined(HAVE_PTHREAD_MUTEX_ROBUST) || defined(HAVE_PTHREAD_MUTEX_ROBUST_NP)
#ifdef HAVE_PTHREAD_MUTEX_ROBUST
- if ((rv = pthread_mutexattr_setrobust_np(&mattr,
- PTHREAD_MUTEX_ROBUST_NP))) {
+ rv = pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST);
+#else
+ rv = pthread_mutexattr_setrobust_np(&mattr, PTHREAD_MUTEX_ROBUST_NP);
+#endif
+ if (rv) {
#ifdef HAVE_ZOS_PTHREADS
rv = errno;
#endif
@@ -491,9 +647,9 @@ static apr_status_t proc_mutex_pthread_create(apr_proc_mutex_t *new_mutex,
pthread_mutexattr_destroy(&mattr);
return rv;
}
-#endif /* HAVE_PTHREAD_MUTEX_ROBUST */
+#endif /* HAVE_PTHREAD_MUTEX_ROBUST[_NP] */
- if ((rv = pthread_mutex_init(new_mutex->os.pthread_interproc, &mattr))) {
+ if ((rv = pthread_mutex_init(&proc_pthread_mutex(new_mutex), &mattr))) {
#ifdef HAVE_ZOS_PTHREADS
rv = errno;
#endif
@@ -532,73 +688,301 @@ static apr_status_t proc_mutex_pthread_child_init(apr_proc_mutex_t **mutex,
return APR_SUCCESS;
}
-static apr_status_t proc_mutex_pthread_acquire(apr_proc_mutex_t *mutex)
+static apr_status_t proc_mutex_pthread_acquire_ex(apr_proc_mutex_t *mutex,
+ apr_interval_time_t timeout)
{
apr_status_t rv;
- if ((rv = pthread_mutex_lock(mutex->os.pthread_interproc))) {
-#ifdef HAVE_ZOS_PTHREADS
- rv = errno;
+#if APR_USE_PROC_PTHREAD_MUTEX_COND
+ if (proc_pthread_mutex_is_cond(mutex)) {
+ if ((rv = pthread_mutex_lock(&proc_pthread_mutex(mutex)))) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
#endif
+#if defined(HAVE_PTHREAD_MUTEX_ROBUST) || defined(HAVE_PTHREAD_MUTEX_ROBUST_NP)
+ /* Okay, our owner died. Let's try to make it consistent again. */
+ if (rv == EOWNERDEAD) {
+ proc_pthread_mutex_dec(mutex);
#ifdef HAVE_PTHREAD_MUTEX_ROBUST
- /* Okay, our owner died. Let's try to make it consistent again. */
- if (rv == EOWNERDEAD) {
- proc_pthread_mutex_dec(mutex);
- pthread_mutex_consistent_np(mutex->os.pthread_interproc);
+ pthread_mutex_consistent(&proc_pthread_mutex(mutex));
+#else
+ pthread_mutex_consistent_np(&proc_pthread_mutex(mutex));
+#endif
+ }
+ else
+#endif
+ return rv;
+ }
+
+ if (!proc_pthread_mutex_cond_locked(mutex)) {
+ rv = APR_SUCCESS;
+ }
+ else if (!timeout) {
+ rv = APR_TIMEUP;
+ }
+ else {
+ struct timespec abstime;
+
+ if (timeout > 0) {
+ timeout += apr_time_now();
+ abstime.tv_sec = apr_time_sec(timeout);
+ abstime.tv_nsec = apr_time_usec(timeout) * 1000; /* nanoseconds */
+ }
+
+ proc_pthread_mutex_cond_num_waiters(mutex)++;
+ do {
+ if (timeout < 0) {
+ rv = pthread_cond_wait(&proc_pthread_mutex_cond(mutex),
+ &proc_pthread_mutex(mutex));
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ break;
+ }
+ }
+ else {
+ rv = pthread_cond_timedwait(&proc_pthread_mutex_cond(mutex),
+ &proc_pthread_mutex(mutex),
+ &abstime);
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ if (rv == ETIMEDOUT) {
+ rv = APR_TIMEUP;
+ }
+ break;
+ }
+ }
+ } while (proc_pthread_mutex_cond_locked(mutex));
+ proc_pthread_mutex_cond_num_waiters(mutex)--;
+ }
+ if (rv != APR_SUCCESS) {
+ pthread_mutex_unlock(&proc_pthread_mutex(mutex));
+ return rv;
+ }
+
+ proc_pthread_mutex_cond_locked(mutex) = 1;
+
+ rv = pthread_mutex_unlock(&proc_pthread_mutex(mutex));
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ return rv;
+ }
+ }
+ else
+#endif /* APR_USE_PROC_PTHREAD_MUTEX_COND */
+ {
+ if (timeout < 0) {
+ rv = pthread_mutex_lock(&proc_pthread_mutex(mutex));
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ }
+ }
+ else if (!timeout) {
+ rv = pthread_mutex_trylock(&proc_pthread_mutex(mutex));
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ if (rv == EBUSY) {
+ return APR_TIMEUP;
+ }
+ }
}
else
+#if defined(HAVE_PTHREAD_MUTEX_TIMEDLOCK)
+ {
+ struct timespec abstime;
+
+ timeout += apr_time_now();
+ abstime.tv_sec = apr_time_sec(timeout);
+ abstime.tv_nsec = apr_time_usec(timeout) * 1000; /* nanoseconds */
+
+ rv = pthread_mutex_timedlock(&proc_pthread_mutex(mutex), &abstime);
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ if (rv == ETIMEDOUT) {
+ return APR_TIMEUP;
+ }
+ }
+ }
+ if (rv) {
+#if defined(HAVE_PTHREAD_MUTEX_ROBUST) || defined(HAVE_PTHREAD_MUTEX_ROBUST_NP)
+ /* Okay, our owner died. Let's try to make it consistent again. */
+ if (rv == EOWNERDEAD) {
+ proc_pthread_mutex_dec(mutex);
+#ifdef HAVE_PTHREAD_MUTEX_ROBUST
+ pthread_mutex_consistent(&proc_pthread_mutex(mutex));
+#else
+ pthread_mutex_consistent_np(&proc_pthread_mutex(mutex));
+#endif
+ }
+ else
+#endif
+ return rv;
+ }
+#else /* !HAVE_PTHREAD_MUTEX_TIMEDLOCK */
+ return proc_mutex_spinsleep_timedacquire(mutex, timeout);
#endif
- return rv;
}
+
mutex->curr_locked = 1;
return APR_SUCCESS;
}
+static apr_status_t proc_mutex_pthread_acquire(apr_proc_mutex_t *mutex)
+{
+ return proc_mutex_pthread_acquire_ex(mutex, -1);
+}
+
static apr_status_t proc_mutex_pthread_tryacquire(apr_proc_mutex_t *mutex)
{
+ apr_status_t rv = proc_mutex_pthread_acquire_ex(mutex, 0);
+ return (rv == APR_TIMEUP) ? APR_EBUSY : rv;
+}
+
+static apr_status_t proc_mutex_pthread_timedacquire(apr_proc_mutex_t *mutex,
+ apr_interval_time_t timeout)
+{
+ return proc_mutex_pthread_acquire_ex(mutex, (timeout <= 0) ? 0 : timeout);
+}
+
+static apr_status_t proc_mutex_pthread_release(apr_proc_mutex_t *mutex)
+{
apr_status_t rv;
-
- if ((rv = pthread_mutex_trylock(mutex->os.pthread_interproc))) {
+
+#if APR_USE_PROC_PTHREAD_MUTEX_COND
+ if (proc_pthread_mutex_is_cond(mutex)) {
+ if ((rv = pthread_mutex_lock(&proc_pthread_mutex(mutex)))) {
#ifdef HAVE_ZOS_PTHREADS
- rv = errno;
+ rv = errno;
#endif
- if (rv == EBUSY) {
- return APR_EBUSY;
- }
+#if defined(HAVE_PTHREAD_MUTEX_ROBUST) || defined(HAVE_PTHREAD_MUTEX_ROBUST_NP)
+ /* Okay, our owner died. Let's try to make it consistent again. */
+ if (rv == EOWNERDEAD) {
+ proc_pthread_mutex_dec(mutex);
#ifdef HAVE_PTHREAD_MUTEX_ROBUST
- /* Okay, our owner died. Let's try to make it consistent again. */
- if (rv == EOWNERDEAD) {
- proc_pthread_mutex_dec(mutex);
- pthread_mutex_consistent_np(mutex->os.pthread_interproc);
+ pthread_mutex_consistent(&proc_pthread_mutex(mutex));
+#else
+ pthread_mutex_consistent_np(&proc_pthread_mutex(mutex));
+#endif
+ }
+ else
+#endif
+ return rv;
}
- else
+
+ if (!proc_pthread_mutex_cond_locked(mutex)) {
+ rv = APR_EINVAL;
+ }
+ else if (!proc_pthread_mutex_cond_num_waiters(mutex)) {
+ rv = APR_SUCCESS;
+ }
+ else {
+ rv = pthread_cond_signal(&proc_pthread_mutex_cond(mutex));
+#ifdef HAVE_ZOS_PTHREADS
+ if (rv) {
+ rv = errno;
+ }
+#endif
+ }
+ if (rv != APR_SUCCESS) {
+ pthread_mutex_unlock(&proc_pthread_mutex(mutex));
+ return rv;
+ }
+
+ proc_pthread_mutex_cond_locked(mutex) = 0;
+ }
+#endif /* APR_USE_PROC_PTHREAD_MUTEX_COND */
+
+ mutex->curr_locked = 0;
+ if ((rv = pthread_mutex_unlock(&proc_pthread_mutex(mutex)))) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
#endif
return rv;
}
- mutex->curr_locked = 1;
+
return APR_SUCCESS;
}
-static apr_status_t proc_mutex_pthread_release(apr_proc_mutex_t *mutex)
+static const apr_proc_mutex_unix_lock_methods_t mutex_proc_pthread_methods =
+{
+ APR_PROCESS_LOCK_MECH_IS_GLOBAL,
+ proc_mutex_pthread_create,
+ proc_mutex_pthread_acquire,
+ proc_mutex_pthread_tryacquire,
+ proc_mutex_pthread_timedacquire,
+ proc_mutex_pthread_release,
+ proc_mutex_pthread_cleanup,
+ proc_mutex_pthread_child_init,
+ proc_mutex_no_perms_set,
+ APR_LOCK_PROC_PTHREAD,
+ "pthread"
+};
+
+#if APR_USE_PROC_PTHREAD_MUTEX_COND
+static apr_status_t proc_mutex_pthread_cond_create(apr_proc_mutex_t *new_mutex,
+ const char *fname)
{
apr_status_t rv;
+ pthread_condattr_t cattr;
- mutex->curr_locked = 0;
- if ((rv = pthread_mutex_unlock(mutex->os.pthread_interproc))) {
+ rv = proc_mutex_pthread_create(new_mutex, fname);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+
+ if ((rv = pthread_condattr_init(&cattr))) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ apr_pool_cleanup_run(new_mutex->pool, new_mutex,
+ apr_proc_mutex_cleanup);
+ return rv;
+ }
+ if ((rv = pthread_condattr_setpshared(&cattr, PTHREAD_PROCESS_SHARED))) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ pthread_condattr_destroy(&cattr);
+ apr_pool_cleanup_run(new_mutex->pool, new_mutex,
+ apr_proc_mutex_cleanup);
+ return rv;
+ }
+ if ((rv = pthread_cond_init(&proc_pthread_mutex_cond(new_mutex),
+ &cattr))) {
#ifdef HAVE_ZOS_PTHREADS
rv = errno;
#endif
+ pthread_condattr_destroy(&cattr);
+ apr_pool_cleanup_run(new_mutex->pool, new_mutex,
+ apr_proc_mutex_cleanup);
return rv;
}
+ pthread_condattr_destroy(&cattr);
+
+ proc_pthread_mutex_cond_locked(new_mutex) = 0;
+ proc_pthread_mutex_cond_num_waiters(new_mutex) = 0;
+
return APR_SUCCESS;
}
-static const apr_proc_mutex_unix_lock_methods_t mutex_proc_pthread_methods =
+static const apr_proc_mutex_unix_lock_methods_t mutex_proc_pthread_cond_methods =
{
APR_PROCESS_LOCK_MECH_IS_GLOBAL,
- proc_mutex_pthread_create,
+ proc_mutex_pthread_cond_create,
proc_mutex_pthread_acquire,
proc_mutex_pthread_tryacquire,
+ proc_mutex_pthread_timedacquire,
proc_mutex_pthread_release,
proc_mutex_pthread_cleanup,
proc_mutex_pthread_child_init,
@@ -606,6 +990,7 @@ static const apr_proc_mutex_unix_lock_methods_t mutex_proc_pthread_methods =
APR_LOCK_PROC_PTHREAD,
"pthread"
};
+#endif
#endif
@@ -762,6 +1147,7 @@ static const apr_proc_mutex_unix_lock_methods_t mutex_fcntl_methods =
proc_mutex_fcntl_create,
proc_mutex_fcntl_acquire,
proc_mutex_fcntl_tryacquire,
+ proc_mutex_spinsleep_timedacquire,
proc_mutex_fcntl_release,
proc_mutex_fcntl_cleanup,
proc_mutex_no_child_init,
@@ -935,6 +1321,7 @@ static const apr_proc_mutex_unix_lock_methods_t mutex_flock_methods =
proc_mutex_flock_create,
proc_mutex_flock_acquire,
proc_mutex_flock_tryacquire,
+ proc_mutex_spinsleep_timedacquire,
proc_mutex_flock_release,
proc_mutex_flock_cleanup,
proc_mutex_flock_child_init,
@@ -1041,6 +1428,43 @@ static apr_status_t proc_mutex_choose_method(apr_proc_mutex_t *new_mutex,
return APR_ENOTIMPL;
#endif
break;
+ case APR_LOCK_DEFAULT_TIMED:
+#if APR_HAS_PROC_PTHREAD_SERIALIZE \
+ && (APR_USE_PROC_PTHREAD_MUTEX_COND \
+ || defined(HAVE_PTHREAD_MUTEX_TIMEDLOCK)) \
+ && defined(HAVE_PTHREAD_MUTEX_ROBUST)
+#if APR_USE_PROC_PTHREAD_MUTEX_COND
+ new_mutex->meth = &mutex_proc_pthread_cond_methods;
+#else
+ new_mutex->meth = &mutex_proc_pthread_methods;
+#endif
+ if (ospmutex) {
+ if (ospmutex->pthread_interproc == NULL) {
+ return APR_EINVAL;
+ }
+ new_mutex->os.pthread_interproc = ospmutex->pthread_interproc;
+ }
+ break;
+#elif APR_HAS_SYSVSEM_SERIALIZE && defined(HAVE_SEMTIMEDOP)
+ new_mutex->meth = &mutex_sysv_methods;
+ if (ospmutex) {
+ if (ospmutex->crossproc == -1) {
+ return APR_EINVAL;
+ }
+ new_mutex->os.crossproc = ospmutex->crossproc;
+ }
+ break;
+#elif APR_HAS_POSIXSEM_SERIALIZE && defined(HAVE_SEM_TIMEDWAIT)
+ new_mutex->meth = &mutex_posixsem_methods;
+ if (ospmutex) {
+ if (ospmutex->psem_interproc == NULL) {
+ return APR_EINVAL;
+ }
+ new_mutex->os.psem_interproc = ospmutex->psem_interproc;
+ }
+ break;
+#endif
+ /* fall trough */
case APR_LOCK_DEFAULT:
#if APR_USE_FLOCK_SERIALIZE
new_mutex->meth = &mutex_flock_methods;
@@ -1156,6 +1580,16 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex)
return mutex->meth->tryacquire(mutex);
}
+APR_DECLARE(apr_status_t) apr_proc_mutex_timedlock(apr_proc_mutex_t *mutex,
+ apr_interval_time_t timeout)
+{
+#if APR_HAS_TIMEDLOCKS
+ return mutex->meth->timedacquire(mutex, timeout);
+#else
+ return APR_ENOTIMPL;
+#endif
+}
+
APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex)
{
return mutex->meth->release(mutex);
diff --git a/locks/unix/thread_cond.c b/locks/unix/thread_cond.c
index db7dd4f0d973..3c8e3170a0dc 100644
--- a/locks/unix/thread_cond.c
+++ b/locks/unix/thread_cond.c
@@ -79,21 +79,31 @@ APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond,
apr_interval_time_t timeout)
{
apr_status_t rv;
- apr_time_t then;
- struct timespec abstime;
+ if (timeout < 0) {
+ rv = pthread_cond_wait(&cond->cond, &mutex->mutex);
+#ifdef HAVE_ZOS_PTHREADS
+ if (rv) {
+ rv = errno;
+ }
+#endif
+ }
+ else {
+ apr_time_t then;
+ struct timespec abstime;
- then = apr_time_now() + timeout;
- abstime.tv_sec = apr_time_sec(then);
- abstime.tv_nsec = apr_time_usec(then) * 1000; /* nanoseconds */
+ then = apr_time_now() + timeout;
+ abstime.tv_sec = apr_time_sec(then);
+ abstime.tv_nsec = apr_time_usec(then) * 1000; /* nanoseconds */
- rv = pthread_cond_timedwait(&cond->cond, &mutex->mutex, &abstime);
+ rv = pthread_cond_timedwait(&cond->cond, &mutex->mutex, &abstime);
#ifdef HAVE_ZOS_PTHREADS
- if (rv) {
- rv = errno;
- }
+ if (rv) {
+ rv = errno;
+ }
#endif
- if (ETIMEDOUT == rv) {
- return APR_TIMEUP;
+ if (ETIMEDOUT == rv) {
+ return APR_TIMEUP;
+ }
}
return rv;
}
diff --git a/locks/unix/thread_mutex.c b/locks/unix/thread_mutex.c
index 73fd1e146210..f7cae5145781 100644
--- a/locks/unix/thread_mutex.c
+++ b/locks/unix/thread_mutex.c
@@ -77,6 +77,19 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex,
return rv;
}
+#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
+ if (flags & APR_THREAD_MUTEX_TIMED) {
+ rv = apr_thread_cond_create(&new_mutex->cond, pool);
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ pthread_mutex_destroy(&new_mutex->mutex);
+ return rv;
+ }
+ }
+#endif
+
apr_pool_cleanup_register(new_mutex->pool,
new_mutex, thread_mutex_cleanup,
apr_pool_cleanup_null);
@@ -89,13 +102,45 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex)
{
apr_status_t rv;
+ if (mutex->cond) {
+ apr_status_t rv2;
+
+ rv = pthread_mutex_lock(&mutex->mutex);
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ return rv;
+ }
+
+ if (mutex->locked) {
+ mutex->num_waiters++;
+ rv = apr_thread_cond_wait(mutex->cond, mutex);
+ mutex->num_waiters--;
+ }
+ else {
+ mutex->locked = 1;
+ }
+
+ rv2 = pthread_mutex_unlock(&mutex->mutex);
+ if (rv2 && !rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#else
+ rv = rv2;
+#endif
+ }
+
+ return rv;
+ }
+
rv = pthread_mutex_lock(&mutex->mutex);
#ifdef HAVE_ZOS_PTHREADS
if (rv) {
rv = errno;
}
#endif
-
+
return rv;
}
@@ -103,6 +148,36 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex)
{
apr_status_t rv;
+ if (mutex->cond) {
+ apr_status_t rv2;
+
+ rv = pthread_mutex_lock(&mutex->mutex);
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ return rv;
+ }
+
+ if (mutex->locked) {
+ rv = APR_EBUSY;
+ }
+ else {
+ mutex->locked = 1;
+ }
+
+ rv2 = pthread_mutex_unlock(&mutex->mutex);
+ if (rv2) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#else
+ rv = rv2;
+#endif
+ }
+
+ return rv;
+ }
+
rv = pthread_mutex_trylock(&mutex->mutex);
if (rv) {
#ifdef HAVE_ZOS_PTHREADS
@@ -114,10 +189,121 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex)
return APR_SUCCESS;
}
+APR_DECLARE(apr_status_t) apr_thread_mutex_timedlock(apr_thread_mutex_t *mutex,
+ apr_interval_time_t timeout)
+{
+ apr_status_t rv = APR_ENOTIMPL;
+#if APR_HAS_TIMEDLOCKS
+
+#ifdef HAVE_PTHREAD_MUTEX_TIMEDLOCK
+ if (timeout <= 0) {
+ rv = pthread_mutex_trylock(&mutex->mutex);
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ if (rv == EBUSY) {
+ rv = APR_TIMEUP;
+ }
+ }
+ }
+ else {
+ struct timespec abstime;
+
+ timeout += apr_time_now();
+ abstime.tv_sec = apr_time_sec(timeout);
+ abstime.tv_nsec = apr_time_usec(timeout) * 1000; /* nanoseconds */
+
+ rv = pthread_mutex_timedlock(&mutex->mutex, &abstime);
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ if (rv == ETIMEDOUT) {
+ rv = APR_TIMEUP;
+ }
+ }
+ }
+
+#else /* HAVE_PTHREAD_MUTEX_TIMEDLOCK */
+
+ if (mutex->cond) {
+ rv = pthread_mutex_lock(&mutex->mutex);
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ return rv;
+ }
+
+ if (mutex->locked) {
+ if (timeout <= 0) {
+ rv = APR_TIMEUP;
+ }
+ else {
+ mutex->num_waiters++;
+ do {
+ rv = apr_thread_cond_timedwait(mutex->cond, mutex,
+ timeout);
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ break;
+ }
+ } while (mutex->locked);
+ mutex->num_waiters--;
+ }
+ if (rv) {
+ pthread_mutex_unlock(&mutex->mutex);
+ return rv;
+ }
+ }
+
+ mutex->locked = 1;
+
+ rv = pthread_mutex_unlock(&mutex->mutex);
+ if (rv) {
+#ifdef HAVE_ZOS_PTHREADS
+ rv = errno;
+#endif
+ return rv;
+ }
+ }
+
+#endif /* HAVE_PTHREAD_MUTEX_TIMEDLOCK */
+
+#endif /* APR_HAS_TIMEDLOCKS */
+ return rv;
+}
+
APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex)
{
apr_status_t status;
+ if (mutex->cond) {
+ status = pthread_mutex_lock(&mutex->mutex);
+ if (status) {
+#ifdef HAVE_ZOS_PTHREADS
+ status = errno;
+#endif
+ return status;
+ }
+
+ if (!mutex->locked) {
+ status = APR_EINVAL;
+ }
+ else if (mutex->num_waiters) {
+ status = apr_thread_cond_signal(mutex->cond);
+ }
+ if (status) {
+ pthread_mutex_unlock(&mutex->mutex);
+ return status;
+ }
+
+ mutex->locked = 0;
+ }
+
status = pthread_mutex_unlock(&mutex->mutex);
#ifdef HAVE_ZOS_PTHREADS
if (status) {
@@ -130,7 +316,17 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex)
APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex)
{
- return apr_pool_cleanup_run(mutex->pool, mutex, thread_mutex_cleanup);
+ apr_status_t rv, rv2 = APR_SUCCESS;
+
+ if (mutex->cond) {
+ rv2 = apr_thread_cond_destroy(mutex->cond);
+ }
+ rv = apr_pool_cleanup_run(mutex->pool, mutex, thread_mutex_cleanup);
+ if (rv == APR_SUCCESS) {
+ rv = rv2;
+ }
+
+ return rv;
}
APR_POOL_IMPLEMENT_ACCESSOR(thread_mutex)
diff --git a/misc/unix/rand.c b/misc/unix/rand.c
index c1e1e8f60dbd..c0567a667e37 100644
--- a/misc/unix/rand.c
+++ b/misc/unix/rand.c
@@ -43,6 +43,31 @@
#include <sys/uuid.h>
#endif
+#if defined(SYS_RANDOM)
+#if defined(HAVE_SYS_RANDOM_H) && \
+ defined(HAVE_GETRANDOM)
+
+#include <sys/random.h>
+#define USE_GETRANDOM
+
+#elif defined(HAVE_SYS_SYSCALL_H) && \
+ defined(HAVE_LINUX_RANDOM_H) && \
+ defined(HAVE_DECL_SYS_GETRANDOM) && \
+ HAVE_DECL_SYS_GETRANDOM
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <linux/random.h>
+#define getrandom(buf, buflen, flags) \
+ syscall(SYS_getrandom, (buf), (buflen), (flags))
+#define USE_GETRANDOM
+
+#endif /* HAVE_SYS_RANDOM_H */
+#endif /* SYS_RANDOM */
+
#ifndef SHUT_RDWR
#define SHUT_RDWR 2
#endif
@@ -87,48 +112,7 @@ APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data)
APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf,
apr_size_t length)
{
-#ifdef DEV_RANDOM
-
- int fd = -1;
-
- /* On BSD/OS 4.1, /dev/random gives out 8 bytes at a time, then
- * gives EOF, so reading 'length' bytes may require opening the
- * device several times. */
- do {
- apr_ssize_t rc;
-
- if (fd == -1)
- if ((fd = open(DEV_RANDOM, O_RDONLY)) == -1)
- return errno;
-
- do {
- rc = read(fd, buf, length);
- } while (rc == -1 && errno == EINTR);
-
- if (rc < 0) {
- int errnum = errno;
- close(fd);
- return errnum;
- }
- else if (rc == 0) {
- close(fd);
- fd = -1; /* force open() again */
- }
- else {
- buf += rc;
- length -= rc;
- }
- } while (length > 0);
-
- close(fd);
-#elif defined(OS2)
- static UCHAR randbyte();
- unsigned int idx;
-
- for (idx=0; idx<length; idx++)
- buf[idx] = randbyte();
-
-#elif defined(HAVE_EGD)
+#if defined(HAVE_EGD)
/* use EGD-compatible socket daemon (such as EGD or PRNGd).
* message format:
* 0x00 (get entropy level)
@@ -224,6 +208,70 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf,
return bad_errno;
}
+#elif defined(SYS_RANDOM) && defined(USE_GETRANDOM)
+
+ do {
+ int rc;
+
+ rc = getrandom(buf, length, 0);
+ if (rc == -1) {
+ if (errno == EINTR) {
+ continue;
+ }
+ return errno;
+ }
+
+ buf += rc;
+ length -= rc;
+ } while (length > 0);
+
+#elif defined(SYS_RANDOM) && defined(HAVE_ARC4RANDOM_BUF)
+
+ arc4random_buf(buf, length);
+
+#elif defined(DEV_RANDOM)
+
+ int fd = -1;
+
+ /* On BSD/OS 4.1, /dev/random gives out 8 bytes at a time, then
+ * gives EOF, so reading 'length' bytes may require opening the
+ * device several times. */
+ do {
+ apr_ssize_t rc;
+
+ if (fd == -1)
+ if ((fd = open(DEV_RANDOM, O_RDONLY)) == -1)
+ return errno;
+
+ do {
+ rc = read(fd, buf, length);
+ } while (rc == -1 && errno == EINTR);
+
+ if (rc < 0) {
+ int errnum = errno;
+ close(fd);
+ return errnum;
+ }
+ else if (rc == 0) {
+ close(fd);
+ fd = -1; /* force open() again */
+ }
+ else {
+ buf += rc;
+ length -= rc;
+ }
+ } while (length > 0);
+
+ close(fd);
+
+#elif defined(OS2)
+
+ static UCHAR randbyte();
+ unsigned int idx;
+
+ for (idx=0; idx<length; idx++)
+ buf[idx] = randbyte();
+
#elif defined(HAVE_TRUERAND) /* use truerand */
extern int randbyte(void); /* from the truerand library */
@@ -235,6 +283,10 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf,
for (idx=0; idx<length; idx++)
buf[idx] = (unsigned char) randbyte();
+#else
+
+#error APR_HAS_RANDOM defined with no implementation
+
#endif /* DEV_RANDOM */
return APR_SUCCESS;
diff --git a/network_io/unix/sockaddr.c b/network_io/unix/sockaddr.c
index a375f72ece3b..581177997cb9 100644
--- a/network_io/unix/sockaddr.c
+++ b/network_io/unix/sockaddr.c
@@ -25,6 +25,14 @@
#include <stdlib.h>
#endif
+#ifdef HAVE_NET_IF_H
+#include <net/if.h>
+#endif
+
+#if defined(HAVE_IF_INDEXTONAME) && defined(_MSC_VER)
+#include "arch/win32/apr_arch_misc.h"
+#endif
+
#define APR_WANT_STRFUNC
#include "apr_want.h"
@@ -125,9 +133,31 @@ APR_DECLARE(apr_status_t) apr_sockaddr_ip_getbuf(char *buf, apr_size_t buflen,
memmove(buf, buf + strlen("::ffff:"),
strlen(buf + strlen("::ffff:"))+1);
}
-#endif
+
/* ensure NUL termination if the buffer is too short */
buf[buflen-1] = '\0';
+
+#ifdef HAVE_IF_INDEXTONAME
+ /* Append scope name for link-local addresses. */
+ if (sockaddr->family == AF_INET6
+ && IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)sockaddr->ipaddr_ptr)) {
+ char scbuf[IF_NAMESIZE], *p = buf + strlen(buf);
+
+ if (if_indextoname(sockaddr->sa.sin6.sin6_scope_id, scbuf) == scbuf) {
+ /* Space check, need room for buf + '%' + scope + '\0'.
+ * Assert: buflen >= strlen(buf) + strlen(scbuf) + 2
+ * Equiv: buflen >= (p-buf) + strlen(buf) + 2
+ * Thus, fail in inverse condition: */
+ if (buflen < strlen(scbuf) + (p - buf) + 2) {
+ return APR_ENOSPC;
+ }
+ *p++ = '%';
+ memcpy(p, scbuf, strlen(scbuf) + 1);
+ }
+ }
+#endif /* HAVE_IF_INDEXTONAME */
+#endif /* APR_HAVE_IPV6 */
+
return APR_SUCCESS;
}
@@ -900,11 +930,19 @@ APR_DECLARE(apr_status_t) apr_getservbyname(apr_sockaddr_t *sockaddr,
&((struct in6_addr *)(b)->ipaddr_ptr)->s6_addr[12], \
(a)->ipaddr_len))
+#if APR_HAVE_IPV6
+#define SCOPE_OR_ZERO(sa_) ((sa_)->family != AF_INET6 ? 0 : \
+ ((sa_)->sa.sin6.sin6_scope_id))
+#else
+#define SCOPE_OR_ZERO(sa_) (0)
+#endif
+
APR_DECLARE(int) apr_sockaddr_equal(const apr_sockaddr_t *addr1,
const apr_sockaddr_t *addr2)
{
- if (addr1->ipaddr_len == addr2->ipaddr_len &&
- !memcmp(addr1->ipaddr_ptr, addr2->ipaddr_ptr, addr1->ipaddr_len)) {
+ if (addr1->ipaddr_len == addr2->ipaddr_len
+ && !memcmp(addr1->ipaddr_ptr, addr2->ipaddr_ptr, addr1->ipaddr_len)
+ && SCOPE_OR_ZERO(addr1) == SCOPE_OR_ZERO(addr2)) {
return 1;
}
#if APR_HAVE_IPV6
@@ -1183,3 +1221,64 @@ APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa)
#endif /* APR_HAVE_IPV6 */
return 0; /* no match */
}
+
+APR_DECLARE(apr_status_t) apr_sockaddr_zone_set(apr_sockaddr_t *sa,
+ const char *zone_id)
+{
+#if !APR_HAVE_IPV6 || !defined(HAVE_IF_NAMETOINDEX)
+ return APR_ENOTIMPL;
+#else
+ unsigned int idx;
+
+ if (sa->family != APR_INET6
+ || !IN6_IS_ADDR_LINKLOCAL((struct in6_addr *)sa->ipaddr_ptr)) {
+ return APR_EBADIP;
+ }
+
+ idx = if_nametoindex(zone_id);
+ if (idx) {
+ sa->sa.sin6.sin6_scope_id = idx;
+ return APR_SUCCESS;
+ }
+
+ if (errno != ENODEV) {
+ return errno;
+ }
+ else {
+ char *endptr;
+ apr_int64_t i = apr_strtoi64(zone_id, &endptr, 10);
+
+ if (*endptr != '\0' || errno || i < 1 || i > APR_INT16_MAX) {
+ return APR_EGENERAL;
+ }
+
+ sa->sa.sin6.sin6_scope_id = (unsigned int) i;
+ return APR_SUCCESS;
+ }
+#endif
+}
+
+APR_DECLARE(apr_status_t) apr_sockaddr_zone_get(const apr_sockaddr_t *sa,
+ const char **name,
+ apr_uint32_t *id,
+ apr_pool_t *p)
+{
+#if !APR_HAVE_IPV6 || !defined(HAVE_IF_INDEXTONAME)
+ return APR_ENOTIMPL;
+#else
+ if (sa->family != APR_INET6 || !sa->sa.sin6.sin6_scope_id) {
+ return APR_EBADIP;
+ }
+
+ if (name) {
+ char *buf = apr_palloc(p, IF_NAMESIZE);
+ if (if_indextoname(sa->sa.sin6.sin6_scope_id, buf) == NULL)
+ return errno;
+ *name = buf;
+ }
+
+ if (id) *id = sa->sa.sin6.sin6_scope_id;
+
+ return APR_SUCCESS;
+#endif
+}
diff --git a/poll/unix/port.c b/poll/unix/port.c
index 94b6fa3978d5..c1e599412eca 100644
--- a/poll/unix/port.c
+++ b/poll/unix/port.c
@@ -356,7 +356,7 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset,
apr_os_sock_t fd;
int ret;
unsigned int nget, i;
- apr_int32_t nres = 0;
+ apr_int32_t j;
pfd_elem_t *ep;
apr_status_t rv = APR_SUCCESS;
@@ -406,7 +406,7 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset,
pollset_lock_rings();
- for (i = 0; i < nget; i++) {
+ for (i = 0, j = 0; i < nget; i++) {
ep = (pfd_elem_t *)pollset->p->port_set[i].portev_user;
if ((pollset->flags & APR_POLLSET_WAKEABLE) &&
ep->pfd.desc_type == APR_POLL_FILE &&
@@ -415,10 +415,10 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset,
rv = APR_EINTR;
}
else {
- pollset->p->result_set[nres] = ep->pfd;
- pollset->p->result_set[nres].rtnevents =
+ pollset->p->result_set[j] = ep->pfd;
+ pollset->p->result_set[j].rtnevents =
get_revent(pollset->p->port_set[i].portev_events);
- ++nres;
+ j++;
}
/* If the ring element is still on the query ring, move it
* to the add ring for re-association with the event port
@@ -432,8 +432,7 @@ static apr_status_t impl_pollset_poll(apr_pollset_t *pollset,
pfd_elem_t, link);
}
}
- if (nres > 0) { /* any event besides wakeup pipe? */
- *num = nres;
+ if ((*num = j)) { /* any event besides wakeup pipe? */
rv = APR_SUCCESS;
if (descriptors) {
*descriptors = pollset->p->result_set;
diff --git a/strings/apr_snprintf.c b/strings/apr_snprintf.c
index 5b1482c25b90..4acbe2fa5b09 100644
--- a/strings/apr_snprintf.c
+++ b/strings/apr_snprintf.c
@@ -100,7 +100,6 @@ static char *apr_cvt(double arg, int ndigits, int *decpt, int *sign,
arg = -arg;
}
arg = modf(arg, &fi);
- p1 = &buf[NDIG];
/*
* Do integer part
*/
diff --git a/threadproc/unix/signals.c b/threadproc/unix/signals.c
index 57a31af97ac6..c735eaba0e9a 100644
--- a/threadproc/unix/signals.c
+++ b/threadproc/unix/signals.c
@@ -307,13 +307,7 @@ static void remove_sync_sigs(sigset_t *sig_mask)
/* the rest of the signals removed from the mask in this function
* absolutely must be removed; you cannot block synchronous signals
* (requirement of pthreads API)
- *
- * SIGUSR2 is being removed from the mask for the convenience of
- * Purify users (Solaris, HP-UX, SGI) since Purify uses SIGUSR2
*/
-#ifdef SIGUSR2
- sigdelset(sig_mask, SIGUSR2);
-#endif
}
APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum))
diff --git a/time/unix/time.c b/time/unix/time.c
index 7f0958192769..dfa45e690c62 100644
--- a/time/unix/time.c
+++ b/time/unix/time.c
@@ -142,9 +142,6 @@ APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *t, apr_time_exp_t *xt)
static const int dayoffset[12] =
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
- if (xt->tm_mon < 0 || xt->tm_mon >= 12)
- return APR_EBADDATE;
-
/* shift new year to 1st March in order to make leap year calc easy */
if (xt->tm_mon < 2)