--- /dev/null
+diff -urN apr-0.9.4.org/build/make_exports.awk apr/build/make_exports.awk
+--- apr-0.9.4.org/build/make_exports.awk 2003-11-14 15:29:26.000000000 +0100
++++ apr/build/make_exports.awk 2003-09-26 09:25:59.000000000 +0200
+@@ -76,8 +76,8 @@
+ }
+ }
+
+-/^[ \t]*AP[RU]?_(CORE_)?DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
+- sub("[ \t]*AP[RU]?_(CORE_)?DECLARE[^(]*[(][^)]*[)][ \t]*", "")
++/^[ \t]*AP[RUI]?_(CORE_)?DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
++ sub("[ \t]*AP[RUI]?_(CORE_)?DECLARE[^(]*[(][^)]*[)][ \t]*", "")
+ sub("[(].*", "")
+ sub("([^ ]* (^([ \t]*[(])))+", "")
+
+diff -urN apr-0.9.4.org/build/make_nw_export.awk apr/build/make_nw_export.awk
+--- apr-0.9.4.org/build/make_nw_export.awk 2003-11-14 15:29:26.000000000 +0100
++++ apr/build/make_nw_export.awk 2003-09-26 09:25:59.000000000 +0200
+@@ -23,8 +23,8 @@
+ }
+ }
+
+-/^[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
+- sub("[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)][ \t]*", "")
++/^[ \t]*AP[RUI]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
++ sub("[ \t]*AP[RUI]?_DECLARE[^(]*[(][^)]*[)][ \t]*", "")
+ sub("[(].*", "")
+ sub("([^ ]* (^([ \t]*[(])))+", "")
+
+@@ -65,7 +65,7 @@
+ next
+ }
+
+-/^[ \t]*AP[RU]?_DECLARE_DATA .*;$/ {
++/^[ \t]*AP[RUI]?_DECLARE_DATA .*;$/ {
+ varname = $NF;
+ gsub( /[*;]/, "", varname);
+ gsub( /\[.*\]/, "", varname);
+diff -urN apr-0.9.4.org/build/make_var_export.awk apr/build/make_var_export.awk
+--- apr-0.9.4.org/build/make_var_export.awk 2003-11-14 15:29:26.000000000 +0100
++++ apr/build/make_var_export.awk 2003-09-26 09:25:59.000000000 +0200
+@@ -1,7 +1,7 @@
+ # Based on apr's make_export.awk, which is
+ # based on Ryan Bloom's make_export.pl
+
+-/^#[ \t]*if(def)? (AP[RU]?_|!?defined).*/ {
++/^#[ \t]*if(def)? (AP[RUI]?_|!?defined).*/ {
+ if (old_filename != FILENAME) {
+ if (old_filename != "") printf("%s", line)
+ macro_no = 0
+@@ -47,7 +47,7 @@
+ }
+ }
+
+-/^[ \t]*(extern[ \t]+)?AP[RU]?_DECLARE_DATA .*;$/ {
++/^[ \t]*(extern[ \t]+)?AP[RUI]?_DECLARE_DATA .*;$/ {
+ varname = $NF;
+ gsub( /[*;]/, "", varname);
+ gsub( /\[.*\]/, "", varname);
+diff -urN apr-0.9.4.org/CHANGES apr/CHANGES
+--- apr-0.9.4.org/CHANGES 2003-11-14 15:29:26.000000000 +0100
++++ apr/CHANGES 2003-10-24 18:35:15.000000000 +0200
+@@ -1,3 +1,10 @@
++Changes with APR 0.9.5
++
++ *) Add apr_os_pipe_put_ex(), which allows the caller to tell APR
++ to establish a cleanup on the pipe. [Jeff Trawick, Brad Nicholes]
++
++ *) Fix make_exports.awk to work with apr-iconv. [Justin Erenkrantz]
++
+ Changes with APR 0.9.4
+
+ *) win32: fix apr_file_dup() and apr_file_dup2() to dup the
+diff -urN apr-0.9.4.org/configure.in apr/configure.in
+--- apr-0.9.4.org/configure.in 2003-11-14 15:29:26.000000000 +0100
++++ apr/configure.in 2003-10-17 00:13:01.000000000 +0200
+@@ -938,6 +938,7 @@
+ netinet/sctp.h \
+ netinet/sctp_uio.h \
+ sys/file.h \
++ sys/ioctl.h \
+ sys/mman.h \
+ sys/poll.h \
+ sys/resource.h \
+@@ -946,6 +947,7 @@
+ sys/sendfile.h \
+ sys/signal.h \
+ sys/socket.h \
++ sys/sockio.h \
+ sys/stat.h \
+ sys/sysctl.h \
+ sys/syslimits.h \
+@@ -992,9 +994,11 @@
+ AC_SUBST(stdlibh)
+ AC_SUBST(stringh)
+ AC_SUBST(stringsh)
++AC_SUBST(sys_ioctlh)
+ AC_SUBST(sys_sendfileh)
+ AC_SUBST(sys_signalh)
+ AC_SUBST(sys_socketh)
++AC_SUBST(sys_sockioh)
+ AC_SUBST(sys_typesh)
+ AC_SUBST(sys_timeh)
+ AC_SUBST(sys_uioh)
+diff -urN apr-0.9.4.org/file_io/netware/pipe.c apr/file_io/netware/pipe.c
+--- apr-0.9.4.org/file_io/netware/pipe.c 2003-11-14 15:29:26.000000000 +0100
++++ apr/file_io/netware/pipe.c 2003-10-24 18:35:15.000000000 +0200
+@@ -136,9 +136,10 @@
+ return APR_EINVAL;
+ }
+
+-APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
+- apr_os_file_t *thefile,
+- apr_pool_t *pool)
++APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
++ apr_os_file_t *thefile,
++ int register_cleanup,
++ apr_pool_t *pool)
+ {
+ int *dafile = thefile;
+
+@@ -150,14 +151,28 @@
+ (*file)->timeout = -1;
+ (*file)->ungetchar = -1; /* no char avail */
+ (*file)->filedes = *dafile;
+- (*file)->flags = APR_FILE_NOCLEANUP;
++ if (!register_cleanup) {
++ (*file)->flags = APR_FILE_NOCLEANUP;
++ }
+ (*file)->buffered = 0;
+ #if APR_HAS_THREADS
+ (*file)->thlock = NULL;
+ #endif
++ if (register_cleanup) {
++ apr_pool_cleanup_register((*file)->pool, (void *)(*file),
++ apr_unix_file_cleanup,
++ apr_pool_cleanup_null);
++ }
+ return APR_SUCCESS;
+ }
+
++APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
++ apr_os_file_t *thefile,
++ apr_pool_t *pool)
++{
++ return apr_os_pipe_put_ex(file, thefile, 0, pool);
++}
++
+ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t *pool)
+ {
+ int filedes[2];
+diff -urN apr-0.9.4.org/file_io/os2/pipe.c apr/file_io/os2/pipe.c
+--- apr-0.9.4.org/file_io/os2/pipe.c 2003-11-14 15:29:26.000000000 +0100
++++ apr/file_io/os2/pipe.c 2003-10-24 18:35:15.000000000 +0200
+@@ -184,9 +184,10 @@
+
+
+
+-APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
+- apr_os_file_t *thefile,
+- apr_pool_t *pool)
++APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
++ apr_os_file_t *thefile,
++ int register_cleanup,
++ apr_pool_t *pool)
+ {
+ (*file) = apr_pcalloc(pool, sizeof(apr_file_t));
+ (*file)->pool = pool;
+@@ -196,5 +197,19 @@
+ (*file)->timeout = -1;
+ (*file)->filedes = *thefile;
+
++ if (register_cleanup) {
++ apr_pool_cleanup_register(pool, *file, apr_file_cleanup,
++ apr_pool_cleanup_null);
++ }
++
+ return APR_SUCCESS;
+ }
++
++
++
++APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
++ apr_os_file_t *thefile,
++ apr_pool_t *pool)
++{
++ return apr_os_pipe_put_ex(file, thefile, 0, pool);
++}
+diff -urN apr-0.9.4.org/file_io/unix/pipe.c apr/file_io/unix/pipe.c
+--- apr-0.9.4.org/file_io/unix/pipe.c 2003-11-14 15:29:26.000000000 +0100
++++ apr/file_io/unix/pipe.c 2003-10-24 18:35:16.000000000 +0200
+@@ -171,9 +171,10 @@
+ return APR_EINVAL;
+ }
+
+-APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
+- apr_os_file_t *thefile,
+- apr_pool_t *pool)
++APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
++ apr_os_file_t *thefile,
++ int register_cleanup,
++ apr_pool_t *pool)
+ {
+ int *dafile = thefile;
+
+@@ -185,14 +186,28 @@
+ (*file)->timeout = -1;
+ (*file)->ungetchar = -1; /* no char avail */
+ (*file)->filedes = *dafile;
+- (*file)->flags = APR_FILE_NOCLEANUP;
++ if (!register_cleanup) {
++ (*file)->flags = APR_FILE_NOCLEANUP;
++ }
+ (*file)->buffered = 0;
+ #if APR_HAS_THREADS
+ (*file)->thlock = NULL;
+ #endif
++ if (register_cleanup) {
++ apr_pool_cleanup_register((*file)->pool, (void *)(*file),
++ apr_unix_file_cleanup,
++ apr_pool_cleanup_null);
++ }
+ return APR_SUCCESS;
+ }
+
++APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file,
++ apr_os_file_t *thefile,
++ apr_pool_t *pool)
++{
++ return apr_os_pipe_put_ex(file, thefile, 0, pool);
++}
++
+ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t *pool)
+ {
+ int filedes[2];
+diff -urN apr-0.9.4.org/include/apr.h.in apr/include/apr.h.in
+--- apr-0.9.4.org/include/apr.h.in 2003-11-14 15:29:26.000000000 +0100
++++ apr/include/apr.h.in 2003-10-17 00:13:02.000000000 +0200
+@@ -127,9 +127,11 @@
+ #define APR_HAVE_STDLIB_H @stdlibh@
+ #define APR_HAVE_STRING_H @stringh@
+ #define APR_HAVE_STRINGS_H @stringsh@
++#define APR_HAVE_SYS_IOCTL_H @sys_ioctlh@
+ #define APR_HAVE_SYS_SENDFILE_H @sys_sendfileh@
+ #define APR_HAVE_SYS_SIGNAL_H @sys_signalh@
+ #define APR_HAVE_SYS_SOCKET_H @sys_socketh@
++#define APR_HAVE_SYS_SOCKIO_H @sys_sockioh@
+ #define APR_HAVE_SYS_SYSLIMITS_H @sys_syslimitsh@
+ #define APR_HAVE_SYS_TIME_H @sys_timeh@
+ #define APR_HAVE_SYS_TYPES_H @sys_typesh@
+diff -urN apr-0.9.4.org/include/apr.hnw apr/include/apr.hnw
+--- apr-0.9.4.org/include/apr.hnw 2003-11-14 15:29:26.000000000 +0100
++++ apr/include/apr.hnw 2003-10-17 00:13:02.000000000 +0200
+@@ -143,6 +143,7 @@
+ #define APR_HAVE_SYS_SENDFILE_H 0
+ #define APR_HAVE_SYS_SIGNAL_H 0
+ #define APR_HAVE_SYS_SOCKET_H 0
++#define APR_HAVE_SYS_SOCKIO_H 0
+ #define APR_HAVE_SYS_SYSLIMITS_H 0
+ #define APR_HAVE_SYS_TIME_H 0
+ #define APR_HAVE_SYS_TYPES_H 1
+diff -urN apr-0.9.4.org/include/apr.hw apr/include/apr.hw
+--- apr-0.9.4.org/include/apr.hw 2003-11-14 15:29:26.000000000 +0100
++++ apr/include/apr.hw 2003-10-17 00:13:02.000000000 +0200
+@@ -171,6 +171,7 @@
+ #define APR_HAVE_SYS_SENDFILE_H 0
+ #define APR_HAVE_SYS_SIGNAL_H 0
+ #define APR_HAVE_SYS_SOCKET_H 0
++#define APR_HAVE_SYS_SOCKIO_H 0
+ #define APR_HAVE_SYS_SYSLIMITS_H 0
+ #define APR_HAVE_SYS_TIME_H 0
+ #define APR_HAVE_SYS_TYPES_H 1
+diff -urN apr-0.9.4.org/include/apr_network_io.h apr/include/apr_network_io.h
+--- apr-0.9.4.org/include/apr_network_io.h 2003-11-14 15:29:26.000000000 +0100
++++ apr/include/apr_network_io.h 2003-10-17 00:13:02.000000000 +0200
+@@ -721,6 +721,15 @@
+ apr_interval_time_t *t);
+
+ /**
++ * Query the specified socket if at the OOB/Urgent data mark
++ * @param sock The socket to query
++ * @param atmark Is set to true if socket is at the OOB/urgent mark,
++ * otherwise is set to false.
++ */
++APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock,
++ int *atmark);
++
++/**
+ * Return an apr_sockaddr_t from an apr_socket_t
+ * @param sa The returned apr_sockaddr_t.
+ * @param which Which interface do we want the apr_sockaddr_t for?
+diff -urN apr-0.9.4.org/include/apr_pools.h apr/include/apr_pools.h
+--- apr-0.9.4.org/include/apr_pools.h 2003-11-14 15:29:26.000000000 +0100
++++ apr/include/apr_pools.h 2003-09-26 21:12:32.000000000 +0200
+@@ -481,10 +481,12 @@
+ *
+ * Users of APR must take EXTREME care when choosing a key to
+ * use for their data. It is possible to accidentally overwrite
+- * data by choosing a key that another part of the program is using
+- * It is advised that steps are taken to ensure that a unique
+- * key is used at all times.
+- * @bug Specify how to ensure this uniqueness!
++ * data by choosing a key that another part of the program is using.
++ * Therefore it is advised that steps are taken to ensure that unique
++ * keys are used for all of the userdata objects in a particular pool
++ * (the same key in two different pools or a pool and one of its
++ * subpools is okay) at all times. Careful namespace prefixing of
++ * key names is a typical way to help ensure this uniqueness.
+ */
+ APR_DECLARE(apr_status_t) apr_pool_userdata_set(
+ const void *data,
+diff -urN apr-0.9.4.org/include/apr_portable.h apr/include/apr_portable.h
+--- apr-0.9.4.org/include/apr_portable.h 2003-11-14 15:29:26.000000000 +0100
++++ apr/include/apr_portable.h 2003-10-24 18:35:16.000000000 +0200
+@@ -391,6 +391,21 @@
+ apr_pool_t *cont);
+
+ /**
++ * convert the file from os specific type to apr type.
++ * @param file The apr file we are converting to.
++ * @param thefile The os specific pipe to convert
++ * @param register_cleanup A cleanup will be registered on the apr_file_t
++ * to issue apr_file_close().
++ * @param cont The pool to use if it is needed.
++ * @remark On Unix, it is only possible to put a file descriptor into
++ * an apr file type.
++ */
++APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file,
++ apr_os_file_t *thefile,
++ int register_cleanup,
++ apr_pool_t *cont);
++
++/**
+ * convert the dir from os specific type to apr type.
+ * @param dir The apr dir we are converting to.
+ * @param thedir The os specific dir to convert
+diff -urN apr-0.9.4.org/include/apr_version.h apr/include/apr_version.h
+--- apr-0.9.4.org/include/apr_version.h 2003-11-14 15:29:26.000000000 +0100
++++ apr/include/apr_version.h 2003-09-26 07:27:22.000000000 +0200
+@@ -99,14 +99,14 @@
+ #define APR_MINOR_VERSION 9
+
+ /** patch level */
+-#define APR_PATCH_VERSION 4
++#define APR_PATCH_VERSION 5
+
+
+ /**
+ * This symbol is defined for internal, "development" copies of APR. This
+ * symbol will be #undef'd for releases.
+ */
+-/* #undef APR_IS_DEV_VERSION */
++#define APR_IS_DEV_VERSION
+
+ /** The formatted string of APR's version */
+ #define APR_VERSION_STRING \
+diff -urN apr-0.9.4.org/include/arch/netware/apr_arch_file_io.h apr/include/arch/netware/apr_arch_file_io.h
+--- apr-0.9.4.org/include/arch/netware/apr_arch_file_io.h 2003-11-14 15:29:26.000000000 +0100
++++ apr/include/arch/netware/apr_arch_file_io.h 2003-10-02 16:49:33.000000000 +0200
+@@ -147,8 +147,6 @@
+ NXPathCtx_t pathCtx;
+ };
+
+-extern apr_int32_t CpuCurrentProcessor; /* system variable */
+-
+ #define MAX_SERVER_NAME 64
+ #define MAX_VOLUME_NAME 64
+ #define MAX_PATH_NAME 256
+diff -urN apr-0.9.4.org/include/arch/unix/apr_arch_networkio.h apr/include/arch/unix/apr_arch_networkio.h
+--- apr-0.9.4.org/include/arch/unix/apr_arch_networkio.h 2003-11-14 15:29:26.000000000 +0100
++++ apr/include/arch/unix/apr_arch_networkio.h 2003-10-17 00:13:02.000000000 +0200
+@@ -102,6 +102,9 @@
+ #if APR_HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
++#if APR_HAVE_SYS_SOCKIO_H
++#include <sys/sockio.h>
++#endif
+ #if APR_HAVE_NETDB_H
+ #include <netdb.h>
+ #endif
+@@ -111,6 +114,9 @@
+ #if APR_HAVE_SYS_SENDFILE_H
+ #include <sys/sendfile.h>
+ #endif
++#if APR_HAVE_SYS_IOCTL_H
++#include <sys/ioctl.h>
++#endif
+ /* End System Headers */
+
+ #ifndef HAVE_POLLIN
+diff -urN apr-0.9.4.org/include/arch/unix/apr_private.h.in apr/include/arch/unix/apr_private.h.in
+--- apr-0.9.4.org/include/arch/unix/apr_private.h.in 2003-11-14 15:29:26.000000000 +0100
++++ apr/include/arch/unix/apr_private.h.in 2003-10-24 19:50:58.000000000 +0200
+@@ -100,10 +100,6 @@
+ /* 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_siglist', and to 0 if you
+- don't. */
+-#undef HAVE_DECL_SYS_SIGLIST
+-
+ /* Define to 1 if you have the <dirent.h> header file. */
+ #undef HAVE_DIRENT_H
+
+@@ -461,6 +457,9 @@
+ /* Define to 1 if you have the <sys/file.h> header file. */
+ #undef HAVE_SYS_FILE_H
+
++/* Define to 1 if you have the <sys/ioctl.h> header file. */
++#undef HAVE_SYS_IOCTL_H
++
+ /* Define to 1 if you have the <sys/ipc.h> header file. */
+ #undef HAVE_SYS_IPC_H
+
+@@ -494,6 +493,9 @@
+ /* Define to 1 if you have the <sys/socket.h> header file. */
+ #undef HAVE_SYS_SOCKET_H
+
++/* Define to 1 if you have the <sys/sockio.h> header file. */
++#undef HAVE_SYS_SOCKIO_H
++
+ /* Define to 1 if you have the <sys/stat.h> header file. */
+ #undef HAVE_SYS_STAT_H
+
+@@ -644,6 +646,9 @@
+ /* Define if SysV semaphores affect threads within the process */
+ #undef SYSVSEM_IS_GLOBAL
+
++/* Define to 1 if `sys_siglist' is declared by <signal.h> or <unistd.h>. */
++#undef SYS_SIGLIST_DECLARED
++
+ /* Define if APR supports threads */
+ #undef USE_THREADS
+
+diff -urN apr-0.9.4.org/memory/unix/apr_pools.c apr/memory/unix/apr_pools.c
+--- apr-0.9.4.org/memory/unix/apr_pools.c 2003-11-14 15:29:26.000000000 +0100
++++ apr/memory/unix/apr_pools.c 2003-09-28 19:14:21.000000000 +0200
+@@ -55,6 +55,7 @@
+ #include "apr.h"
+ #include "apr_private.h"
+
++#include "apr_atomic.h"
+ #include "apr_portable.h" /* for get_os_proc */
+ #include "apr_strings.h"
+ #include "apr_general.h"
+@@ -555,6 +556,13 @@
+
+ apr_pool_tag(global_pool, "apr_global_pool");
+
++ /* This has to happen here because mutexes might be backed by
++ * atomics. It used to be snug and safe in apr_initialize().
++ */
++ if ((rv = apr_atomic_init(global_pool)) != APR_SUCCESS) {
++ return rv;
++ }
++
+ #if APR_HAS_THREADS
+ {
+ apr_thread_mutex_t *mutex;
+@@ -1266,6 +1274,13 @@
+
+ apr_pools_initialized = 1;
+
++ /* This has to happen here because mutexes might be backed by
++ * atomics. It used to be snug and safe in apr_initialize().
++ */
++ if ((rv = apr_atomic_init(global_pool)) != APR_SUCCESS) {
++ return rv;
++ }
++
+ #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
+ apr_file_open_stderr(&file_stderr, global_pool);
+ if (file_stderr) {
+diff -urN apr-0.9.4.org/misc/netware/aprlib.def apr/misc/netware/aprlib.def
+--- apr-0.9.4.org/misc/netware/aprlib.def 2003-11-14 15:29:26.000000000 +0100
++++ apr/misc/netware/aprlib.def 2003-10-02 16:49:33.000000000 +0200
+@@ -1,4 +1,3 @@
+ MODULE LIBC.NLM
+ MODULE WS2_32.NLM
+-IMPORT CpuCurrentProcessor
+ EXPORT @aprlib.imp
+diff -urN apr-0.9.4.org/misc/unix/start.c apr/misc/unix/start.c
+--- apr-0.9.4.org/misc/unix/start.c 2003-11-14 15:29:26.000000000 +0100
++++ apr/misc/unix/start.c 2003-09-28 01:58:23.000000000 +0200
+@@ -99,9 +99,12 @@
+
+ apr_pool_tag(pool, "apr_initialize");
+
+- if ((status = apr_atomic_init(pool)) != APR_SUCCESS) {
+- return status;
+- }
++ /* apr_atomic_init() used to be called from here aswell.
++ * Pools rely on mutexes though, which can be backed by
++ * atomics. Due to this circular dependency
++ * apr_pool_initialize() is taking care of calling
++ * apr_atomic_init() at the correct time.
++ */
+
+ apr_signal_init(pool);
+
+diff -urN apr-0.9.4.org/network_io/os2/sockopt.c apr/network_io/os2/sockopt.c
+--- apr-0.9.4.org/network_io/os2/sockopt.c 2003-11-14 15:29:26.000000000 +0100
++++ apr/network_io/os2/sockopt.c 2003-10-17 00:13:02.000000000 +0200
+@@ -170,6 +170,20 @@
+ }
+
+
++APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, int *atmark)
++{
++ int oobmark;
++
++ if (ioctl(sock->socketdes, SIOCATMARK, (void*)&oobmark, sizeof(oobmark)) < 0) {
++ return APR_OS2_STATUS(sock_errno());
++ }
++
++ *atmark = (oobmark != 0);
++
++ return APR_SUCCESS;
++}
++
++
+ APR_DECLARE(apr_status_t) apr_gethostname(char *buf, apr_int32_t len,
+ apr_pool_t *cont)
+ {
+diff -urN apr-0.9.4.org/network_io/unix/sockaddr.c apr/network_io/unix/sockaddr.c
+--- apr-0.9.4.org/network_io/unix/sockaddr.c 2003-11-14 15:29:26.000000000 +0100
++++ apr/network_io/unix/sockaddr.c 2003-09-29 21:08:15.000000000 +0200
+@@ -374,14 +374,6 @@
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = family;
+ hints.ai_socktype = SOCK_STREAM;
+-#ifdef AI_ADDRCONFIG
+- if (family == AF_UNSPEC) {
+- /* By default, only look up addresses using address types for
+- * which a local interface is configured, i.e. no IPv6 if no
+- * IPv6 interfaces configured. */
+- hints.ai_flags = AI_ADDRCONFIG;
+- }
+-#endif
+ if(hostname == NULL) {
+ #ifdef AI_PASSIVE
+ /* If hostname is NULL, assume we are trying to bind to all
+@@ -404,13 +396,6 @@
+ servname = apr_itoa(p, port);
+ }
+ error = getaddrinfo(hostname, servname, &hints, &ai_list);
+-#ifdef AI_ADDRCONFIG
+- if (error == EAI_BADFLAGS && family == AF_UNSPEC) {
+- /* Retry with no flags if AI_ADDRCONFIG was rejected. */
+- hints.ai_flags = 0;
+- error = getaddrinfo(hostname, servname, &hints, &ai_list);
+- }
+-#endif
+ if (error) {
+ #ifndef WIN32
+ if (error == EAI_SYSTEM) {
+diff -urN apr-0.9.4.org/network_io/unix/sockopt.c apr/network_io/unix/sockopt.c
+--- apr-0.9.4.org/network_io/unix/sockopt.c 2003-11-14 15:29:26.000000000 +0100
++++ apr/network_io/unix/sockopt.c 2003-10-17 00:13:02.000000000 +0200
+@@ -55,6 +55,7 @@
+ #include "apr_arch_networkio.h"
+ #include "apr_strings.h"
+
++
+ static apr_status_t soblock(int sd)
+ {
+ /* BeOS uses setsockopt at present for non blocking... */
+@@ -369,6 +370,27 @@
+ }
+
+
++apr_status_t apr_socket_atmark(apr_socket_t *sock, int *atmark)
++{
++/* In 1.0 we rely on compile failure to assure all platforms grabbed
++ * the correct header file support for SIOCATMARK, but we don't want
++ * to fail the build of 0.9. Keep things good for the released branch.
++ */
++#ifdef SIOCATMARK
++ int oobmark;
++
++ if (ioctl(sock->socketdes, SIOCATMARK, (void*) &oobmark) < 0)
++ return apr_get_netos_error();
++
++ *atmark = (oobmark != 0);
++
++ return APR_SUCCESS;
++#else
++ return APR_ENOTIMPL;
++#endif
++}
++
++
+ /* deprecated */
+ apr_status_t apr_setsocketopt(apr_socket_t *sock,
+ apr_int32_t opt, apr_int32_t on)
+diff -urN apr-0.9.4.org/network_io/win32/sockopt.c apr/network_io/win32/sockopt.c
+--- apr-0.9.4.org/network_io/win32/sockopt.c 2003-11-14 15:29:26.000000000 +0100
++++ apr/network_io/win32/sockopt.c 2003-10-17 00:13:03.000000000 +0200
+@@ -276,6 +276,19 @@
+ }
+
+
++APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, int *atmark)
++{
++ u_long oobmark;
++
++ if (ioctlsocket(sock->socketdes, SIOCATMARK, (void*) &oobmark) < 0)
++ return apr_get_netos_error();
++
++ *atmark = (oobmark != 0);
++
++ return APR_SUCCESS;
++}
++
++
+ APR_DECLARE(apr_status_t) apr_gethostname(char *buf, int len,
+ apr_pool_t *cont)
+ {
+diff -urN apr-0.9.4.org/NWGNUmakefile apr/NWGNUmakefile
+--- apr-0.9.4.org/NWGNUmakefile 2003-11-14 15:29:26.000000000 +0100
++++ apr/NWGNUmakefile 2003-10-02 16:49:33.000000000 +0200
+@@ -221,7 +221,6 @@
+ @libc.imp \
+ @ws2nlm.imp \
+ @netware.imp \
+- CpuCurrentProcessor \
+ $(EOLIST)
+
+ #
+