diff options
author | (no author) <(no author)@13f79535-47bb-0310-9956-ffa450edef68> | 2003-10-24 16:35:16 +0000 |
---|---|---|
committer | (no author) <(no author)@13f79535-47bb-0310-9956-ffa450edef68> | 2003-10-24 16:35:16 +0000 |
commit | f036b50745e285a1932315b4110e271603274cca (patch) | |
tree | b326003d12843fe25d1feec83a067bfc3a034b02 | |
parent | 149a9f0623d2fd48146fa8868b69c0f633c82fbd (diff) | |
download | libapr-APACHE_2_0_48.tar.gz |
This commit was manufactured by cvs2svn to create tagAPACHE_2_0_48
'APACHE_2_0_48'.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/tags/APACHE_2_0_48@64694 13f79535-47bb-0310-9956-ffa450edef68
33 files changed, 238 insertions, 320 deletions
@@ -1,11 +1,25 @@ +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 + ungetchar member [Stas Bekman] + + *) Preserve leading '../' segments as when merging to an empty and + unrooted path - fixes a bug observed in SVN with Win32/Netware/OS2. + [Mike Pilato <cmpilato@collab.net>, William Rowe] + *) Work around a bug in Darwin when calling getnameinfo() on IPv4-mapped IPv6-addresses. [Colm MacCárthaigh <colm@stdlib.net>, Jeff Trawick, Justin Erenkrantz] *) Add apr_temp_dir_get() for getting the most suitable temp directory - [CMike Pilato <cmpilato@collab.net>, Thom May] + [Mike Pilato <cmpilato@collab.net>, Thom May] *) Modify apr_sockaddr_info_get to call the resolver when we do not have a hostname. Also, fix bugs in the getaddrinfo() @@ -1399,7 +1413,7 @@ Changes with APR 0.9.0 [Mike Pilato <cmpilato@collab.net>] *) Add apr_open_stdout. This mirrors apr_open_stderr, except it works - on stdout. [cmpilato@collab.net] + on stdout. [Mike Pilato <cmpilato@collab.net>] *) Fix bug in file_io/unix/dir.c. There is no such thing as a dirent, it must be a struct dirent. diff --git a/NWGNUmakefile b/NWGNUmakefile index 3f1083a03..8e7ac9ae1 100644 --- a/NWGNUmakefile +++ b/NWGNUmakefile @@ -221,7 +221,6 @@ FILES_nlm_Ximports = \ @libc.imp \ @ws2nlm.imp \ @netware.imp \ - CpuCurrentProcessor \ $(EOLIST) # diff --git a/build/PrintPath b/build/PrintPath index 68435f374..c5b5dff7e 100755 --- a/build/PrintPath +++ b/build/PrintPath @@ -45,7 +45,7 @@ done # # First of all, all OS/2 programs have the '.exe' extension. # Next, we adjust PATH (or what was given to us as PATH) to -# be whitespace seperated directories. +# be whitespace separated directories. # Finally, we try to determine the best flag to use for # test/[] to look for an executable file. OS/2 just has '-r' # but with other OSs, we do some funny stuff to check to see diff --git a/build/make_exports.awk b/build/make_exports.awk index eefc1a945..1d12fc65a 100644 --- a/build/make_exports.awk +++ b/build/make_exports.awk @@ -76,8 +76,8 @@ function add_symbol(symbol) { } } -/^[ \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 --git a/build/make_nw_export.awk b/build/make_nw_export.awk index e0f273b0f..291ecc0b2 100644 --- a/build/make_nw_export.awk +++ b/build/make_nw_export.awk @@ -23,8 +23,8 @@ function add_symbol (sym_name) { } } -/^[ \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 @@ function add_symbol (sym_name) { next } -/^[ \t]*AP[RU]?_DECLARE_DATA .*;$/ { +/^[ \t]*AP[RUI]?_DECLARE_DATA .*;$/ { varname = $NF; gsub( /[*;]/, "", varname); gsub( /\[.*\]/, "", varname); diff --git a/build/make_var_export.awk b/build/make_var_export.awk index 1d6f76d8f..59922758d 100644 --- a/build/make_var_export.awk +++ b/build/make_var_export.awk @@ -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 @@ function add_symbol (sym_name) { } } -/^[ \t]*(extern[ \t]+)?AP[RU]?_DECLARE_DATA .*;$/ { +/^[ \t]*(extern[ \t]+)?AP[RUI]?_DECLARE_DATA .*;$/ { varname = $NF; gsub( /[*;]/, "", varname); gsub( /\[.*\]/, "", varname); diff --git a/configure.in b/configure.in index a5075ece6..273feaffa 100644 --- a/configure.in +++ b/configure.in @@ -938,6 +938,7 @@ APR_FLAG_HEADERS( 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 @@ APR_FLAG_HEADERS( 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(stdioh) 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 --git a/file_io/netware/pipe.c b/file_io/netware/pipe.c index 890308530..8f3940836 100644 --- a/file_io/netware/pipe.c +++ b/file_io/netware/pipe.c @@ -136,9 +136,10 @@ APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_int 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 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file, (*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 --git a/file_io/os2/pipe.c b/file_io/os2/pipe.c index ebd0d4cb4..decf88b45 100644 --- a/file_io/os2/pipe.c +++ b/file_io/os2/pipe.c @@ -184,9 +184,10 @@ APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_int -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 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file, (*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 --git a/file_io/unix/pipe.c b/file_io/unix/pipe.c index 1ee25660c..41b6cfc4b 100644 --- a/file_io/unix/pipe.c +++ b/file_io/unix/pipe.c @@ -171,9 +171,10 @@ APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_int 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 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file, (*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 --git a/file_io/win32/filedup.c b/file_io/win32/filedup.c index e2c37034f..f676daea2 100644 --- a/file_io/win32/filedup.c +++ b/file_io/win32/filedup.c @@ -81,6 +81,7 @@ APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, (*new_file)->fname = apr_pstrdup(p, old_file->fname); (*new_file)->append = old_file->append; (*new_file)->buffered = FALSE; + (*new_file)->ungetchar = old_file->ungetchar; apr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file), file_cleanup, apr_pool_cleanup_null); @@ -150,6 +151,7 @@ APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, new_file->fname = apr_pstrdup(new_file->pool, old_file->fname); new_file->append = old_file->append; new_file->buffered = FALSE; + new_file->ungetchar = old_file->ungetchar; return APR_SUCCESS; #endif /* !defined(_WIN32_WCE) */ diff --git a/file_io/win32/filepath.c b/file_io/win32/filepath.c index e72504ece..3f8389ea7 100644 --- a/file_io/win32/filepath.c +++ b/file_io/win32/filepath.c @@ -706,8 +706,8 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, return APR_EBADPATH; #endif - /* backpath (../) */ - if (pathlen <= rootlen) + /* backpath (../) when an absolute path is given */ + if (rootlen && (pathlen <= rootlen)) { /* Attempt to move above root. Always die if the * APR_FILEPATH_SECUREROOTTEST flag is specified. @@ -736,9 +736,14 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, */ if (pathlen + 3 >= sizeof(path)) return APR_ENAMETOOLONG; - memcpy(path + pathlen, ((flags && APR_FILEPATH_NATIVE) + memcpy(path + pathlen, ((flags & APR_FILEPATH_NATIVE) ? "..\\" : "../"), 3); pathlen += 3; + /* The 'root' part of this path now includes the ../ path, + * because that backpath will not be parsed by the truename + * code below. + */ + keptlen = pathlen; } else { @@ -748,16 +753,16 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, --pathlen; } while (pathlen && path[pathlen - 1] != '/' && path[pathlen - 1] != '\\'); - } - /* Now test if we are above where we started and back up - * the keptlen offset to reflect the added/altered path. - */ - if (pathlen < keptlen) - { - if (flags & APR_FILEPATH_SECUREROOTTEST) - return APR_EABOVEROOT; - keptlen = pathlen; + /* Now test if we are above where we started and back up + * the keptlen offset to reflect the added/altered path. + */ + if (pathlen < keptlen) + { + if (flags & APR_FILEPATH_SECUREROOTTEST) + return APR_EABOVEROOT; + keptlen = pathlen; + } } } else /* not empty or dots */ diff --git a/include/apr.h.in b/include/apr.h.in index b2cead997..8ddda130c 100644 --- a/include/apr.h.in +++ b/include/apr.h.in @@ -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 --git a/include/apr.hnw b/include/apr.hnw index 5687d7ee3..8fdae0791 100644 --- a/include/apr.hnw +++ b/include/apr.hnw @@ -143,6 +143,7 @@ extern "C" { #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 --git a/include/apr.hw b/include/apr.hw index 621ea50db..e6b1839c2 100644 --- a/include/apr.hw +++ b/include/apr.hw @@ -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 --git a/include/apr_atomic.h b/include/apr_atomic.h index 9f185e402..52f5659c6 100644 --- a/include/apr_atomic.h +++ b/include/apr_atomic.h @@ -164,7 +164,7 @@ void *apr_atomic_casptr(volatile void **mem, void *with, const void *cmp); #if defined(WIN32) -typedef LONG apr_atomic_t; +#define apr_atomic_t LONG #define apr_atomic_add(mem, val) InterlockedExchangeAdd(mem,val) #define apr_atomic_dec(mem) InterlockedDecrement(mem) diff --git a/include/apr_network_io.h b/include/apr_network_io.h index cad711810..0337e9e1f 100644 --- a/include/apr_network_io.h +++ b/include/apr_network_io.h @@ -721,6 +721,15 @@ APR_DECLARE(apr_status_t) apr_socket_timeout_get(apr_socket_t *sock, 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 --git a/include/apr_pools.h b/include/apr_pools.h index a19fe5f1f..5825e1c17 100644 --- a/include/apr_pools.h +++ b/include/apr_pools.h @@ -481,10 +481,12 @@ APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag); * * 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 --git a/include/apr_portable.h b/include/apr_portable.h index 6f79f45cd..182e325b1 100644 --- a/include/apr_portable.h +++ b/include/apr_portable.h @@ -391,6 +391,21 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file, 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 --git a/include/apr_version.h b/include/apr_version.h index b56dde2f1..3d85b5f41 100644 --- a/include/apr_version.h +++ b/include/apr_version.h @@ -99,7 +99,7 @@ extern "C" { #define APR_MINOR_VERSION 9 /** patch level */ -#define APR_PATCH_VERSION 4 +#define APR_PATCH_VERSION 5 /** diff --git a/include/arch/netware/apr_arch_file_io.h b/include/arch/netware/apr_arch_file_io.h index 7779c2c20..e17a7004e 100644 --- a/include/arch/netware/apr_arch_file_io.h +++ b/include/arch/netware/apr_arch_file_io.h @@ -147,8 +147,6 @@ struct apr_stat_entry_t { 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 --git a/include/arch/unix/apr_arch_networkio.h b/include/arch/unix/apr_arch_networkio.h index 8250324a0..917d17f82 100644 --- a/include/arch/unix/apr_arch_networkio.h +++ b/include/arch/unix/apr_arch_networkio.h @@ -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 --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c index d10012114..1e8426f54 100644 --- a/memory/unix/apr_pools.c +++ b/memory/unix/apr_pools.c @@ -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_DECLARE(apr_status_t) apr_pool_initialize(void) 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_DECLARE(apr_status_t) apr_pool_initialize(void) 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 --git a/misc/netware/aprlib.def b/misc/netware/aprlib.def index 973612427..0a2a01eb8 100644 --- a/misc/netware/aprlib.def +++ b/misc/netware/aprlib.def @@ -1,4 +1,3 @@ MODULE LIBC.NLM MODULE WS2_32.NLM -IMPORT CpuCurrentProcessor EXPORT @aprlib.imp diff --git a/misc/unix/start.c b/misc/unix/start.c index 48c815651..2dce9831f 100644 --- a/misc/unix/start.c +++ b/misc/unix/start.c @@ -99,9 +99,12 @@ APR_DECLARE(apr_status_t) apr_initialize(void) 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 --git a/network_io/os2/sockopt.c b/network_io/os2/sockopt.c index 823036d71..b95ccd59f 100644 --- a/network_io/os2/sockopt.c +++ b/network_io/os2/sockopt.c @@ -170,6 +170,20 @@ APR_DECLARE(apr_status_t) apr_getsocketopt(apr_socket_t *sock, } +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 --git a/network_io/unix/sockaddr.c b/network_io/unix/sockaddr.c index 765252b2e..75eab6b67 100644 --- a/network_io/unix/sockaddr.c +++ b/network_io/unix/sockaddr.c @@ -374,14 +374,6 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa, 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 @@ -391,16 +383,19 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa, /* getaddrinfo according to RFC 2553 must have either hostname * or servname non-NULL. */ +#ifdef _AIX + /* But current AIX getaddrinfo() doesn't like servname = "0"; + * the "1" won't hurt since we use the port parameter to fill + * in the returned socket addresses later + */ + if (!port) { + servname = "1"; + } + else +#endif 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 --git a/network_io/unix/sockopt.c b/network_io/unix/sockopt.c index c346678cb..26de90c17 100644 --- a/network_io/unix/sockopt.c +++ b/network_io/unix/sockopt.c @@ -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_opt_get(apr_socket_t *sock, } +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 --git a/network_io/win32/sockopt.c b/network_io/win32/sockopt.c index aa9e0870c..cde40304e 100644 --- a/network_io/win32/sockopt.c +++ b/network_io/win32/sockopt.c @@ -276,6 +276,19 @@ APR_DECLARE(apr_status_t) apr_getsocketopt(apr_socket_t *sock, } +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 --git a/test/testnames.c b/test/testnames.c index 196afce2d..3c5e3dfa2 100644 --- a/test/testnames.c +++ b/test/testnames.c @@ -114,6 +114,19 @@ static void merge_dotdot(CuTest *tc) CuAssertPtrNotNull(tc, dstpath); CuAssertIntEquals(tc, APR_SUCCESS, rv); CuAssertStrEquals(tc, ABS_ROOT"foo/baz", dstpath); + + rv = apr_filepath_merge(&dstpath, "", "../test", 0, p); + CuAssertIntEquals(tc, 0, APR_SUCCESS); + CuAssertStrEquals(tc, "../test", dstpath); + + /* Very dangerous assumptions here about what the cwd is. However, let's assume + * that the testall is invoked from within apr/test/ so the following test should + * return ../test unless a previously fixed bug remains or the developer changes + * the case of the test directory: + */ + rv = apr_filepath_merge(&dstpath, "", "../test", APR_FILEPATH_TRUENAME, p); + CuAssertIntEquals(tc, 0, APR_SUCCESS); + CuAssertStrEquals(tc, "../test", dstpath); } static void merge_secure(CuTest *tc) diff --git a/threadproc/beos/threadcancel.c b/threadproc/beos/threadcancel.c deleted file mode 100644 index 94a7e9407..000000000 --- a/threadproc/beos/threadcancel.c +++ /dev/null @@ -1,88 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "threadproc.h" - - -ap_status_t ap_cancel_thread(ap_thread_t *thd) -{ - if (kill_thread(thd->td) == 0) { - return APR_SUCCESS; - } - else { - return errno; - } -} - - -ap_status_t ap_setcanceltype(ap_int32_t type, ap_pool_t *cont) -{ -/* if (pthread_setcanceltype(type, NULL) == 0) {*/ - return APR_SUCCESS; -/* } - else { - return APR_FAILURE; - }*/ -} - -ap_status_t ap_setcancelstate(ap_int32_t type, ap_pool_t *cont) -{ -/* if (pthread_setcanceltype(type, NULL) == 0) {*/ - return APR_SUCCESS; -/* } - else { - return APR_FAILURE; - }*/ -} - diff --git a/threadproc/os2/threadcancel.c b/threadproc/os2/threadcancel.c deleted file mode 100644 index ca7a18753..000000000 --- a/threadproc/os2/threadcancel.c +++ /dev/null @@ -1,85 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "threadproc.h" -#include "apr_thread_proc.h" -#include "apr_general.h" -#include "fileio.h" - -ap_status_t ap_cancel_thread(ap_thread_t *thd) -{ - return APR_OS2_STATUS(DosKillThread(thd->tid)); -} - - - -ap_status_t ap_setcanceltype(ap_int32_t type, ap_pool_t *cont) -{ - ULONG rc, nesting; - - if (type == APR_CANCEL_DEFER) - rc = DosEnterMustComplete(&nesting); - else - rc = DosExitMustComplete(&nesting); - - return APR_OS2_STATUS(rc); -} - - - -ap_status_t ap_setcancelstate(ap_int32_t type, ap_pool_t *cont) -{ -/* There's no way to ignore thread kills altogether in OS/2 (that I know of) */ - return APR_ENOTIMPL; -} diff --git a/threadproc/win32/threadcancel.c b/threadproc/win32/threadcancel.c deleted file mode 100644 index 3a509202b..000000000 --- a/threadproc/win32/threadcancel.c +++ /dev/null @@ -1,86 +0,0 @@ -/* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ - -#include "threadproc.h" -#include "apr_thread_proc.h" -#include "apr_general.h" - - -ap_status_t ap_cancel_thread(ap_thread_t *thd) -{ - if (TerminateThread(thd->td, APR_SUCCESS) == 0) { - return APR_EEXIST; - } - else { - return APR_SUCCESS; - } -} - -/* Not sure of the best way to do this just yet. -ap_status_t ap_setcanceltype(ap_int32_t type, ap_pool_t *cont) -{ - -} - -ap_status_t ap_setcancelstate(ap_int32_t type, ap_pool_t *cont) -{ - ap_status_t stat; - if ((stat = pthread_setcanceltype(type, NULL)) == 0) { - return APR_SUCCESS; - } - else { - return stat; - } -} -*/ |