[core] use fspr prefixed symbols instead of apr

This commit is contained in:
Chris Rienzo 2022-08-18 14:39:44 -04:00 committed by Andrey Volk
parent 5c2726f413
commit 85d25e269b
12 changed files with 396 additions and 397 deletions

6
libs/.gitignore vendored
View File

@ -34,9 +34,9 @@ opal
/apr/build/pkg/pkginfo /apr/build/pkg/pkginfo
/apr/exports.c /apr/exports.c
/apr/export_vars.c /apr/export_vars.c
/apr/include/apr.h /apr/include/fspr.h
/apr/include/arch/unix/apr_private.h /apr/include/arch/unix/fspr_private.h
/apr/include/arch/unix/apr_private.h.in /apr/include/arch/unix/fspr_private.h.in
/apr/.make.dirs /apr/.make.dirs
/apr/Makefile /apr/Makefile
/apr/test/internal/Makefile /apr/test/internal/Makefile

View File

@ -34,34 +34,34 @@
#ifndef __SWITCH_APR_PVT_H__ #ifndef __SWITCH_APR_PVT_H__
#define __SWITCH_APR_PVT_H__ #define __SWITCH_APR_PVT_H__
/* for apr_pool_create and apr_pool_destroy */ /* for fspr_pool_create and fspr_pool_destroy */
/* functions only used in this file so not exposed */ /* functions only used in this file so not exposed */
#include <apr_pools.h> #include <fspr_pools.h>
/* for apr_hash_make, apr_hash_pool_get, apr_hash_set */ /* for fspr_hash_make, fspr_hash_pool_get, fspr_hash_set */
/* functions only used in this file so not exposed */ /* functions only used in this file so not exposed */
#include <apr_hash.h> #include <fspr_hash.h>
/* for apr_pvsprintf */ /* for fspr_pvsprintf */
/* function only used in this file so not exposed */ /* function only used in this file so not exposed */
#include <apr_strings.h> #include <fspr_strings.h>
/* for apr_initialize and apr_terminate */ /* for fspr_initialize and fspr_terminate */
/* function only used in this file so not exposed */ /* function only used in this file so not exposed */
#include <apr_general.h> #include <fspr_general.h>
#include <apr_portable.h> #include <fspr_portable.h>
typedef struct switch_apr_queue_t switch_apr_queue_t; typedef struct switch_apr_queue_t switch_apr_queue_t;
apr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_capacity, apr_pool_t *a); fspr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_capacity, fspr_pool_t *a);
apr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data); fspr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data);
apr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data); fspr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data);
unsigned int switch_apr_queue_size(switch_apr_queue_t *queue); unsigned int switch_apr_queue_size(switch_apr_queue_t *queue);
apr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data); fspr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data);
apr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data, apr_interval_time_t timeout); fspr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data, fspr_interval_time_t timeout);
apr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data); fspr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data);
apr_status_t switch_apr_queue_interrupt_all(switch_apr_queue_t *queue); fspr_status_t switch_apr_queue_interrupt_all(switch_apr_queue_t *queue);
apr_status_t switch_apr_queue_term(switch_apr_queue_t *queue); fspr_status_t switch_apr_queue_term(switch_apr_queue_t *queue);
#endif // __SWITCH_APR_PVT_H__ #endif // __SWITCH_APR_PVT_H__

View File

@ -75,14 +75,14 @@ SWITCH_DECLARE(int) switch_thread_equal(switch_thread_id_t tid1, switch_thread_i
* @{ * @{
*/ */
/** The fundamental pool type */ /** The fundamental pool type */
/* see switch types.h typedef struct apr_pool_t switch_memory_pool_t;*/ /* see switch types.h typedef struct fspr_pool_t switch_memory_pool_t;*/
/** /**
* Clear all memory in the pool and run all the cleanups. This also destroys all * Clear all memory in the pool and run all the cleanups. This also destroys all
* subpools. * subpools.
* @param pool The pool to clear * @param pool The pool to clear
* @remark This does not actually free the memory, it just allows the pool * @remark This does not actually free the memory, it just allows the pool
* to re-use this memory for the next allocation. * to re-use this memory for the next allocation.
* @see apr_pool_destroy() * @see fspr_pool_destroy()
*/ */
SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *pool); SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *pool);
@ -108,16 +108,16 @@ SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size)
#if 0 #if 0
/** /**
* @defgroup apr_hash Hash Tables * @defgroup fspr_hash Hash Tables
* @ingroup switch_apr * @ingroup switch_apr
* @{ * @{
*/ */
/** Abstract type for hash tables. */ /** Abstract type for hash tables. */
typedef struct apr_hash_t switch_hash_t; typedef struct fspr_hash_t switch_hash_t;
/** Abstract type for scanning hash tables. */ /** Abstract type for scanning hash tables. */
typedef struct apr_hash_index_t switch_hash_index_t; typedef struct fspr_hash_index_t switch_hash_index_t;
/** /**
* When passing a key to switch_hashfunc_default, this value can be * When passing a key to switch_hashfunc_default, this value can be
@ -228,7 +228,7 @@ SWITCH_DECLARE(switch_time_t) switch_time_make(switch_time_t sec, int32_t usec);
SWITCH_DECLARE(switch_time_t) switch_time_now(void); SWITCH_DECLARE(switch_time_t) switch_time_now(void);
/** /**
* Convert time value from human readable format to a numeric apr_time_t that * Convert time value from human readable format to a numeric fspr_time_t that
* always represents GMT * always represents GMT
* @param result the resulting imploded time * @param result the resulting imploded time
* @param input the input exploded time * @param input the input exploded time
@ -273,7 +273,7 @@ SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input); SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input);
/** /**
* Convert time value from human readable format to a numeric apr_time_t * Convert time value from human readable format to a numeric fspr_time_t
* e.g. elapsed usec since epoch * e.g. elapsed usec since epoch
* @param result the resulting imploded time * @param result the resulting imploded time
* @param input the input exploded time * @param input the input exploded time
@ -311,7 +311,7 @@ SWITCH_DECLARE(void) switch_micro_sleep(switch_interval_time_t t);
*/ */
/** Opaque thread-local mutex structure */ /** Opaque thread-local mutex structure */
typedef struct apr_thread_mutex_t switch_mutex_t; typedef struct fspr_thread_mutex_t switch_mutex_t;
/** Lock Flags */ /** Lock Flags */
#define SWITCH_MUTEX_DEFAULT 0x0 /**< platform-optimal lock behavior */ #define SWITCH_MUTEX_DEFAULT 0x0 /**< platform-optimal lock behavior */
@ -374,8 +374,8 @@ SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock);
*/ */
/** Opaque type used for the atomic operations */ /** Opaque type used for the atomic operations */
#ifdef apr_atomic_t #ifdef fspr_atomic_t
typedef apr_atomic_t switch_atomic_t; typedef fspr_atomic_t switch_atomic_t;
#else #else
typedef uint32_t switch_atomic_t; typedef uint32_t switch_atomic_t;
#endif #endif
@ -433,7 +433,7 @@ SWITCH_DECLARE(int) switch_atomic_dec(volatile switch_atomic_t *mem);
*/ */
/** Opaque structure used for the rwlock */ /** Opaque structure used for the rwlock */
typedef struct apr_thread_rwlock_t switch_thread_rwlock_t; typedef struct fspr_thread_rwlock_t switch_thread_rwlock_t;
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t *pool); SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock); SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock);
@ -460,7 +460,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock
*/ */
/** Opaque structure for thread condition variables */ /** Opaque structure for thread condition variables */
typedef struct apr_thread_cond_t switch_thread_cond_t; typedef struct fspr_thread_cond_t switch_thread_cond_t;
/** /**
* Create and initialize a condition variable that can be used to signal * Create and initialize a condition variable that can be used to signal
@ -682,17 +682,17 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
*/ */
/** Structure for referencing files. */ /** Structure for referencing files. */
typedef struct apr_file_t switch_file_t; typedef struct fspr_file_t switch_file_t;
typedef int32_t switch_fileperms_t; typedef int32_t switch_fileperms_t;
typedef int switch_seek_where_t; typedef int switch_seek_where_t;
/** /**
* @defgroup apr_file_seek_flags File Seek Flags * @defgroup fspr_file_seek_flags File Seek Flags
* @{ * @{
*/ */
/* flags for apr_file_seek */ /* flags for fspr_file_seek */
/** Set the file position */ /** Set the file position */
#define SWITCH_SEEK_SET SEEK_SET #define SWITCH_SEEK_SET SEEK_SET
/** Current */ /** Current */
@ -725,7 +725,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
#define SWITCH_FPROT_OS_DEFAULT 0x0FFF /**< use OS's default permissions */ #define SWITCH_FPROT_OS_DEFAULT 0x0FFF /**< use OS's default permissions */
/* additional permission flags for apr_file_copy and apr_file_append */ /* additional permission flags for fspr_file_copy and fspr_file_append */
#define SWITCH_FPROT_FILE_SOURCE_PERMS 0x1000 /**< Copy source file's permissions */ #define SWITCH_FPROT_FILE_SOURCE_PERMS 0x1000 /**< Copy source file's permissions */
/** @} */ /** @} */
@ -769,7 +769,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
#define SWITCH_FOPEN_XTHREAD 0x00200 /**< Platform dependent tag to open the file for use across multiple threads */ #define SWITCH_FOPEN_XTHREAD 0x00200 /**< Platform dependent tag to open the file for use across multiple threads */
#define SWITCH_FOPEN_SHARELOCK 0x00400 /**< Platform dependent support for higher level locked read/write access to support writes across process/machines */ #define SWITCH_FOPEN_SHARELOCK 0x00400 /**< Platform dependent support for higher level locked read/write access to support writes across process/machines */
#define SWITCH_FOPEN_NOCLEANUP 0x00800 /**< Do not register a cleanup when the file is opened */ #define SWITCH_FOPEN_NOCLEANUP 0x00800 /**< Do not register a cleanup when the file is opened */
#define SWITCH_FOPEN_SENDFILE_ENABLED 0x01000 /**< Advisory flag that this file should support apr_socket_sendfile operation */ #define SWITCH_FOPEN_SENDFILE_ENABLED 0x01000 /**< Advisory flag that this file should support fspr_socket_sendfile operation */
#define SWITCH_FOPEN_LARGEFILE 0x04000 /**< Platform dependent flag to enable large file support */ #define SWITCH_FOPEN_LARGEFILE 0x04000 /**< Platform dependent flag to enable large file support */
/** @} */ /** @} */
@ -796,11 +796,11 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
* writes across process/machines * writes across process/machines
* SWITCH_FOPEN_NOCLEANUP Do not register a cleanup with the pool * SWITCH_FOPEN_NOCLEANUP Do not register a cleanup with the pool
* passed in on the <EM>pool</EM> argument (see below). * passed in on the <EM>pool</EM> argument (see below).
* The apr_os_file_t handle in apr_file_t will not * The fspr_os_file_t handle in fspr_file_t will not
* be closed when the pool is destroyed. * be closed when the pool is destroyed.
* SWITCH_FOPEN_SENDFILE_ENABLED Open with appropriate platform semantics * SWITCH_FOPEN_SENDFILE_ENABLED Open with appropriate platform semantics
* for sendfile operations. Advisory only, * for sendfile operations. Advisory only,
* apr_socket_sendfile does not check this flag. * fspr_socket_sendfile does not check this flag.
* </PRE> * </PRE>
* @param perm Access permissions for file. * @param perm Access permissions for file.
* @param pool The pool to use. * @param pool The pool to use.
@ -844,7 +844,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_rename(const char *from_path, const
* @param nbytes On entry, the number of bytes to read; on exit, the number * @param nbytes On entry, the number of bytes to read; on exit, the number
* of bytes read. * of bytes read.
* *
* @remark apr_file_read will read up to the specified number of * @remark fspr_file_read will read up to the specified number of
* bytes, but never more. If there isn't enough data to fill that * bytes, but never more. If there isn't enough data to fill that
* number of bytes, all of the available data is read. The third * number of bytes, all of the available data is read. The third
* argument is modified to reflect the number of bytes read. If a * argument is modified to reflect the number of bytes read. If a
@ -863,7 +863,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *b
* @param nbytes On entry, the number of bytes to write; on exit, the number * @param nbytes On entry, the number of bytes to write; on exit, the number
* of bytes written. * of bytes written.
* *
* @remark apr_file_write will write up to the specified number of * @remark fspr_file_write will write up to the specified number of
* bytes, but never more. If the OS cannot write that many bytes, it * bytes, but never more. If the OS cannot write that many bytes, it
* will write as many as it can. The third argument is modified to * will write as many as it can. The third argument is modified to
* reflect the * number of bytes written. * reflect the * number of bytes written.
@ -929,10 +929,10 @@ SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir);
*/ */
/** Opaque Thread structure. */ /** Opaque Thread structure. */
typedef struct apr_thread_t switch_thread_t; typedef struct fspr_thread_t switch_thread_t;
/** Opaque Thread attributes structure. */ /** Opaque Thread attributes structure. */
typedef struct apr_threadattr_t switch_threadattr_t; typedef struct fspr_threadattr_t switch_threadattr_t;
/** /**
* The prototype for any APR thread worker functions. * The prototype for any APR thread worker functions.
@ -940,7 +940,7 @@ SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir);
*/ */
typedef void *(SWITCH_THREAD_FUNC * switch_thread_start_t) (switch_thread_t *, void *); typedef void *(SWITCH_THREAD_FUNC * switch_thread_start_t) (switch_thread_t *, void *);
//APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, switch_size_t stacksize) //APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr, switch_size_t stacksize)
SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize); SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize);
SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_set(switch_threadattr_t *attr, switch_thread_priority_t priority); SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_set(switch_threadattr_t *attr, switch_thread_priority_t priority);
@ -1014,10 +1014,10 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thre
#endif #endif
/** A structure to represent sockets */ /** A structure to represent sockets */
typedef struct apr_socket_t switch_socket_t; typedef struct fspr_socket_t switch_socket_t;
/** Freeswitch's socket address type, used to ensure protocol independence */ /** Freeswitch's socket address type, used to ensure protocol independence */
typedef struct apr_sockaddr_t switch_sockaddr_t; typedef struct fspr_sockaddr_t switch_sockaddr_t;
typedef enum { typedef enum {
SWITCH_SHUTDOWN_READ, /**< no longer allow read request */ SWITCH_SHUTDOWN_READ, /**< no longer allow read request */
@ -1118,8 +1118,8 @@ SWITCH_DECLARE(int) switch_sockaddr_equal(const switch_sockaddr_t *sa1, const sw
/** /**
* Create apr_sockaddr_t from hostname, address family, and port. * Create fspr_sockaddr_t from hostname, address family, and port.
* @param sa The new apr_sockaddr_t. * @param sa The new fspr_sockaddr_t.
* @param hostname The hostname or numeric address string to resolve/parse, or * @param hostname The hostname or numeric address string to resolve/parse, or
* NULL to build an address that corresponds to 0.0.0.0 or :: * NULL to build an address that corresponds to 0.0.0.0 or ::
* @param family The address family to use, or SWITCH_UNSPEC if the system should * @param family The address family to use, or SWITCH_UNSPEC if the system should
@ -1138,7 +1138,7 @@ SWITCH_DECLARE(int) switch_sockaddr_equal(const switch_sockaddr_t *sa1, const sw
* isn't NULL and APR_HAVE_IPV6; mutually exclusive * isn't NULL and APR_HAVE_IPV6; mutually exclusive
* with APR_IPV4_ADDR_OK * with APR_IPV4_ADDR_OK
* </PRE> * </PRE>
* @param pool The pool for the apr_sockaddr_t and associated storage. * @param pool The pool for the fspr_sockaddr_t and associated storage.
*/ */
SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname, SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname,
int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t *pool); int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t *pool);
@ -1156,7 +1156,7 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_new(switch_sockaddr_t ** sa, con
* @remark * @remark
* <PRE> * <PRE>
* This functions acts like a blocking write by default. To change * This functions acts like a blocking write by default. To change
* this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK * this behavior, use fspr_socket_timeout_set() or the APR_SO_NONBLOCK
* socket option. * socket option.
* *
* It is possible for both bytes to be sent and an error to be returned. * It is possible for both bytes to be sent and an error to be returned.
@ -1168,7 +1168,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const
/** /**
* @param sock The socket to send from * @param sock The socket to send from
* @param where The apr_sockaddr_t describing where to send the data * @param where The fspr_sockaddr_t describing where to send the data
* @param flags The flags to use * @param flags The flags to use
* @param buf The data to send * @param buf The data to send
* @param len The length of the data to send * @param len The length of the data to send
@ -1179,7 +1179,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, swit
SWITCH_DECLARE(switch_status_t) switch_socket_send_nonblock(switch_socket_t *sock, const char *buf, switch_size_t *len); SWITCH_DECLARE(switch_status_t) switch_socket_send_nonblock(switch_socket_t *sock, const char *buf, switch_size_t *len);
/** /**
* @param from The apr_sockaddr_t to fill in the recipient info * @param from The fspr_sockaddr_t to fill in the recipient info
* @param sock The socket to use * @param sock The socket to use
* @param flags The flags to use * @param flags The flags to use
* @param buf The buffer to use * @param buf The buffer to use
@ -1199,7 +1199,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_atmark(switch_socket_t *sock, int
* @remark * @remark
* <PRE> * <PRE>
* This functions acts like a blocking read by default. To change * This functions acts like a blocking read by default. To change
* this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK * this behavior, use fspr_socket_timeout_set() or the APR_SO_NONBLOCK
* socket option. * socket option.
* The number of bytes actually received is stored in argument 3. * The number of bytes actually received is stored in argument 3.
* *
@ -1304,14 +1304,14 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_interface(switch_socket_t *sock, sw
/**< descriptor type */ /**< descriptor type */
int16_t reqevents; /**< requested events */ int16_t reqevents; /**< requested events */
int16_t rtnevents; /**< returned events */ int16_t rtnevents; /**< returned events */
switch_descriptor_t desc; /**< @see apr_descriptor */ switch_descriptor_t desc; /**< @see fspr_descriptor */
void *client_data; /**< allows app to associate context */ void *client_data; /**< allows app to associate context */
}; };
/** /**
* @defgroup apr_poll Poll Routines * @defgroup fspr_poll Poll Routines
* @ingroup switch_apr * @ingroup switch_apr
* @{ * @{
*/ */
@ -1319,7 +1319,7 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_interface(switch_socket_t *sock, sw
typedef struct switch_pollfd switch_pollfd_t; typedef struct switch_pollfd switch_pollfd_t;
/** Opaque structure used for pollset API */ /** Opaque structure used for pollset API */
typedef struct apr_pollset_t switch_pollset_t; typedef struct fspr_pollset_t switch_pollset_t;
/** /**
* Poll options * Poll options
@ -1340,9 +1340,9 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_interface(switch_socket_t *sock, sw
* *
* @remark If flags equals APR_POLLSET_THREADSAFE, then a pollset is * @remark If flags equals APR_POLLSET_THREADSAFE, then a pollset is
* created on which it is safe to make concurrent calls to * created on which it is safe to make concurrent calls to
* apr_pollset_add(), apr_pollset_remove() and apr_pollset_poll() from * fspr_pollset_add(), fspr_pollset_remove() and fspr_pollset_poll() from
* separate threads. This feature is only supported on some * separate threads. This feature is only supported on some
* platforms; the apr_pollset_create() call will fail with * platforms; the fspr_pollset_create() call will fail with
* APR_ENOTIMPL on platforms where it is not supported. * APR_ENOTIMPL on platforms where it is not supported.
*/ */
SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollset, uint32_t size, switch_memory_pool_t *pool, uint32_t flags); SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollset, uint32_t size, switch_memory_pool_t *pool, uint32_t flags);
@ -1353,11 +1353,11 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollse
* @param descriptor The descriptor to add * @param descriptor The descriptor to add
* @remark If you set client_data in the descriptor, that value * @remark If you set client_data in the descriptor, that value
* will be returned in the client_data field whenever this * will be returned in the client_data field whenever this
* descriptor is signalled in apr_pollset_poll(). * descriptor is signalled in fspr_pollset_poll().
* @remark If the pollset has been created with APR_POLLSET_THREADSAFE * @remark If the pollset has been created with APR_POLLSET_THREADSAFE
* and thread T1 is blocked in a call to apr_pollset_poll() for * and thread T1 is blocked in a call to fspr_pollset_poll() for
* this same pollset that is being modified via apr_pollset_add() * this same pollset that is being modified via fspr_pollset_add()
* in thread T2, the currently executing apr_pollset_poll() call in * in thread T2, the currently executing fspr_pollset_poll() call in
* T1 will either: (1) automatically include the newly added descriptor * T1 will either: (1) automatically include the newly added descriptor
* in the set of descriptors it is watching or (2) return immediately * in the set of descriptors it is watching or (2) return immediately
* with APR_EINTR. Option (1) is recommended, but option (2) is * with APR_EINTR. Option (1) is recommended, but option (2) is
@ -1371,9 +1371,9 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, co
* @param pollset The pollset from which to remove the descriptor * @param pollset The pollset from which to remove the descriptor
* @param descriptor The descriptor to remove * @param descriptor The descriptor to remove
* @remark If the pollset has been created with APR_POLLSET_THREADSAFE * @remark If the pollset has been created with APR_POLLSET_THREADSAFE
* and thread T1 is blocked in a call to apr_pollset_poll() for * and thread T1 is blocked in a call to fspr_pollset_poll() for
* this same pollset that is being modified via apr_pollset_remove() * this same pollset that is being modified via fspr_pollset_remove()
* in thread T2, the currently executing apr_pollset_poll() call in * in thread T2, the currently executing fspr_pollset_poll() call in
* T1 will either: (1) automatically exclude the newly added descriptor * T1 will either: (1) automatically exclude the newly added descriptor
* in the set of descriptors it is watching or (2) return immediately * in the set of descriptors it is watching or (2) return immediately
* with APR_EINTR. Option (1) is recommended, but option (2) is * with APR_EINTR. Option (1) is recommended, but option (2) is

View File

@ -2323,7 +2323,7 @@ typedef int switch_os_socket_t;
#define SWITCH_SOCK_INVALID -1 #define SWITCH_SOCK_INVALID -1
#endif #endif
typedef struct apr_pool_t switch_memory_pool_t; typedef struct fspr_pool_t switch_memory_pool_t;
typedef void* switch_plc_state_t; typedef void* switch_plc_state_t;
typedef uint16_t switch_port_t; typedef uint16_t switch_port_t;
typedef uint8_t switch_payload_t; typedef uint8_t switch_payload_t;

View File

@ -1040,7 +1040,7 @@ int main(int argc, char *argv[])
return freeswitch_kill_background(); return freeswitch_kill_background();
} }
if (apr_initialize() != SWITCH_STATUS_SUCCESS) { if (fspr_initialize() != SWITCH_STATUS_SUCCESS) {
fprintf(stderr, "FATAL ERROR! Could not initialize APR\n"); fprintf(stderr, "FATAL ERROR! Could not initialize APR\n");
return 255; return 255;
} }
@ -1067,7 +1067,7 @@ int main(int argc, char *argv[])
rlp.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE; rlp.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE;
setrlimit(RLIMIT_STACK, &rlp); setrlimit(RLIMIT_STACK, &rlp);
apr_terminate(); fspr_terminate();
if (argv) ret = (int) execv(argv[0], argv); if (argv) ret = (int) execv(argv[0], argv);
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
@ -1168,7 +1168,7 @@ int main(int argc, char *argv[])
switch_snprintf(pid_buffer, sizeof(pid_buffer), "%d", pid); switch_snprintf(pid_buffer, sizeof(pid_buffer), "%d", pid);
pid_len = strlen(pid_buffer); pid_len = strlen(pid_buffer);
apr_pool_create(&pool, NULL); fspr_pool_create(&pool, NULL);
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.run_dir, SWITCH_DEFAULT_DIR_PERMS, pool); switch_dir_make_recursive(SWITCH_GLOBAL_dirs.run_dir, SWITCH_DEFAULT_DIR_PERMS, pool);
@ -1230,7 +1230,7 @@ int main(int argc, char *argv[])
destroy_status = switch_core_destroy(); destroy_status = switch_core_destroy();
switch_file_close(fd); switch_file_close(fd);
apr_pool_destroy(pool); fspr_pool_destroy(pool);
if (unlink(pid_path) != 0) { if (unlink(pid_path) != 0) {
fprintf(stderr, "Failed to delete pid file [%s]\n", pid_path); fprintf(stderr, "Failed to delete pid file [%s]\n", pid_path);

View File

@ -39,37 +39,37 @@
#include "private/switch_apr_pvt.h" #include "private/switch_apr_pvt.h"
/* apr headers*/ /* apr headers*/
#include <apr.h> #include <fspr.h>
#include <apr_atomic.h> #include <fspr_atomic.h>
#include <apr_pools.h> #include <fspr_pools.h>
#include <apr_hash.h> #include <fspr_hash.h>
#include <apr_network_io.h> #include <fspr_network_io.h>
#include <apr_errno.h> #include <fspr_errno.h>
#include <apr_thread_proc.h> #include <fspr_thread_proc.h>
#include <apr_portable.h> #include <fspr_portable.h>
#include <apr_thread_mutex.h> #include <fspr_thread_mutex.h>
#include <apr_thread_cond.h> #include <fspr_thread_cond.h>
#include <apr_thread_rwlock.h> #include <fspr_thread_rwlock.h>
#include <apr_file_io.h> #include <fspr_file_io.h>
#include <apr_poll.h> #include <fspr_poll.h>
#include <apr_strings.h> #include <fspr_strings.h>
#define APR_WANT_STDIO #define APR_WANT_STDIO
#define APR_WANT_STRFUNC #define APR_WANT_STRFUNC
#include <apr_want.h> #include <fspr_want.h>
#include <apr_file_info.h> #include <fspr_file_info.h>
#include <apr_fnmatch.h> #include <fspr_fnmatch.h>
#include <apr_tables.h> #include <fspr_tables.h>
#ifdef WIN32 #ifdef WIN32
#include "apr_arch_networkio.h" #include "fspr_arch_networkio.h"
/* Missing socket symbols */ /* Missing socket symbols */
#ifndef SOL_TCP #ifndef SOL_TCP
#define SOL_TCP IPPROTO_TCP #define SOL_TCP IPPROTO_TCP
#endif #endif
#endif #endif
/* apr_vformatter_buff_t definition*/ /* fspr_vformatter_buff_t definition*/
#include <apr_lib.h> #include <fspr_lib.h>
#if (defined(HAVE_LIBMD5) || defined(HAVE_LIBMD) || defined(HAVE_MD5INIT)) #if (defined(HAVE_LIBMD5) || defined(HAVE_LIBMD) || defined(HAVE_MD5INIT))
#include <md5.h> #include <md5.h>
@ -91,7 +91,7 @@ SWITCH_DECLARE(int) switch_status_is_timeup(int status)
SWITCH_DECLARE(switch_thread_id_t) switch_thread_self(void) SWITCH_DECLARE(switch_thread_id_t) switch_thread_self(void)
{ {
#ifndef WIN32 #ifndef WIN32
return apr_os_thread_current(); return fspr_os_thread_current();
#else #else
return (switch_thread_id_t) (GetCurrentThreadId()); return (switch_thread_id_t) (GetCurrentThreadId());
#endif #endif
@ -102,7 +102,7 @@ SWITCH_DECLARE(int) switch_thread_equal(switch_thread_id_t tid1, switch_thread_i
#ifdef WIN32 #ifdef WIN32
return (tid1 == tid2); return (tid1 == tid2);
#else #else
return apr_os_thread_equal(tid1, tid2); return fspr_os_thread_equal(tid1, tid2);
#endif #endif
} }
@ -112,7 +112,7 @@ SWITCH_DECLARE(unsigned int) switch_ci_hashfunc_default(const char *char_key, sw
unsigned int hash = 0; unsigned int hash = 0;
const unsigned char *key = (const unsigned char *) char_key; const unsigned char *key = (const unsigned char *) char_key;
const unsigned char *p; const unsigned char *p;
apr_ssize_t i; fspr_ssize_t i;
if (*klen == APR_HASH_KEY_STRING) { if (*klen == APR_HASH_KEY_STRING) {
for (p = key; *p; p++) { for (p = key; *p; p++) {
@ -131,7 +131,7 @@ SWITCH_DECLARE(unsigned int) switch_ci_hashfunc_default(const char *char_key, sw
SWITCH_DECLARE(unsigned int) switch_hashfunc_default(const char *key, switch_ssize_t *klen) SWITCH_DECLARE(unsigned int) switch_hashfunc_default(const char *key, switch_ssize_t *klen)
{ {
return apr_hashfunc_default(key, klen); return fspr_hashfunc_default(key, klen);
} }
/* string functions */ /* string functions */
@ -185,12 +185,12 @@ SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize,
p++; p++;
} }
return apr_strftime(s, retsize, max, format, (apr_time_exp_t *) tm); return fspr_strftime(s, retsize, max, format, (fspr_time_exp_t *) tm);
} }
SWITCH_DECLARE(switch_status_t) switch_strftime_nocheck(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm) SWITCH_DECLARE(switch_status_t) switch_strftime_nocheck(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm)
{ {
return apr_strftime(s, retsize, max, format, (apr_time_exp_t *) tm); return fspr_strftime(s, retsize, max, format, (fspr_time_exp_t *) tm);
} }
SWITCH_DECLARE(int) switch_snprintf(char *buf, switch_size_t len, const char *format, ...) SWITCH_DECLARE(int) switch_snprintf(char *buf, switch_size_t len, const char *format, ...)
@ -198,14 +198,14 @@ SWITCH_DECLARE(int) switch_snprintf(char *buf, switch_size_t len, const char *fo
va_list ap; va_list ap;
int ret; int ret;
va_start(ap, format); va_start(ap, format);
ret = apr_vsnprintf(buf, len, format, ap); ret = fspr_vsnprintf(buf, len, format, ap);
va_end(ap); va_end(ap);
return ret; return ret;
} }
SWITCH_DECLARE(int) switch_vsnprintf(char *buf, switch_size_t len, const char *format, va_list ap) SWITCH_DECLARE(int) switch_vsnprintf(char *buf, switch_size_t len, const char *format, va_list ap)
{ {
return apr_vsnprintf(buf, len, format, ap); return fspr_vsnprintf(buf, len, format, ap);
} }
SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_size_t dst_size) SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_size_t dst_size)
@ -216,44 +216,44 @@ SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_siz
*dst = '\0'; *dst = '\0';
return dst; return dst;
} }
return apr_cpystrn(dst, src, dst_size); return fspr_cpystrn(dst, src, dst_size);
} }
/* thread read write lock functions */ /* thread read write lock functions */
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t *pool)
{ {
return apr_thread_rwlock_create(rwlock, pool); return fspr_thread_rwlock_create(rwlock, pool);
} }
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock) SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock)
{ {
return apr_thread_rwlock_destroy(rwlock); return fspr_thread_rwlock_destroy(rwlock);
} }
SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock) SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock)
{ {
return apr_thread_rwlock_pool_get(rwlock); return fspr_thread_rwlock_pool_get(rwlock);
} }
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock) SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock)
{ {
return apr_thread_rwlock_rdlock(rwlock); return fspr_thread_rwlock_rdlock(rwlock);
} }
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t *rwlock) SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t *rwlock)
{ {
return apr_thread_rwlock_tryrdlock(rwlock); return fspr_thread_rwlock_tryrdlock(rwlock);
} }
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock) SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock)
{ {
return apr_thread_rwlock_wrlock(rwlock); return fspr_thread_rwlock_wrlock(rwlock);
} }
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t *rwlock) SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t *rwlock)
{ {
return apr_thread_rwlock_trywrlock(rwlock); return fspr_thread_rwlock_trywrlock(rwlock);
} }
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock_timeout(switch_thread_rwlock_t *rwlock, int timeout) SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock_timeout(switch_thread_rwlock_t *rwlock, int timeout)
@ -274,7 +274,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock_timeout(switch_th
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock) SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock)
{ {
return apr_thread_rwlock_unlock(rwlock); return fspr_thread_rwlock_unlock(rwlock);
} }
/* thread mutex functions */ /* thread mutex functions */
@ -286,27 +286,27 @@ SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t ** lock, unsign
APR has no reason to not use critical sections instead of mutexes. */ APR has no reason to not use critical sections instead of mutexes. */
if (flags == SWITCH_MUTEX_NESTED) flags = SWITCH_MUTEX_DEFAULT; if (flags == SWITCH_MUTEX_NESTED) flags = SWITCH_MUTEX_DEFAULT;
#endif #endif
return apr_thread_mutex_create(lock, flags, pool); return fspr_thread_mutex_create(lock, flags, pool);
} }
SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t *lock) SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t *lock)
{ {
return apr_thread_mutex_destroy(lock); return fspr_thread_mutex_destroy(lock);
} }
SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t *lock) SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t *lock)
{ {
return apr_thread_mutex_lock(lock); return fspr_thread_mutex_lock(lock);
} }
SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t *lock) SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t *lock)
{ {
return apr_thread_mutex_unlock(lock); return fspr_thread_mutex_unlock(lock);
} }
SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock) SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock)
{ {
return apr_thread_mutex_trylock(lock); return fspr_thread_mutex_trylock(lock);
} }
/* time function stubs */ /* time function stubs */
@ -318,38 +318,38 @@ SWITCH_DECLARE(switch_time_t) switch_time_now(void)
clock_gettime(CLOCK_REALTIME, &ts); clock_gettime(CLOCK_REALTIME, &ts);
return ts.tv_sec * APR_USEC_PER_SEC + (ts.tv_nsec / 1000); return ts.tv_sec * APR_USEC_PER_SEC + (ts.tv_nsec / 1000);
#else #else
return (switch_time_t) apr_time_now(); return (switch_time_t) fspr_time_now();
#endif #endif
} }
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input) SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input)
{ {
return apr_time_exp_gmt_get((apr_time_t *) result, (apr_time_exp_t *) input); return fspr_time_exp_gmt_get((fspr_time_t *) result, (fspr_time_exp_t *) input);
} }
SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input) SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input)
{ {
return apr_time_exp_get((apr_time_t *) result, (apr_time_exp_t *) input); return fspr_time_exp_get((fspr_time_t *) result, (fspr_time_exp_t *) input);
} }
SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input) SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input)
{ {
return apr_time_exp_lt((apr_time_exp_t *) result, input); return fspr_time_exp_lt((fspr_time_exp_t *) result, input);
} }
SWITCH_DECLARE(switch_status_t) switch_time_exp_tz(switch_time_exp_t *result, switch_time_t input, switch_int32_t offs) SWITCH_DECLARE(switch_status_t) switch_time_exp_tz(switch_time_exp_t *result, switch_time_t input, switch_int32_t offs)
{ {
return apr_time_exp_tz((apr_time_exp_t *) result, input, (apr_int32_t) offs); return fspr_time_exp_tz((fspr_time_exp_t *) result, input, (fspr_int32_t) offs);
} }
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input) SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input)
{ {
return apr_time_exp_gmt((apr_time_exp_t *) result, input); return fspr_time_exp_gmt((fspr_time_exp_t *) result, input);
} }
SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t t) SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t t)
{ {
return apr_rfc822_date(date_str, t); return fspr_rfc822_date(date_str, t);
} }
SWITCH_DECLARE(switch_time_t) switch_time_make(switch_time_t sec, int32_t usec) SWITCH_DECLARE(switch_time_t) switch_time_make(switch_time_t sec, int32_t usec)
@ -361,17 +361,17 @@ SWITCH_DECLARE(switch_time_t) switch_time_make(switch_time_t sec, int32_t usec)
SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t ** cond, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t ** cond, switch_memory_pool_t *pool)
{ {
return apr_thread_cond_create(cond, pool); return fspr_thread_cond_create(cond, pool);
} }
SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex) SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex)
{ {
return apr_thread_cond_wait(cond, mutex); return fspr_thread_cond_wait(cond, mutex);
} }
SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, switch_interval_time_t timeout) SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, switch_interval_time_t timeout)
{ {
apr_status_t st = apr_thread_cond_timedwait(cond, mutex, timeout); fspr_status_t st = fspr_thread_cond_timedwait(cond, mutex, timeout);
if (st == APR_TIMEUP) { if (st == APR_TIMEUP) {
st = SWITCH_STATUS_TIMEOUT; st = SWITCH_STATUS_TIMEOUT;
@ -382,17 +382,17 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_
SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t *cond) SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t *cond)
{ {
return apr_thread_cond_signal(cond); return fspr_thread_cond_signal(cond);
} }
SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t *cond) SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t *cond)
{ {
return apr_thread_cond_broadcast(cond); return fspr_thread_cond_broadcast(cond);
} }
SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t *cond) SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t *cond)
{ {
return apr_thread_cond_destroy(cond); return fspr_thread_cond_destroy(cond);
} }
/* file i/o stubs */ /* file i/o stubs */
@ -400,57 +400,57 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t
SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t ** newf, const char *fname, int32_t flag, switch_fileperms_t perm, SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t ** newf, const char *fname, int32_t flag, switch_fileperms_t perm,
switch_memory_pool_t *pool) switch_memory_pool_t *pool)
{ {
return apr_file_open(newf, fname, flag, perm, pool); return fspr_file_open(newf, fname, flag, perm, pool);
} }
SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset) SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset)
{ {
apr_status_t rv; fspr_status_t rv;
apr_off_t off = (apr_off_t) (*offset); fspr_off_t off = (fspr_off_t) (*offset);
rv = apr_file_seek(thefile, where, &off); rv = fspr_file_seek(thefile, where, &off);
*offset = (int64_t) off; *offset = (int64_t) off;
return rv; return rv;
} }
SWITCH_DECLARE(switch_status_t) switch_file_copy(const char *from_path, const char *to_path, switch_fileperms_t perms, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_file_copy(const char *from_path, const char *to_path, switch_fileperms_t perms, switch_memory_pool_t *pool)
{ {
return apr_file_copy(from_path, to_path, perms, pool); return fspr_file_copy(from_path, to_path, perms, pool);
} }
SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t *thefile) SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t *thefile)
{ {
return apr_file_close(thefile); return fspr_file_close(thefile);
} }
SWITCH_DECLARE(switch_status_t) switch_file_trunc(switch_file_t *thefile, int64_t offset) SWITCH_DECLARE(switch_status_t) switch_file_trunc(switch_file_t *thefile, int64_t offset)
{ {
return apr_file_trunc(thefile, offset); return fspr_file_trunc(thefile, offset);
} }
SWITCH_DECLARE(switch_status_t) switch_file_lock(switch_file_t *thefile, int type) SWITCH_DECLARE(switch_status_t) switch_file_lock(switch_file_t *thefile, int type)
{ {
return apr_file_lock(thefile, type); return fspr_file_lock(thefile, type);
} }
SWITCH_DECLARE(switch_status_t) switch_file_rename(const char *from_path, const char *to_path, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_file_rename(const char *from_path, const char *to_path, switch_memory_pool_t *pool)
{ {
return apr_file_rename(from_path, to_path, pool); return fspr_file_rename(from_path, to_path, pool);
} }
SWITCH_DECLARE(switch_status_t) switch_file_remove(const char *path, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_file_remove(const char *path, switch_memory_pool_t *pool)
{ {
return apr_file_remove(path, pool); return fspr_file_remove(path, pool);
} }
SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *buf, switch_size_t *nbytes) SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *buf, switch_size_t *nbytes)
{ {
return apr_file_read(thefile, buf, nbytes); return fspr_file_read(thefile, buf, nbytes);
} }
SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes) SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes)
{ {
return apr_file_write(thefile, buf, nbytes); return fspr_file_write(thefile, buf, nbytes);
} }
SWITCH_DECLARE(int) switch_file_printf(switch_file_t *thefile, const char *format, ...) SWITCH_DECLARE(int) switch_file_printf(switch_file_t *thefile, const char *format, ...)
@ -474,18 +474,18 @@ SWITCH_DECLARE(int) switch_file_printf(switch_file_t *thefile, const char *forma
SWITCH_DECLARE(switch_status_t) switch_file_mktemp(switch_file_t ** thefile, char *templ, int32_t flags, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_file_mktemp(switch_file_t ** thefile, char *templ, int32_t flags, switch_memory_pool_t *pool)
{ {
return apr_file_mktemp(thefile, templ, flags, pool); return fspr_file_mktemp(thefile, templ, flags, pool);
} }
SWITCH_DECLARE(switch_size_t) switch_file_get_size(switch_file_t *thefile) SWITCH_DECLARE(switch_size_t) switch_file_get_size(switch_file_t *thefile)
{ {
struct apr_finfo_t finfo; struct fspr_finfo_t finfo;
return apr_file_info_get(&finfo, APR_FINFO_SIZE, thefile) == SWITCH_STATUS_SUCCESS ? (switch_size_t) finfo.size : 0; return fspr_file_info_get(&finfo, APR_FINFO_SIZE, thefile) == SWITCH_STATUS_SUCCESS ? (switch_size_t) finfo.size : 0;
} }
SWITCH_DECLARE(switch_status_t) switch_directory_exists(const char *dirname, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_directory_exists(const char *dirname, switch_memory_pool_t *pool)
{ {
apr_dir_t *dir_handle; fspr_dir_t *dir_handle;
switch_memory_pool_t *our_pool = NULL; switch_memory_pool_t *our_pool = NULL;
switch_status_t status; switch_status_t status;
@ -494,8 +494,8 @@ SWITCH_DECLARE(switch_status_t) switch_directory_exists(const char *dirname, swi
pool = our_pool; pool = our_pool;
} }
if ((status = apr_dir_open(&dir_handle, dirname, pool)) == APR_SUCCESS) { if ((status = fspr_dir_open(&dir_handle, dirname, pool)) == APR_SUCCESS) {
apr_dir_close(dir_handle); fspr_dir_close(dir_handle);
} }
if (our_pool) { if (our_pool) {
@ -510,7 +510,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename, switch_
int32_t wanted = APR_FINFO_TYPE; int32_t wanted = APR_FINFO_TYPE;
switch_memory_pool_t *our_pool = NULL; switch_memory_pool_t *our_pool = NULL;
switch_status_t status = SWITCH_STATUS_FALSE; switch_status_t status = SWITCH_STATUS_FALSE;
apr_finfo_t info = { 0 }; fspr_finfo_t info = { 0 };
if (zstr(filename)) { if (zstr(filename)) {
return status; return status;
@ -520,7 +520,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename, switch_
switch_core_new_memory_pool(&our_pool); switch_core_new_memory_pool(&our_pool);
} }
apr_stat(&info, filename, wanted, pool ? pool : our_pool); fspr_stat(&info, filename, wanted, pool ? pool : our_pool);
if (info.filetype != APR_NOFILE) { if (info.filetype != APR_NOFILE) {
status = SWITCH_STATUS_SUCCESS; status = SWITCH_STATUS_SUCCESS;
} }
@ -534,17 +534,17 @@ SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename, switch_
SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool)
{ {
return apr_dir_make(path, perm, pool); return fspr_dir_make(path, perm, pool);
} }
SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool)
{ {
return apr_dir_make_recursive(path, perm, pool); return fspr_dir_make_recursive(path, perm, pool);
} }
struct switch_dir { struct switch_dir {
apr_dir_t *dir_handle; fspr_dir_t *dir_handle;
apr_finfo_t finfo; fspr_finfo_t finfo;
}; };
SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t ** new_dir, const char *dirname, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t ** new_dir, const char *dirname, switch_memory_pool_t *pool)
@ -558,7 +558,7 @@ SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t ** new_dir, const c
} }
memset(dir, 0, sizeof(*dir)); memset(dir, 0, sizeof(*dir));
if ((status = apr_dir_open(&(dir->dir_handle), dirname, pool)) == APR_SUCCESS) { if ((status = fspr_dir_open(&(dir->dir_handle), dirname, pool)) == APR_SUCCESS) {
*new_dir = dir; *new_dir = dir;
} else { } else {
free(dir); free(dir);
@ -570,7 +570,7 @@ SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t ** new_dir, const c
SWITCH_DECLARE(switch_status_t) switch_dir_close(switch_dir_t *thedir) SWITCH_DECLARE(switch_status_t) switch_dir_close(switch_dir_t *thedir)
{ {
switch_status_t status = apr_dir_close(thedir->dir_handle); switch_status_t status = fspr_dir_close(thedir->dir_handle);
free(thedir); free(thedir);
return status; return status;
@ -579,12 +579,12 @@ SWITCH_DECLARE(switch_status_t) switch_dir_close(switch_dir_t *thedir)
SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir) SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir)
{ {
const char *name; const char *name;
apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME; fspr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
uint32_t count = 0; uint32_t count = 0;
apr_dir_rewind(thedir->dir_handle); fspr_dir_rewind(thedir->dir_handle);
while (apr_dir_read(&(thedir->finfo), finfo_flags, thedir->dir_handle) == SWITCH_STATUS_SUCCESS) { while (fspr_dir_read(&(thedir->finfo), finfo_flags, thedir->dir_handle) == SWITCH_STATUS_SUCCESS) {
if (thedir->finfo.filetype != APR_REG && thedir->finfo.filetype != APR_LNK) { if (thedir->finfo.filetype != APR_REG && thedir->finfo.filetype != APR_LNK) {
continue; continue;
@ -599,7 +599,7 @@ SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir)
} }
} }
apr_dir_rewind(thedir->dir_handle); fspr_dir_rewind(thedir->dir_handle);
return count; return count;
} }
@ -607,10 +607,10 @@ SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir)
SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *buf, switch_size_t len) SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *buf, switch_size_t len)
{ {
const char *fname = NULL; const char *fname = NULL;
apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME; fspr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
const char *name; const char *name;
while (apr_dir_read(&(thedir->finfo), finfo_flags, thedir->dir_handle) == SWITCH_STATUS_SUCCESS) { while (fspr_dir_read(&(thedir->finfo), finfo_flags, thedir->dir_handle) == SWITCH_STATUS_SUCCESS) {
if (thedir->finfo.filetype != APR_REG && thedir->finfo.filetype != APR_LNK) { if (thedir->finfo.filetype != APR_REG && thedir->finfo.filetype != APR_LNK) {
continue; continue;
@ -634,18 +634,18 @@ SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *bu
/* thread stubs */ /* thread stubs */
#ifndef WIN32 #ifndef WIN32
struct apr_threadattr_t { struct fspr_threadattr_t {
apr_pool_t *pool; fspr_pool_t *pool;
pthread_attr_t attr; pthread_attr_t attr;
int priority; int priority;
}; };
#else #else
/* this needs to be revisited when apr for windows supports thread priority settings */ /* this needs to be revisited when apr for windows supports thread priority settings */
/* search for WIN32 in this file */ /* search for WIN32 in this file */
struct apr_threadattr_t { struct fspr_threadattr_t {
apr_pool_t *pool; fspr_pool_t *pool;
apr_int32_t detach; fspr_int32_t detach;
apr_size_t stacksize; fspr_size_t stacksize;
int priority; int priority;
}; };
#endif #endif
@ -655,7 +655,7 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **
{ {
switch_status_t status; switch_status_t status;
if ((status = apr_threadattr_create(new_attr, pool)) == SWITCH_STATUS_SUCCESS) { if ((status = fspr_threadattr_create(new_attr, pool)) == SWITCH_STATUS_SUCCESS) {
(*new_attr)->priority = SWITCH_PRI_LOW; (*new_attr)->priority = SWITCH_PRI_LOW;
@ -666,12 +666,12 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **
SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on) SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on)
{ {
return apr_threadattr_detach_set(attr, on); return fspr_threadattr_detach_set(attr, on);
} }
SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize) SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize)
{ {
return apr_threadattr_stacksize_set(attr, stacksize); return fspr_threadattr_stacksize_set(attr, stacksize);
} }
SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_set(switch_threadattr_t *attr, switch_thread_priority_t priority) SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_set(switch_threadattr_t *attr, switch_thread_priority_t priority)
@ -688,7 +688,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thre
switch_thread_start_t func, void *data, switch_memory_pool_t *cont) switch_thread_start_t func, void *data, switch_memory_pool_t *cont)
{ {
switch_core_memory_pool_set_data(cont, "_in_thread", TT_KEY); switch_core_memory_pool_set_data(cont, "_in_thread", TT_KEY);
return apr_thread_create(new_thread, attr, func, data, cont); return fspr_thread_create(new_thread, attr, func, data, cont);
} }
SWITCH_DECLARE(switch_interval_time_t) switch_interval_time_from_timeval(struct timeval *tvp) SWITCH_DECLARE(switch_interval_time_t) switch_interval_time_from_timeval(struct timeval *tvp)
@ -700,52 +700,52 @@ SWITCH_DECLARE(switch_interval_time_t) switch_interval_time_from_timeval(struct
SWITCH_DECLARE(switch_status_t) switch_os_sock_get(switch_os_socket_t *thesock, switch_socket_t *sock) SWITCH_DECLARE(switch_status_t) switch_os_sock_get(switch_os_socket_t *thesock, switch_socket_t *sock)
{ {
return apr_os_sock_get(thesock, sock); return fspr_os_sock_get(thesock, sock);
} }
SWITCH_DECLARE(switch_status_t) switch_os_sock_put(switch_socket_t **sock, switch_os_socket_t *thesock, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_os_sock_put(switch_socket_t **sock, switch_os_socket_t *thesock, switch_memory_pool_t *pool)
{ {
return apr_os_sock_put(sock, thesock, pool); return fspr_os_sock_put(sock, thesock, pool);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t ** sa, switch_bool_t remote, switch_socket_t *sock) SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t ** sa, switch_bool_t remote, switch_socket_t *sock)
{ {
return apr_socket_addr_get(sa, (apr_interface_e) remote, sock); return fspr_socket_addr_get(sa, (fspr_interface_e) remote, sock);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock, int family, int type, int protocol, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock, int family, int type, int protocol, switch_memory_pool_t *pool)
{ {
return apr_socket_create(new_sock, family, type, protocol, pool); return fspr_socket_create(new_sock, family, type, protocol, pool);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t *sock, switch_shutdown_how_e how) SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t *sock, switch_shutdown_how_e how)
{ {
return apr_socket_shutdown(sock, (apr_shutdown_how_e) how); return fspr_socket_shutdown(sock, (fspr_shutdown_how_e) how);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t *sock) SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t *sock)
{ {
return apr_socket_close(sock); return fspr_socket_close(sock);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa) SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa)
{ {
return apr_socket_bind(sock, sa); return fspr_socket_bind(sock, sa);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int32_t backlog) SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int32_t backlog)
{ {
return apr_socket_listen(sock, backlog); return fspr_socket_listen(sock, backlog);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock, switch_socket_t *sock, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock, switch_socket_t *sock, switch_memory_pool_t *pool)
{ {
return apr_socket_accept(new_sock, sock, pool); return fspr_socket_accept(new_sock, sock, pool);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa) SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa)
{ {
return apr_socket_connect(sock, sa); return fspr_socket_connect(sock, sa);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const char *buf, switch_size_t *len) SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const char *buf, switch_size_t *len)
@ -756,7 +756,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const
while ((wrote < req && status == SWITCH_STATUS_SUCCESS) || (need == 0 && status == SWITCH_STATUS_BREAK) || status == 730035 || status == 35) { while ((wrote < req && status == SWITCH_STATUS_SUCCESS) || (need == 0 && status == SWITCH_STATUS_BREAK) || status == 730035 || status == 35) {
need = req - wrote; need = req - wrote;
status = apr_socket_send(sock, buf + wrote, &need); status = fspr_socket_send(sock, buf + wrote, &need);
if (status == SWITCH_STATUS_BREAK || status == 730035 || status == 35) { if (status == SWITCH_STATUS_BREAK || status == 730035 || status == 35) {
if (++to_count > 60000) { if (++to_count > 60000) {
status = SWITCH_STATUS_FALSE; status = SWITCH_STATUS_FALSE;
@ -779,7 +779,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send_nonblock(switch_socket_t *soc
return SWITCH_STATUS_GENERR; return SWITCH_STATUS_GENERR;
} }
return apr_socket_send(sock, buf, len); return fspr_socket_send(sock, buf, len);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf, SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf,
@ -788,14 +788,14 @@ SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, swit
if (!where || !buf || !len || !*len) { if (!where || !buf || !len || !*len) {
return SWITCH_STATUS_GENERR; return SWITCH_STATUS_GENERR;
} }
return apr_socket_sendto(sock, where, flags, buf, len); return fspr_socket_sendto(sock, where, flags, buf, len);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len) SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len)
{ {
int r; int r;
r = apr_socket_recv(sock, buf, len); r = fspr_socket_recv(sock, buf, len);
if (r == 35 || r == 730035) { if (r == 35 || r == 730035) {
r = SWITCH_STATUS_BREAK; r = SWITCH_STATUS_BREAK;
@ -809,7 +809,7 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, s
switch_sockaddr_t *new_sa; switch_sockaddr_t *new_sa;
unsigned short family = APR_INET; unsigned short family = APR_INET;
new_sa = apr_pcalloc(pool, sizeof(apr_sockaddr_t)); new_sa = fspr_pcalloc(pool, sizeof(fspr_sockaddr_t));
switch_assert(new_sa); switch_assert(new_sa);
new_sa->pool = pool; new_sa->pool = pool;
@ -828,20 +828,20 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, s
SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname, int32_t family, SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname, int32_t family,
switch_port_t port, int32_t flags, switch_memory_pool_t *pool) switch_port_t port, int32_t flags, switch_memory_pool_t *pool)
{ {
return apr_sockaddr_info_get(sa, hostname, family, port, flags, pool); return fspr_sockaddr_info_get(sa, hostname, family, port, flags, pool);
} }
SWITCH_DECLARE(switch_status_t) switch_sockaddr_new(switch_sockaddr_t ** sa, const char *ip, switch_port_t port, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_sockaddr_new(switch_sockaddr_t ** sa, const char *ip, switch_port_t port, switch_memory_pool_t *pool)
{ {
switch_status_t status = SWITCH_STATUS_SUCCESS; switch_status_t status = SWITCH_STATUS_SUCCESS;
apr_sockaddr_t *new_sa; fspr_sockaddr_t *new_sa;
int family; int family;
if (!sa || !pool || !ip) { if (!sa || !pool || !ip) {
switch_goto_status(SWITCH_STATUS_GENERR, end); switch_goto_status(SWITCH_STATUS_GENERR, end);
} }
new_sa = apr_pcalloc(pool, sizeof(apr_sockaddr_t)); new_sa = fspr_pcalloc(pool, sizeof(fspr_sockaddr_t));
switch_assert(new_sa); switch_assert(new_sa);
new_sa->pool = pool; new_sa->pool = pool;
@ -863,7 +863,7 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_new(switch_sockaddr_t ** sa, con
memcpy(&new_sa->sa, &sa4, sizeof(struct sockaddr_in)); memcpy(&new_sa->sa, &sa4, sizeof(struct sockaddr_in));
} }
new_sa->hostname = apr_pstrdup(pool, ip); new_sa->hostname = fspr_pstrdup(pool, ip);
new_sa->family = family; new_sa->family = family;
new_sa->sa.sin.sin_family = family; new_sa->sa.sin.sin_family = family;
if (port) { if (port) {
@ -915,13 +915,13 @@ SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t *sock, int
#endif #endif
} }
return apr_socket_opt_set(sock, opt, on); return fspr_socket_opt_set(sock, opt, on);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_timeout_get(switch_socket_t *sock, switch_interval_time_t *t) SWITCH_DECLARE(switch_status_t) switch_socket_timeout_get(switch_socket_t *sock, switch_interval_time_t *t)
{ {
apr_interval_time_t at = 0; fspr_interval_time_t at = 0;
switch_status_t status = apr_socket_timeout_get(sock, &at); switch_status_t status = fspr_socket_timeout_get(sock, &at);
*t = at; *t = at;
return status; return status;
@ -929,37 +929,37 @@ SWITCH_DECLARE(switch_status_t) switch_socket_timeout_get(switch_socket_t *sock,
SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t *sock, switch_interval_time_t t) SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t *sock, switch_interval_time_t t)
{ {
return apr_socket_timeout_set(sock, t); return fspr_socket_timeout_set(sock, t);
} }
SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t *sa) SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t *sa)
{ {
return apr_sockaddr_ip_get(addr, sa); return fspr_sockaddr_ip_get(addr, sa);
} }
SWITCH_DECLARE(int) switch_sockaddr_equal(const switch_sockaddr_t *sa1, const switch_sockaddr_t *sa2) SWITCH_DECLARE(int) switch_sockaddr_equal(const switch_sockaddr_t *sa1, const switch_sockaddr_t *sa2)
{ {
return apr_sockaddr_equal(sa1, sa2); return fspr_sockaddr_equal(sa1, sa2);
} }
SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source) SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source)
{ {
return apr_mcast_join(sock, join, iface, source); return fspr_mcast_join(sock, join, iface, source);
} }
SWITCH_DECLARE(switch_status_t) switch_mcast_hops(switch_socket_t *sock, uint8_t ttl) SWITCH_DECLARE(switch_status_t) switch_mcast_hops(switch_socket_t *sock, uint8_t ttl)
{ {
return apr_mcast_hops(sock, ttl); return fspr_mcast_hops(sock, ttl);
} }
SWITCH_DECLARE(switch_status_t) switch_mcast_loopback(switch_socket_t *sock, uint8_t opt) SWITCH_DECLARE(switch_status_t) switch_mcast_loopback(switch_socket_t *sock, uint8_t opt)
{ {
return apr_mcast_loopback(sock, opt); return fspr_mcast_loopback(sock, opt);
} }
SWITCH_DECLARE(switch_status_t) switch_mcast_interface(switch_socket_t *sock, switch_sockaddr_t *iface) SWITCH_DECLARE(switch_status_t) switch_mcast_interface(switch_socket_t *sock, switch_sockaddr_t *iface)
{ {
return apr_mcast_interface(sock, iface); return fspr_mcast_interface(sock, iface);
} }
@ -984,7 +984,7 @@ SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switc
SWITCH_DECLARE(int) switch_socket_fd_get(switch_socket_t *sock) SWITCH_DECLARE(int) switch_socket_fd_get(switch_socket_t *sock)
{ {
return apr_socket_fd_get(sock); return fspr_socket_fd_get(sock);
} }
SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa) SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa)
@ -999,19 +999,19 @@ SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t *sa)
SWITCH_DECLARE(switch_status_t) switch_getnameinfo(char **hostname, switch_sockaddr_t *sa, int32_t flags) SWITCH_DECLARE(switch_status_t) switch_getnameinfo(char **hostname, switch_sockaddr_t *sa, int32_t flags)
{ {
return apr_getnameinfo(hostname, sa, flags); return fspr_getnameinfo(hostname, sa, flags);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_atmark(switch_socket_t *sock, int *atmark) SWITCH_DECLARE(switch_status_t) switch_socket_atmark(switch_socket_t *sock, int *atmark)
{ {
return apr_socket_atmark(sock, atmark); return fspr_socket_atmark(sock, atmark);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len) SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len)
{ {
int r = SWITCH_STATUS_GENERR; int r = SWITCH_STATUS_GENERR;
if (from && sock && (r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) { if (from && sock && (r = fspr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) {
from->port = ntohs(from->sa.sin.sin_port); from->port = ntohs(from->sa.sin.sin_port);
/* from->ipaddr_ptr = &(from->sa.sin.sin_addr); /* from->ipaddr_ptr = &(from->sa.sin.sin_addr);
* from->ipaddr_ptr = inet_ntoa(from->sa.sin.sin_addr); * from->ipaddr_ptr = inet_ntoa(from->sa.sin.sin_addr);
@ -1029,7 +1029,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from,
SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollset, uint32_t size, switch_memory_pool_t *pool, uint32_t flags) SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollset, uint32_t size, switch_memory_pool_t *pool, uint32_t flags)
{ {
return apr_pollset_create(pollset, size, pool, flags); return fspr_pollset_create(pollset, size, pool, flags);
} }
SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, const switch_pollfd_t *descriptor) SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, const switch_pollfd_t *descriptor)
@ -1038,7 +1038,7 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, co
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
return apr_pollset_add((apr_pollset_t *) pollset, (const apr_pollfd_t *) descriptor); return fspr_pollset_add((fspr_pollset_t *) pollset, (const fspr_pollfd_t *) descriptor);
} }
SWITCH_DECLARE(switch_status_t) switch_pollset_remove(switch_pollset_t *pollset, const switch_pollfd_t *descriptor) SWITCH_DECLARE(switch_status_t) switch_pollset_remove(switch_pollset_t *pollset, const switch_pollfd_t *descriptor)
@ -1047,7 +1047,7 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_remove(switch_pollset_t *pollset,
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
return apr_pollset_remove((apr_pollset_t *) pollset, (const apr_pollfd_t *) descriptor); return fspr_pollset_remove((fspr_pollset_t *) pollset, (const fspr_pollfd_t *) descriptor);
} }
SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **pollfd, switch_socket_t *sock, int16_t flags, void *client_data, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **pollfd, switch_socket_t *sock, int16_t flags, void *client_data, switch_memory_pool_t *pool)
@ -1056,7 +1056,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **po
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
if ((*pollfd = (switch_pollfd_t*)apr_palloc(pool, sizeof(switch_pollfd_t))) == 0) { if ((*pollfd = (switch_pollfd_t*)fspr_palloc(pool, sizeof(switch_pollfd_t))) == 0) {
return SWITCH_STATUS_MEMERR; return SWITCH_STATUS_MEMERR;
} }
@ -1073,10 +1073,10 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **po
SWITCH_DECLARE(switch_status_t) switch_pollset_poll(switch_pollset_t *pollset, switch_interval_time_t timeout, int32_t *num, const switch_pollfd_t **descriptors) SWITCH_DECLARE(switch_status_t) switch_pollset_poll(switch_pollset_t *pollset, switch_interval_time_t timeout, int32_t *num, const switch_pollfd_t **descriptors)
{ {
apr_status_t st = SWITCH_STATUS_FALSE; fspr_status_t st = SWITCH_STATUS_FALSE;
if (pollset) { if (pollset) {
st = apr_pollset_poll((apr_pollset_t *) pollset, timeout, num, (const apr_pollfd_t **) descriptors); st = fspr_pollset_poll((fspr_pollset_t *) pollset, timeout, num, (const fspr_pollfd_t **) descriptors);
if (st == APR_TIMEUP) { if (st == APR_TIMEUP) {
st = SWITCH_STATUS_TIMEOUT; st = SWITCH_STATUS_TIMEOUT;
@ -1088,10 +1088,10 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_poll(switch_pollset_t *pollset, s
SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout) SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout)
{ {
apr_status_t st = SWITCH_STATUS_FALSE; fspr_status_t st = SWITCH_STATUS_FALSE;
if (aprset) { if (aprset) {
st = apr_poll((apr_pollfd_t *) aprset, numsock, nsds, timeout); st = fspr_poll((fspr_pollfd_t *) aprset, numsock, nsds, timeout);
if (numsock == 1 && ((aprset[0].rtnevents & APR_POLLERR) || (aprset[0].rtnevents & APR_POLLHUP) || (aprset[0].rtnevents & APR_POLLNVAL))) { if (numsock == 1 && ((aprset[0].rtnevents & APR_POLLERR) || (aprset[0].rtnevents & APR_POLLHUP) || (aprset[0].rtnevents & APR_POLLNVAL))) {
st = SWITCH_STATUS_GENERR; st = SWITCH_STATUS_GENERR;
@ -1228,7 +1228,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_pop_timeout(switch_queue_t *queue,
SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *data) SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *data)
{ {
apr_status_t s; fspr_status_t s;
do { do {
s = switch_apr_queue_push(queue, data); s = switch_apr_queue_push(queue, data);
@ -1254,7 +1254,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_term(switch_queue_t *queue)
SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void *data) SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void *data)
{ {
apr_status_t s; fspr_status_t s;
do { do {
s = switch_apr_queue_trypush(queue, data); s = switch_apr_queue_trypush(queue, data);
@ -1301,7 +1301,7 @@ SWITCH_DECLARE(int) switch_vasprintf(char **ret, const char *fmt, va_list ap)
SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t ** result, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t ** result, switch_memory_pool_t *pool)
{ {
return apr_match_glob(pattern, (apr_array_header_t **) result, pool); return fspr_match_glob(pattern, (fspr_array_header_t **) result, pool);
} }
/** /**
@ -1312,7 +1312,7 @@ SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_ar
*/ */
SWITCH_DECLARE(switch_status_t) switch_file_pipe_create(switch_file_t ** in, switch_file_t ** out, switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_file_pipe_create(switch_file_t ** in, switch_file_t ** out, switch_memory_pool_t *pool)
{ {
return apr_file_pipe_create((apr_file_t **) in, (apr_file_t **) out, pool); return fspr_file_pipe_create((fspr_file_t **) in, (fspr_file_t **) out, pool);
} }
/** /**
@ -1322,7 +1322,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_pipe_create(switch_file_t ** in, swi
*/ */
SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_get(switch_file_t *thepipe, switch_interval_time_t *timeout) SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_get(switch_file_t *thepipe, switch_interval_time_t *timeout)
{ {
return apr_file_pipe_timeout_get((apr_file_t *) thepipe, (apr_interval_time_t *) timeout); return fspr_file_pipe_timeout_get((fspr_file_t *) thepipe, (fspr_interval_time_t *) timeout);
} }
/** /**
@ -1333,7 +1333,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_get(switch_file_t *thep
*/ */
SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_set(switch_file_t *thepipe, switch_interval_time_t timeout) SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_set(switch_file_t *thepipe, switch_interval_time_t timeout)
{ {
return apr_file_pipe_timeout_set((apr_file_t *) thepipe, (apr_interval_time_t) timeout); return fspr_file_pipe_timeout_set((fspr_file_t *) thepipe, (fspr_interval_time_t) timeout);
} }
@ -1344,7 +1344,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_set(switch_file_t *thep
*/ */
SWITCH_DECLARE(switch_status_t) switch_thread_exit(switch_thread_t *thd, switch_status_t retval) SWITCH_DECLARE(switch_status_t) switch_thread_exit(switch_thread_t *thd, switch_status_t retval)
{ {
return apr_thread_exit((apr_thread_t *) thd, retval); return fspr_thread_exit((fspr_thread_t *) thd, retval);
} }
/** /**
@ -1359,63 +1359,63 @@ SWITCH_DECLARE(switch_status_t) switch_thread_join(switch_status_t *retval, swit
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
return apr_thread_join((apr_status_t *) retval, (apr_thread_t *) thd); return fspr_thread_join((fspr_status_t *) retval, (fspr_thread_t *) thd);
} }
SWITCH_DECLARE(switch_status_t) switch_atomic_init(switch_memory_pool_t *pool) SWITCH_DECLARE(switch_status_t) switch_atomic_init(switch_memory_pool_t *pool)
{ {
return apr_atomic_init((apr_pool_t *) pool); return fspr_atomic_init((fspr_pool_t *) pool);
} }
SWITCH_DECLARE(uint32_t) switch_atomic_read(volatile switch_atomic_t *mem) SWITCH_DECLARE(uint32_t) switch_atomic_read(volatile switch_atomic_t *mem)
{ {
#ifdef apr_atomic_t #ifdef fspr_atomic_t
return apr_atomic_read((apr_atomic_t *)mem); return fspr_atomic_read((fspr_atomic_t *)mem);
#else #else
return apr_atomic_read32((apr_uint32_t *)mem); return fspr_atomic_read32((fspr_uint32_t *)mem);
#endif #endif
} }
SWITCH_DECLARE(void) switch_atomic_set(volatile switch_atomic_t *mem, uint32_t val) SWITCH_DECLARE(void) switch_atomic_set(volatile switch_atomic_t *mem, uint32_t val)
{ {
#ifdef apr_atomic_t #ifdef fspr_atomic_t
apr_atomic_set((apr_atomic_t *)mem, val); fspr_atomic_set((fspr_atomic_t *)mem, val);
#else #else
apr_atomic_set32((apr_uint32_t *)mem, val); fspr_atomic_set32((fspr_uint32_t *)mem, val);
#endif #endif
} }
SWITCH_DECLARE(void) switch_atomic_add(volatile switch_atomic_t *mem, uint32_t val) SWITCH_DECLARE(void) switch_atomic_add(volatile switch_atomic_t *mem, uint32_t val)
{ {
#ifdef apr_atomic_t #ifdef fspr_atomic_t
apr_atomic_add((apr_atomic_t *)mem, val); fspr_atomic_add((fspr_atomic_t *)mem, val);
#else #else
apr_atomic_add32((apr_uint32_t *)mem, val); fspr_atomic_add32((fspr_uint32_t *)mem, val);
#endif #endif
} }
SWITCH_DECLARE(void) switch_atomic_inc(volatile switch_atomic_t *mem) SWITCH_DECLARE(void) switch_atomic_inc(volatile switch_atomic_t *mem)
{ {
#ifdef apr_atomic_t #ifdef fspr_atomic_t
apr_atomic_inc((apr_atomic_t *)mem); fspr_atomic_inc((fspr_atomic_t *)mem);
#else #else
apr_atomic_inc32((apr_uint32_t *)mem); fspr_atomic_inc32((fspr_uint32_t *)mem);
#endif #endif
} }
SWITCH_DECLARE(int) switch_atomic_dec(volatile switch_atomic_t *mem) SWITCH_DECLARE(int) switch_atomic_dec(volatile switch_atomic_t *mem)
{ {
#ifdef apr_atomic_t #ifdef fspr_atomic_t
return apr_atomic_dec((apr_atomic_t *)mem); return fspr_atomic_dec((fspr_atomic_t *)mem);
#else #else
return apr_atomic_dec32((apr_uint32_t *)mem); return fspr_atomic_dec32((fspr_uint32_t *)mem);
#endif #endif
} }
SWITCH_DECLARE(char *) switch_strerror(switch_status_t statcode, char *buf, switch_size_t bufsize) SWITCH_DECLARE(char *) switch_strerror(switch_status_t statcode, char *buf, switch_size_t bufsize)
{ {
return apr_strerror(statcode, buf, bufsize); return fspr_strerror(statcode, buf, bufsize);
} }
/* For Emacs: /* For Emacs:

View File

@ -14,10 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
#include <apr.h> #include <fspr.h>
#include <apr_thread_proc.h> #include <fspr_thread_mutex.h>
#include <apr_thread_mutex.h> #include <fspr_thread_cond.h>
#include <apr_thread_cond.h>
/* /*
* define this to get debug messages * define this to get debug messages
@ -33,9 +32,9 @@ struct switch_apr_queue_t {
unsigned int bounds;/**< max size of queue */ unsigned int bounds;/**< max size of queue */
unsigned int full_waiters; unsigned int full_waiters;
unsigned int empty_waiters; unsigned int empty_waiters;
apr_thread_mutex_t *one_big_mutex; fspr_thread_mutex_t *one_big_mutex;
apr_thread_cond_t *not_empty; fspr_thread_cond_t *not_empty;
apr_thread_cond_t *not_full; fspr_thread_cond_t *not_full;
int terminated; int terminated;
}; };
@ -69,15 +68,15 @@ static void Q_DBG(char*msg, switch_apr_queue_t *q) {
* Callback routine that is called to destroy this * Callback routine that is called to destroy this
* switch_apr_queue_t when its pool is destroyed. * switch_apr_queue_t when its pool is destroyed.
*/ */
static apr_status_t queue_destroy(void *data) static fspr_status_t queue_destroy(void *data)
{ {
switch_apr_queue_t *queue = data; switch_apr_queue_t *queue = data;
/* Ignore errors here, we can't do anything about them anyway. */ /* Ignore errors here, we can't do anything about them anyway. */
apr_thread_cond_destroy(queue->not_empty); fspr_thread_cond_destroy(queue->not_empty);
apr_thread_cond_destroy(queue->not_full); fspr_thread_cond_destroy(queue->not_full);
apr_thread_mutex_destroy(queue->one_big_mutex); fspr_thread_mutex_destroy(queue->one_big_mutex);
return APR_SUCCESS; return APR_SUCCESS;
} }
@ -85,33 +84,33 @@ static apr_status_t queue_destroy(void *data)
/** /**
* Initialize the switch_apr_queue_t. * Initialize the switch_apr_queue_t.
*/ */
apr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_capacity, apr_pool_t *a) fspr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_capacity, fspr_pool_t *a)
{ {
apr_status_t rv; fspr_status_t rv;
switch_apr_queue_t *queue; switch_apr_queue_t *queue;
queue = apr_palloc(a, sizeof(switch_apr_queue_t)); queue = fspr_palloc(a, sizeof(switch_apr_queue_t));
*q = queue; *q = queue;
/* nested doesn't work ;( */ /* nested doesn't work ;( */
rv = apr_thread_mutex_create(&queue->one_big_mutex, rv = fspr_thread_mutex_create(&queue->one_big_mutex,
APR_THREAD_MUTEX_UNNESTED, APR_THREAD_MUTEX_UNNESTED,
a); a);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
return rv; return rv;
} }
rv = apr_thread_cond_create(&queue->not_empty, a); rv = fspr_thread_cond_create(&queue->not_empty, a);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
return rv; return rv;
} }
rv = apr_thread_cond_create(&queue->not_full, a); rv = fspr_thread_cond_create(&queue->not_full, a);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
return rv; return rv;
} }
/* Set all the data in the queue to NULL */ /* Set all the data in the queue to NULL */
queue->data = apr_palloc(a, queue_capacity * sizeof(void*)); queue->data = fspr_palloc(a, queue_capacity * sizeof(void*));
if (!queue->data) return APR_ENOMEM; if (!queue->data) return APR_ENOMEM;
memset(queue->data, 0, queue_capacity * sizeof(void*)); memset(queue->data, 0, queue_capacity * sizeof(void*));
queue->bounds = queue_capacity; queue->bounds = queue_capacity;
@ -122,7 +121,7 @@ apr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_
queue->full_waiters = 0; queue->full_waiters = 0;
queue->empty_waiters = 0; queue->empty_waiters = 0;
apr_pool_cleanup_register(a, queue, queue_destroy, apr_pool_cleanup_null); fspr_pool_cleanup_register(a, queue, queue_destroy, fspr_pool_cleanup_null);
return APR_SUCCESS; return APR_SUCCESS;
} }
@ -132,15 +131,15 @@ apr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_
* the push operation has completed, it signals other threads waiting * the push operation has completed, it signals other threads waiting
* in apr_queue_pop() that they may continue consuming sockets. * in apr_queue_pop() that they may continue consuming sockets.
*/ */
apr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data) fspr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data)
{ {
apr_status_t rv; fspr_status_t rv;
if (queue->terminated) { if (queue->terminated) {
return APR_EOF; /* no more elements ever again */ return APR_EOF; /* no more elements ever again */
} }
rv = apr_thread_mutex_lock(queue->one_big_mutex); rv = fspr_thread_mutex_lock(queue->one_big_mutex);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
return rv; return rv;
} }
@ -148,17 +147,17 @@ apr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data)
if (apr_queue_full(queue)) { if (apr_queue_full(queue)) {
if (!queue->terminated) { if (!queue->terminated) {
queue->full_waiters++; queue->full_waiters++;
rv = apr_thread_cond_wait(queue->not_full, queue->one_big_mutex); rv = fspr_thread_cond_wait(queue->not_full, queue->one_big_mutex);
queue->full_waiters--; queue->full_waiters--;
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
apr_thread_mutex_unlock(queue->one_big_mutex); fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
} }
/* If we wake up and it's still empty, then we were interrupted */ /* If we wake up and it's still empty, then we were interrupted */
if (apr_queue_full(queue)) { if (apr_queue_full(queue)) {
Q_DBG("queue full (intr)", queue); Q_DBG("queue full (intr)", queue);
rv = apr_thread_mutex_unlock(queue->one_big_mutex); rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
return rv; return rv;
} }
@ -177,14 +176,14 @@ apr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data)
if (queue->empty_waiters) { if (queue->empty_waiters) {
Q_DBG("sig !empty", queue); Q_DBG("sig !empty", queue);
rv = apr_thread_cond_signal(queue->not_empty); rv = fspr_thread_cond_signal(queue->not_empty);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
apr_thread_mutex_unlock(queue->one_big_mutex); fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
} }
rv = apr_thread_mutex_unlock(queue->one_big_mutex); rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
@ -193,21 +192,21 @@ apr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data)
* the push operation has completed, it signals other threads waiting * the push operation has completed, it signals other threads waiting
* in apr_queue_pop() that they may continue consuming sockets. * in apr_queue_pop() that they may continue consuming sockets.
*/ */
apr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data) fspr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data)
{ {
apr_status_t rv; fspr_status_t rv;
if (queue->terminated) { if (queue->terminated) {
return APR_EOF; /* no more elements ever again */ return APR_EOF; /* no more elements ever again */
} }
rv = apr_thread_mutex_lock(queue->one_big_mutex); rv = fspr_thread_mutex_lock(queue->one_big_mutex);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
return rv; return rv;
} }
if (apr_queue_full(queue)) { if (apr_queue_full(queue)) {
apr_thread_mutex_unlock(queue->one_big_mutex); fspr_thread_mutex_unlock(queue->one_big_mutex);
return APR_EAGAIN; return APR_EAGAIN;
} }
@ -217,14 +216,14 @@ apr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data)
if (queue->empty_waiters) { if (queue->empty_waiters) {
Q_DBG("sig !empty", queue); Q_DBG("sig !empty", queue);
rv = apr_thread_cond_signal(queue->not_empty); rv = fspr_thread_cond_signal(queue->not_empty);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
apr_thread_mutex_unlock(queue->one_big_mutex); fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
} }
rv = apr_thread_mutex_unlock(queue->one_big_mutex); rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
@ -241,15 +240,15 @@ unsigned int switch_apr_queue_size(switch_apr_queue_t *queue) {
* Once retrieved, the item is placed into the address specified by * Once retrieved, the item is placed into the address specified by
* 'data'. * 'data'.
*/ */
apr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data) fspr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data)
{ {
apr_status_t rv; fspr_status_t rv;
if (queue->terminated) { if (queue->terminated) {
return APR_EOF; /* no more elements ever again */ return APR_EOF; /* no more elements ever again */
} }
rv = apr_thread_mutex_lock(queue->one_big_mutex); rv = fspr_thread_mutex_lock(queue->one_big_mutex);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
return rv; return rv;
} }
@ -258,17 +257,17 @@ apr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data)
if (apr_queue_empty(queue)) { if (apr_queue_empty(queue)) {
if (!queue->terminated) { if (!queue->terminated) {
queue->empty_waiters++; queue->empty_waiters++;
rv = apr_thread_cond_wait(queue->not_empty, queue->one_big_mutex); rv = fspr_thread_cond_wait(queue->not_empty, queue->one_big_mutex);
queue->empty_waiters--; queue->empty_waiters--;
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
apr_thread_mutex_unlock(queue->one_big_mutex); fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
} }
/* If we wake up and it's still empty, then we were interrupted */ /* If we wake up and it's still empty, then we were interrupted */
if (apr_queue_empty(queue)) { if (apr_queue_empty(queue)) {
Q_DBG("queue empty (intr)", queue); Q_DBG("queue empty (intr)", queue);
rv = apr_thread_mutex_unlock(queue->one_big_mutex); rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
return rv; return rv;
} }
@ -287,14 +286,14 @@ apr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data)
queue->out = (queue->out + 1) % queue->bounds; queue->out = (queue->out + 1) % queue->bounds;
if (queue->full_waiters) { if (queue->full_waiters) {
Q_DBG("signal !full", queue); Q_DBG("signal !full", queue);
rv = apr_thread_cond_signal(queue->not_full); rv = fspr_thread_cond_signal(queue->not_full);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
apr_thread_mutex_unlock(queue->one_big_mutex); fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
} }
rv = apr_thread_mutex_unlock(queue->one_big_mutex); rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
@ -304,15 +303,15 @@ apr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data)
* until timeout is elapsed. Once retrieved, the item is placed into * until timeout is elapsed. Once retrieved, the item is placed into
* the address specified by'data'. * the address specified by'data'.
*/ */
apr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data, apr_interval_time_t timeout) fspr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data, fspr_interval_time_t timeout)
{ {
apr_status_t rv; fspr_status_t rv;
if (queue->terminated) { if (queue->terminated) {
return APR_EOF; /* no more elements ever again */ return APR_EOF; /* no more elements ever again */
} }
rv = apr_thread_mutex_lock(queue->one_big_mutex); rv = fspr_thread_mutex_lock(queue->one_big_mutex);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
return rv; return rv;
} }
@ -321,18 +320,18 @@ apr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data
if (apr_queue_empty(queue)) { if (apr_queue_empty(queue)) {
if (!queue->terminated) { if (!queue->terminated) {
queue->empty_waiters++; queue->empty_waiters++;
rv = apr_thread_cond_timedwait(queue->not_empty, queue->one_big_mutex, timeout); rv = fspr_thread_cond_timedwait(queue->not_empty, queue->one_big_mutex, timeout);
queue->empty_waiters--; queue->empty_waiters--;
/* In the event of a timemout, APR_TIMEUP will be returned */ /* In the event of a timemout, APR_TIMEUP will be returned */
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
apr_thread_mutex_unlock(queue->one_big_mutex); fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
} }
/* If we wake up and it's still empty, then we were interrupted */ /* If we wake up and it's still empty, then we were interrupted */
if (apr_queue_empty(queue)) { if (apr_queue_empty(queue)) {
Q_DBG("queue empty (intr)", queue); Q_DBG("queue empty (intr)", queue);
rv = apr_thread_mutex_unlock(queue->one_big_mutex); rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
return rv; return rv;
} }
@ -351,14 +350,14 @@ apr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data
queue->out = (queue->out + 1) % queue->bounds; queue->out = (queue->out + 1) % queue->bounds;
if (queue->full_waiters) { if (queue->full_waiters) {
Q_DBG("signal !full", queue); Q_DBG("signal !full", queue);
rv = apr_thread_cond_signal(queue->not_full); rv = fspr_thread_cond_signal(queue->not_full);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
apr_thread_mutex_unlock(queue->one_big_mutex); fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
} }
rv = apr_thread_mutex_unlock(queue->one_big_mutex); rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
@ -368,21 +367,21 @@ apr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data
* items available, return APR_EAGAIN. Once retrieved, * items available, return APR_EAGAIN. Once retrieved,
* the item is placed into the address specified by 'data'. * the item is placed into the address specified by 'data'.
*/ */
apr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data) fspr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data)
{ {
apr_status_t rv; fspr_status_t rv;
if (queue->terminated) { if (queue->terminated) {
return APR_EOF; /* no more elements ever again */ return APR_EOF; /* no more elements ever again */
} }
rv = apr_thread_mutex_lock(queue->one_big_mutex); rv = fspr_thread_mutex_lock(queue->one_big_mutex);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
return rv; return rv;
} }
if (apr_queue_empty(queue)) { if (apr_queue_empty(queue)) {
apr_thread_mutex_unlock(queue->one_big_mutex); fspr_thread_mutex_unlock(queue->one_big_mutex);
return APR_EAGAIN; return APR_EAGAIN;
} }
@ -392,39 +391,39 @@ apr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data)
queue->out = (queue->out + 1) % queue->bounds; queue->out = (queue->out + 1) % queue->bounds;
if (queue->full_waiters) { if (queue->full_waiters) {
Q_DBG("signal !full", queue); Q_DBG("signal !full", queue);
rv = apr_thread_cond_signal(queue->not_full); rv = fspr_thread_cond_signal(queue->not_full);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
apr_thread_mutex_unlock(queue->one_big_mutex); fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
} }
rv = apr_thread_mutex_unlock(queue->one_big_mutex); rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
return rv; return rv;
} }
apr_status_t switch_apr_queue_interrupt_all(switch_apr_queue_t *queue) fspr_status_t switch_apr_queue_interrupt_all(switch_apr_queue_t *queue)
{ {
apr_status_t rv; fspr_status_t rv;
Q_DBG("intr all", queue); Q_DBG("intr all", queue);
if ((rv = apr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) { if ((rv = fspr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
return rv; return rv;
} }
apr_thread_cond_broadcast(queue->not_empty); fspr_thread_cond_broadcast(queue->not_empty);
apr_thread_cond_broadcast(queue->not_full); fspr_thread_cond_broadcast(queue->not_full);
if ((rv = apr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) { if ((rv = fspr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) {
return rv; return rv;
} }
return APR_SUCCESS; return APR_SUCCESS;
} }
apr_status_t switch_apr_queue_term(switch_apr_queue_t *queue) fspr_status_t switch_apr_queue_term(switch_apr_queue_t *queue)
{ {
apr_status_t rv; fspr_status_t rv;
if ((rv = apr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) { if ((rv = fspr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
return rv; return rv;
} }
@ -433,7 +432,7 @@ apr_status_t switch_apr_queue_term(switch_apr_queue_t *queue)
* would-be popper checks it but right before they block * would-be popper checks it but right before they block
*/ */
queue->terminated = 1; queue->terminated = 1;
if ((rv = apr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) { if ((rv = fspr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) {
return rv; return rv;
} }
return switch_apr_queue_interrupt_all(queue); return switch_apr_queue_interrupt_all(queue);

View File

@ -1908,7 +1908,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
} }
/* INIT APR and Create the pool context */ /* INIT APR and Create the pool context */
if (apr_initialize() != SWITCH_STATUS_SUCCESS) { if (fspr_initialize() != SWITCH_STATUS_SUCCESS) {
*err = "FATAL ERROR! Could not initialize APR\n"; *err = "FATAL ERROR! Could not initialize APR\n";
return SWITCH_STATUS_MEMERR; return SWITCH_STATUS_MEMERR;
} }
@ -2003,7 +2003,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) { if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) {
/* allow missing configuration if MINIMAL */ /* allow missing configuration if MINIMAL */
if (!(flags & SCF_MINIMAL)) { if (!(flags & SCF_MINIMAL)) {
apr_terminate(); fspr_terminate();
return SWITCH_STATUS_MEMERR; return SWITCH_STATUS_MEMERR;
} }
} }
@ -3160,8 +3160,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
switch_core_media_deinit(); switch_core_media_deinit();
if (runtime.memory_pool) { if (runtime.memory_pool) {
apr_pool_destroy(runtime.memory_pool); fspr_pool_destroy(runtime.memory_pool);
apr_terminate(); fspr_terminate();
} }
sqlite3_shutdown(); sqlite3_shutdown();

View File

@ -86,13 +86,13 @@ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(switch_core_session_t *
#ifdef DEBUG_ALLOC #ifdef DEBUG_ALLOC
if (memory > DEBUG_ALLOC_CUTOFF) if (memory > DEBUG_ALLOC_CUTOFF)
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p %p Session Allocate %s %d\n", switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p %p Session Allocate %s %d\n",
(void *) session->pool, (void *) session, apr_pool_tag(session->pool, NULL), (int) memory); (void *) session->pool, (void *) session, fspr_pool_tag(session->pool, NULL), (int) memory);
#endif #endif
#if APR_POOL_DEBUG #if APR_POOL_DEBUG
ptr = apr_palloc_debug(session->pool, memory, func); ptr = fspr_palloc_debug(session->pool, memory, func);
#else #else
ptr = apr_palloc(session->pool, memory); ptr = fspr_palloc(session->pool, memory);
#endif #endif
switch_assert(ptr != NULL); switch_assert(ptr != NULL);
@ -123,10 +123,10 @@ SWITCH_DECLARE(void *) switch_core_perform_permanent_alloc(switch_size_t memory,
#ifdef DEBUG_ALLOC #ifdef DEBUG_ALLOC
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Perm Allocate %s %d\n", switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Perm Allocate %s %d\n",
(void *)memory_manager.memory_pool, apr_pool_tag(memory_manager.memory_pool, NULL), (int) memory); (void *)memory_manager.memory_pool, fspr_pool_tag(memory_manager.memory_pool, NULL), (int) memory);
#endif #endif
ptr = apr_palloc(memory_manager.memory_pool, memory); ptr = fspr_palloc(memory_manager.memory_pool, memory);
switch_assert(ptr != NULL); switch_assert(ptr != NULL);
memset(ptr, 0, memory); memset(ptr, 0, memory);
@ -160,12 +160,12 @@ SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(const char *todup, c
#endif #endif
len = strlen(todup) + 1; len = strlen(todup) + 1;
duped = apr_pstrmemdup(memory_manager.memory_pool, todup, len); duped = fspr_pstrmemdup(memory_manager.memory_pool, todup, len);
switch_assert(duped != NULL); switch_assert(duped != NULL);
#ifdef DEBUG_ALLOC #ifdef DEBUG_ALLOC
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Perm Allocate %s %d\n", switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Perm Allocate %s %d\n",
(void *) memory_manager.memory_pool, apr_pool_tag(memory_manager.memory_pool, NULL), (int) len); (void *) memory_manager.memory_pool, fspr_pool_tag(memory_manager.memory_pool, NULL), (int) len);
#endif #endif
#ifdef LOCK_MORE #ifdef LOCK_MORE
@ -206,7 +206,7 @@ SWITCH_DECLARE(char *) switch_core_vsprintf(switch_memory_pool_t *pool, const ch
#endif #endif
#endif #endif
result = apr_pvsprintf(pool, fmt, ap); result = fspr_pvsprintf(pool, fmt, ap);
switch_assert(result != NULL); switch_assert(result != NULL);
#ifdef LOCK_MORE #ifdef LOCK_MORE
@ -258,10 +258,10 @@ SWITCH_DECLARE(char *) switch_core_perform_session_strdup(switch_core_session_t
len = strlen(todup); len = strlen(todup);
if (len > DEBUG_ALLOC_CUTOFF) if (len > DEBUG_ALLOC_CUTOFF)
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p %p Sess Strdup Allocate %s %ld\n", switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p %p Sess Strdup Allocate %s %ld\n",
(void *) session->pool, (void *)session, apr_pool_tag(session->pool, NULL), strlen(todup)); (void *) session->pool, (void *)session, fspr_pool_tag(session->pool, NULL), strlen(todup));
#endif #endif
duped = apr_pstrdup(session->pool, todup); duped = fspr_pstrdup(session->pool, todup);
switch_assert(duped != NULL); switch_assert(duped != NULL);
#ifdef LOCK_MORE #ifdef LOCK_MORE
@ -299,10 +299,10 @@ SWITCH_DECLARE(char *) switch_core_perform_strndup(switch_memory_pool_t *pool, c
#ifdef DEBUG_ALLOC #ifdef DEBUG_ALLOC
if (len > DEBUG_ALLOC_CUTOFF) if (len > DEBUG_ALLOC_CUTOFF)
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Core Strdup Allocate %s %d\n", switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Core Strdup Allocate %s %d\n",
(void *) pool, apr_pool_tag(pool, NULL), (int)len); (void *) pool, fspr_pool_tag(pool, NULL), (int)len);
#endif #endif
duped = apr_pstrmemdup(pool, todup, len); duped = fspr_pstrmemdup(pool, todup, len);
switch_assert(duped != NULL); switch_assert(duped != NULL);
#ifdef LOCK_MORE #ifdef LOCK_MORE
@ -316,58 +316,58 @@ SWITCH_DECLARE(char *) switch_core_perform_strndup(switch_memory_pool_t *pool, c
SWITCH_DECLARE(void) switch_core_memory_pool_set_data(switch_memory_pool_t *pool, const char *key, void *data) SWITCH_DECLARE(void) switch_core_memory_pool_set_data(switch_memory_pool_t *pool, const char *key, void *data)
{ {
apr_pool_userdata_set(data, key, NULL, pool); fspr_pool_userdata_set(data, key, NULL, pool);
} }
SWITCH_DECLARE(void *) switch_core_memory_pool_get_data(switch_memory_pool_t *pool, const char *key) SWITCH_DECLARE(void *) switch_core_memory_pool_get_data(switch_memory_pool_t *pool, const char *key)
{ {
void *data = NULL; void *data = NULL;
apr_pool_userdata_get(&data, key, pool); fspr_pool_userdata_get(&data, key, pool);
return data; return data;
} }
SWITCH_DECLARE(void) switch_core_memory_pool_tag(switch_memory_pool_t *pool, const char *tag) SWITCH_DECLARE(void) switch_core_memory_pool_tag(switch_memory_pool_t *pool, const char *tag)
{ {
apr_pool_tag(pool, tag); fspr_pool_tag(pool, tag);
} }
SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p) SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p)
{ {
#ifdef PER_POOL_LOCK #ifdef PER_POOL_LOCK
apr_thread_mutex_t *my_mutex; fspr_thread_mutex_t *my_mutex;
apr_pool_mutex_set(p, NULL); fspr_pool_mutex_set(p, NULL);
#endif #endif
apr_pool_clear(p); fspr_pool_clear(p);
#ifdef PER_POOL_LOCK #ifdef PER_POOL_LOCK
if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, p)) != APR_SUCCESS) { if ((fspr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, p)) != APR_SUCCESS) {
abort(); abort();
} }
apr_pool_mutex_set(p, my_mutex); fspr_pool_mutex_set(p, my_mutex);
#endif #endif
} }
#if APR_POOL_DEBUG #if APR_POOL_DEBUG
static int switch_core_pool_stats_callback(apr_pool_t *pool, void *data) { static int switch_core_pool_stats_callback(fspr_pool_t *pool, void *data) {
switch_stream_handle_t *stream = (switch_stream_handle_t *)data; switch_stream_handle_t *stream = (switch_stream_handle_t *)data;
size_t size = (size_t)apr_pool_num_bytes(pool, 1); size_t size = (size_t)fspr_pool_num_bytes(pool, 1);
unsigned int alloc = 0, total_alloc = 0, clear = 0; unsigned int alloc = 0, total_alloc = 0, clear = 0;
char *line = NULL; char *line = NULL;
apr_pool_userdata_get((void**)&line, "line", pool); fspr_pool_userdata_get((void**)&line, "line", pool);
apr_pool_get_stats(pool, &alloc, &total_alloc, &clear); fspr_pool_get_stats(pool, &alloc, &total_alloc, &clear);
if (stream) { if (stream) {
stream->write_function(stream, "Pool '%s' size: %" SWITCH_SIZE_T_FMT ", alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : apr_pool_tag(pool, NULL)), size, alloc, total_alloc, clear); stream->write_function(stream, "Pool '%s' size: %" SWITCH_SIZE_T_FMT ", alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : fspr_pool_tag(pool, NULL)), size, alloc, total_alloc, clear);
} else { } else {
printf("Pool '%s' size: %" SWITCH_SIZE_T_FMT ", alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : apr_pool_tag(pool, NULL)), size, alloc, total_alloc, clear); printf("Pool '%s' size: %" SWITCH_SIZE_T_FMT ", alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : fspr_pool_tag(pool, NULL)), size, alloc, total_alloc, clear);
} }
return 0; return 0;
} }
@ -377,7 +377,7 @@ SWITCH_DECLARE(void) switch_core_pool_stats(switch_stream_handle_t *stream)
{ {
#if APR_POOL_DEBUG #if APR_POOL_DEBUG
if (runtime.memory_pool) { if (runtime.memory_pool) {
apr_pool_walk_tree_debug(runtime.memory_pool, switch_core_pool_stats_callback, (void *)stream); fspr_pool_walk_tree_debug(runtime.memory_pool, switch_core_pool_stats_callback, (void *)stream);
} }
#else #else
if (stream) { if (stream) {
@ -392,13 +392,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memor
{ {
char *tmp; char *tmp;
#ifdef INSTANTLY_DESTROY_POOLS #ifdef INSTANTLY_DESTROY_POOLS
apr_pool_create(pool, NULL); fspr_pool_create(pool, NULL);
switch_assert(*pool != NULL); switch_assert(*pool != NULL);
#else #else
#ifdef PER_POOL_LOCK #ifdef PER_POOL_LOCK
apr_allocator_t *my_allocator = NULL; fspr_allocator_t *my_allocator = NULL;
apr_thread_mutex_t *my_mutex; fspr_thread_mutex_t *my_mutex;
#else #else
void *pop = NULL; void *pop = NULL;
#endif #endif
@ -415,43 +415,43 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memor
#endif #endif
#ifdef PER_POOL_LOCK #ifdef PER_POOL_LOCK
if ((apr_allocator_create(&my_allocator)) != APR_SUCCESS) { if ((fspr_allocator_create(&my_allocator)) != APR_SUCCESS) {
abort(); abort();
} }
#if APR_POOL_DEBUG #if APR_POOL_DEBUG
if ((apr_pool_create_ex_debug(pool, memory_manager.memory_pool, NULL, my_allocator, func)) != APR_SUCCESS) { if ((fspr_pool_create_ex_debug(pool, memory_manager.memory_pool, NULL, my_allocator, func)) != APR_SUCCESS) {
#else #else
if ((apr_pool_create_ex(pool, NULL, NULL, my_allocator)) != APR_SUCCESS) { if ((fspr_pool_create_ex(pool, NULL, NULL, my_allocator)) != APR_SUCCESS) {
#endif #endif
abort(); abort();
} }
if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, *pool)) != APR_SUCCESS) { if ((fspr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, *pool)) != APR_SUCCESS) {
abort(); abort();
} }
apr_allocator_mutex_set(my_allocator, my_mutex); fspr_allocator_mutex_set(my_allocator, my_mutex);
apr_allocator_owner_set(my_allocator, *pool); fspr_allocator_owner_set(my_allocator, *pool);
apr_pool_mutex_set(*pool, my_mutex); fspr_pool_mutex_set(*pool, my_mutex);
#else #else
apr_pool_create(pool, NULL); fspr_pool_create(pool, NULL);
switch_assert(*pool != NULL); switch_assert(*pool != NULL);
} }
#endif #endif
#endif #endif
tmp = switch_core_sprintf(*pool, "%s:%d", file, line); tmp = switch_core_sprintf(*pool, "%s:%d", file, line);
apr_pool_tag(*pool, tmp); fspr_pool_tag(*pool, tmp);
#if APR_POOL_DEBUG #if APR_POOL_DEBUG
apr_pool_userdata_set(tmp, "line", NULL, *pool); fspr_pool_userdata_set(tmp, "line", NULL, *pool);
#endif #endif
#ifdef DEBUG_ALLOC2 #ifdef DEBUG_ALLOC2
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p New Pool %s\n", (void *) *pool, apr_pool_tag(*pool, NULL)); switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p New Pool %s\n", (void *) *pool, fspr_pool_tag(*pool, NULL));
#endif #endif
@ -476,20 +476,20 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_m
tmp_pool = *pool; tmp_pool = *pool;
*pool = NULL; *pool = NULL;
tag = apr_pool_tag(tmp_pool, NULL); tag = fspr_pool_tag(tmp_pool, NULL);
tmp = switch_core_sprintf(tmp_pool, "%s,%s:%d", (tag ? tag : ""), file, line); tmp = switch_core_sprintf(tmp_pool, "%s,%s:%d", (tag ? tag : ""), file, line);
apr_pool_tag(tmp_pool, tmp); fspr_pool_tag(tmp_pool, tmp);
} }
#ifdef DEBUG_ALLOC2 #ifdef DEBUG_ALLOC2
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Free Pool %s\n", (void *) tmp_pool, apr_pool_tag(tmp_pool, NULL)); switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Free Pool %s\n", (void *) tmp_pool, fspr_pool_tag(tmp_pool, NULL));
#endif #endif
#ifdef INSTANTLY_DESTROY_POOLS #ifdef INSTANTLY_DESTROY_POOLS
#ifdef USE_MEM_LOCK #ifdef USE_MEM_LOCK
switch_mutex_lock(memory_manager.mem_lock); switch_mutex_lock(memory_manager.mem_lock);
#endif #endif
apr_pool_destroy(tmp_pool); fspr_pool_destroy(tmp_pool);
#ifdef USE_MEM_LOCK #ifdef USE_MEM_LOCK
switch_mutex_unlock(memory_manager.mem_lock); switch_mutex_unlock(memory_manager.mem_lock);
#endif #endif
@ -499,9 +499,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_m
switch_mutex_lock(memory_manager.mem_lock); switch_mutex_lock(memory_manager.mem_lock);
#endif #endif
#if APR_POOL_DEBUG #if APR_POOL_DEBUG
apr_pool_destroy_debug(tmp_pool, func); fspr_pool_destroy_debug(tmp_pool, func);
#else #else
apr_pool_destroy(tmp_pool); fspr_pool_destroy(tmp_pool);
#endif #endif
#ifdef USE_MEM_LOCK #ifdef USE_MEM_LOCK
switch_mutex_unlock(memory_manager.mem_lock); switch_mutex_unlock(memory_manager.mem_lock);
@ -527,14 +527,14 @@ SWITCH_DECLARE(void *) switch_core_perform_alloc(switch_memory_pool_t *pool, swi
#ifdef DEBUG_ALLOC #ifdef DEBUG_ALLOC
if (memory > DEBUG_ALLOC_CUTOFF) if (memory > DEBUG_ALLOC_CUTOFF)
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Core Allocate %s %d\n", switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Core Allocate %s %d\n",
(void *) pool, apr_pool_tag(pool, NULL), (int) memory); (void *) pool, fspr_pool_tag(pool, NULL), (int) memory);
/*switch_assert(memory < 20000); */ /*switch_assert(memory < 20000); */
#endif #endif
#if APR_POOL_DEBUG #if APR_POOL_DEBUG
ptr = apr_palloc_debug(pool, memory, func); ptr = fspr_palloc_debug(pool, memory, func);
#else #else
ptr = apr_palloc(pool, memory); ptr = fspr_palloc(pool, memory);
#endif #endif
switch_assert(ptr != NULL); switch_assert(ptr != NULL);
memset(ptr, 0, memory); memset(ptr, 0, memory);
@ -564,7 +564,7 @@ SWITCH_DECLARE(void) switch_core_memory_reclaim(void)
#ifdef USE_MEM_LOCK #ifdef USE_MEM_LOCK
switch_mutex_lock(memory_manager.mem_lock); switch_mutex_lock(memory_manager.mem_lock);
#endif #endif
apr_pool_destroy(pool); fspr_pool_destroy(pool);
#ifdef USE_MEM_LOCK #ifdef USE_MEM_LOCK
switch_mutex_unlock(memory_manager.mem_lock); switch_mutex_unlock(memory_manager.mem_lock);
#endif #endif
@ -601,16 +601,16 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
#ifdef DEBUG_ALLOC #ifdef DEBUG_ALLOC
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);
#endif #endif
apr_pool_destroy(pop); fspr_pool_destroy(pop);
#ifdef USE_MEM_LOCK #ifdef USE_MEM_LOCK
switch_mutex_unlock(memory_manager.mem_lock); switch_mutex_unlock(memory_manager.mem_lock);
#endif #endif
#else #else
apr_pool_mutex_set(pop, NULL); fspr_pool_mutex_set(pop, NULL);
#ifdef DEBUG_ALLOC #ifdef DEBUG_ALLOC
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);
#endif #endif
apr_pool_clear(pop); fspr_pool_clear(pop);
if (switch_queue_trypush(memory_manager.pool_recycle_queue, pop) != SWITCH_STATUS_SUCCESS) { if (switch_queue_trypush(memory_manager.pool_recycle_queue, pop) != SWITCH_STATUS_SUCCESS) {
#ifdef USE_MEM_LOCK #ifdef USE_MEM_LOCK
switch_mutex_lock(memory_manager.mem_lock); switch_mutex_lock(memory_manager.mem_lock);
@ -618,7 +618,7 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
#ifdef DEBUG_ALLOC #ifdef DEBUG_ALLOC
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);
#endif #endif
apr_pool_destroy(pop); fspr_pool_destroy(pop);
#ifdef USE_MEM_LOCK #ifdef USE_MEM_LOCK
switch_mutex_unlock(memory_manager.mem_lock); switch_mutex_unlock(memory_manager.mem_lock);
#endif #endif
@ -647,7 +647,7 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
#ifdef USE_MEM_LOCK #ifdef USE_MEM_LOCK
switch_mutex_lock(memory_manager.mem_lock); switch_mutex_lock(memory_manager.mem_lock);
#endif #endif
apr_pool_destroy(pop); fspr_pool_destroy(pop);
pop = NULL; pop = NULL;
#ifdef USE_MEM_LOCK #ifdef USE_MEM_LOCK
switch_mutex_unlock(memory_manager.mem_lock); switch_mutex_unlock(memory_manager.mem_lock);
@ -678,7 +678,7 @@ void switch_core_memory_stop(void)
while (switch_queue_trypop(memory_manager.pool_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { while (switch_queue_trypop(memory_manager.pool_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
apr_pool_destroy(pop); fspr_pool_destroy(pop);
} }
#endif #endif
} }
@ -689,33 +689,33 @@ switch_memory_pool_t *switch_core_memory_init(void)
switch_threadattr_t *thd_attr; switch_threadattr_t *thd_attr;
#endif #endif
#ifdef PER_POOL_LOCK #ifdef PER_POOL_LOCK
apr_allocator_t *my_allocator = NULL; fspr_allocator_t *my_allocator = NULL;
apr_thread_mutex_t *my_mutex; fspr_thread_mutex_t *my_mutex;
#endif #endif
memset(&memory_manager, 0, sizeof(memory_manager)); memset(&memory_manager, 0, sizeof(memory_manager));
#ifdef PER_POOL_LOCK #ifdef PER_POOL_LOCK
if ((apr_allocator_create(&my_allocator)) != APR_SUCCESS) { if ((fspr_allocator_create(&my_allocator)) != APR_SUCCESS) {
abort(); abort();
} }
if ((apr_pool_create_ex(&memory_manager.memory_pool, NULL, NULL, my_allocator)) != APR_SUCCESS) { if ((fspr_pool_create_ex(&memory_manager.memory_pool, NULL, NULL, my_allocator)) != APR_SUCCESS) {
apr_allocator_destroy(my_allocator); fspr_allocator_destroy(my_allocator);
my_allocator = NULL; my_allocator = NULL;
abort(); abort();
} }
if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, memory_manager.memory_pool)) != APR_SUCCESS) { if ((fspr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, memory_manager.memory_pool)) != APR_SUCCESS) {
abort(); abort();
} }
apr_allocator_mutex_set(my_allocator, my_mutex); fspr_allocator_mutex_set(my_allocator, my_mutex);
apr_pool_mutex_set(memory_manager.memory_pool, my_mutex); fspr_pool_mutex_set(memory_manager.memory_pool, my_mutex);
apr_allocator_owner_set(my_allocator, memory_manager.memory_pool); fspr_allocator_owner_set(my_allocator, memory_manager.memory_pool);
apr_pool_tag(memory_manager.memory_pool, "core_pool"); fspr_pool_tag(memory_manager.memory_pool, "core_pool");
#else #else
apr_pool_create(&memory_manager.memory_pool, NULL); fspr_pool_create(&memory_manager.memory_pool, NULL);
switch_assert(memory_manager.memory_pool != NULL); switch_assert(memory_manager.memory_pool != NULL);
#endif #endif

View File

@ -34,14 +34,14 @@
#include <switch.h> #include <switch.h>
#include "private/switch_core_pvt.h" #include "private/switch_core_pvt.h"
/* for apr_pstrcat */ /* for fspr_pstrcat */
#include <apr_strings.h> #include <fspr_strings.h>
/* for apr_env_get and apr_env_set */ /* for fspr_env_get and fspr_env_set */
#include <apr_env.h> #include <fspr_env.h>
/* for apr file and directory handling */ /* for fspr file and directory handling */
#include <apr_file_io.h> #include <fspr_file_io.h>
typedef struct switch_file_node_s { typedef struct switch_file_node_s {
const switch_file_interface_t *ptr; const switch_file_interface_t *ptr;
@ -1633,7 +1633,7 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena
{ {
switch_loadable_module_t *module = NULL; switch_loadable_module_t *module = NULL;
switch_dso_lib_t dso = NULL; switch_dso_lib_t dso = NULL;
apr_status_t status = SWITCH_STATUS_SUCCESS; fspr_status_t status = SWITCH_STATUS_SUCCESS;
switch_loadable_module_function_table_t *interface_struct_handle = NULL; switch_loadable_module_function_table_t *interface_struct_handle = NULL;
switch_loadable_module_function_table_t *mod_interface_functions = NULL; switch_loadable_module_function_table_t *mod_interface_functions = NULL;
char *struct_name = NULL; char *struct_name = NULL;
@ -2061,14 +2061,14 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_build_dynamic(char *filen
static void switch_loadable_module_path_init() static void switch_loadable_module_path_init()
{ {
char *path = NULL, *working = NULL; char *path = NULL, *working = NULL;
apr_dir_t *perl_dir_handle = NULL; fspr_dir_t *perl_dir_handle = NULL;
apr_env_get(&path, "path", loadable_modules.pool); fspr_env_get(&path, "path", loadable_modules.pool);
apr_filepath_get(&working, APR_FILEPATH_NATIVE, loadable_modules.pool); fspr_filepath_get(&working, APR_FILEPATH_NATIVE, loadable_modules.pool);
if (apr_dir_open(&perl_dir_handle, ".\\perl", loadable_modules.pool) == APR_SUCCESS) { if (fspr_dir_open(&perl_dir_handle, ".\\perl", loadable_modules.pool) == APR_SUCCESS) {
apr_dir_close(perl_dir_handle); fspr_dir_close(perl_dir_handle);
apr_env_set("path", apr_pstrcat(loadable_modules.pool, path, ";", working, "\\perl", NULL), loadable_modules.pool); fspr_env_set("path", fspr_pstrcat(loadable_modules.pool, path, ";", working, "\\perl", NULL), loadable_modules.pool);
} }
} }
#endif #endif
@ -2076,9 +2076,9 @@ static void switch_loadable_module_path_init()
SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autoload) SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autoload)
{ {
apr_finfo_t finfo = { 0 }; fspr_finfo_t finfo = { 0 };
apr_dir_t *module_dir_handle = NULL; fspr_dir_t *module_dir_handle = NULL;
apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME; fspr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
char *precf = "pre_load_modules.conf"; char *precf = "pre_load_modules.conf";
char *cf = "modules.conf"; char *cf = "modules.conf";
char *pcf = "post_load_modules.conf"; char *pcf = "post_load_modules.conf";
@ -2286,12 +2286,12 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo
} }
if (all) { if (all) {
if (apr_dir_open(&module_dir_handle, SWITCH_GLOBAL_dirs.mod_dir, loadable_modules.pool) != APR_SUCCESS) { if (fspr_dir_open(&module_dir_handle, SWITCH_GLOBAL_dirs.mod_dir, loadable_modules.pool) != APR_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't open directory: %s\n", SWITCH_GLOBAL_dirs.mod_dir); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't open directory: %s\n", SWITCH_GLOBAL_dirs.mod_dir);
return SWITCH_STATUS_GENERR; return SWITCH_STATUS_GENERR;
} }
while (apr_dir_read(&finfo, finfo_flags, module_dir_handle) == APR_SUCCESS) { while (fspr_dir_read(&finfo, finfo_flags, module_dir_handle) == APR_SUCCESS) {
const char *fname = finfo.fname; const char *fname = finfo.fname;
if (finfo.filetype != APR_REG) { if (finfo.filetype != APR_REG) {
@ -2312,7 +2312,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo
switch_loadable_module_load_module(SWITCH_GLOBAL_dirs.mod_dir, fname, SWITCH_FALSE, &err); switch_loadable_module_load_module(SWITCH_GLOBAL_dirs.mod_dir, fname, SWITCH_FALSE, &err);
} }
apr_dir_close(module_dir_handle); fspr_dir_close(module_dir_handle);
} }
switch_loadable_module_runtime(); switch_loadable_module_runtime();

View File

@ -36,7 +36,7 @@
#include <switch_private.h> #include <switch_private.h>
#endif #endif
#include <switch_stun.h> #include <switch_stun.h>
#include <apr_network_io.h> #include <fspr_network_io.h>
#undef PACKAGE_NAME #undef PACKAGE_NAME
#undef PACKAGE_STRING #undef PACKAGE_STRING
#undef PACKAGE_TARNAME #undef PACKAGE_TARNAME

View File

@ -162,7 +162,7 @@ static void do_sleep(switch_interval_time_t t)
#if !defined(DARWIN) #if !defined(DARWIN)
if (t > 100000 || !NANO) { if (t > 100000 || !NANO) {
apr_sleep(t); fspr_sleep(t);
return; return;
} }
#endif #endif