summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/apr_dso.h3
-rw-r--r--include/apr_file_io.h6
-rw-r--r--include/apr_general.h107
-rw-r--r--include/apr_getopt.h2
-rw-r--r--include/apr_lib.h26
-rw-r--r--include/apr_lock.h3
-rw-r--r--include/apr_md5.h2
-rw-r--r--include/apr_mmap.h6
-rw-r--r--include/apr_network_io.h4
-rw-r--r--include/apr_pools.h124
-rw-r--r--include/apr_portable.h11
-rw-r--r--include/apr_shmem.h2
-rw-r--r--include/apr_strings.h10
-rw-r--r--include/apr_tables.h10
-rw-r--r--include/apr_thread_proc.h47
-rw-r--r--include/apr_time.h3
-rw-r--r--include/apr_user.h2
-rw-r--r--include/apr_xlate.h3
-rw-r--r--lib/apr_pools.c3
-rw-r--r--memory/unix/apr_pools.c3
-rw-r--r--strings/apr_strnatcmp.c2
21 files changed, 188 insertions, 191 deletions
diff --git a/include/apr_dso.h b/include/apr_dso.h
index 402b58a96..b277ce40d 100644
--- a/include/apr_dso.h
+++ b/include/apr_dso.h
@@ -55,7 +55,8 @@
#ifndef APR_DSO_DOT_H
#define APR_DSO_DOT_H
-#include "apr_general.h"
+#include "apr.h"
+#include "apr_pools.h"
#include "apr_errno.h"
/**
diff --git a/include/apr_file_io.h b/include/apr_file_io.h
index ce2055b4f..85ee3f0d6 100644
--- a/include/apr_file_io.h
+++ b/include/apr_file_io.h
@@ -55,12 +55,10 @@
#ifndef APR_FILE_IO_H
#define APR_FILE_IO_H
-#include "apr_general.h"
+#include "apr.h"
+#include "apr_pools.h"
#include "apr_time.h"
#include "apr_errno.h"
-#if APR_HAVE_SYS_UIO_H
-#include <sys/uio.h>
-#endif
#ifdef __cplusplus
extern "C" {
diff --git a/include/apr_general.h b/include/apr_general.h
index 271b04d81..f3252de50 100644
--- a/include/apr_general.h
+++ b/include/apr_general.h
@@ -56,17 +56,12 @@
#define APR_GENERAL_H
#include "apr.h"
+#include "apr_pools.h"
+#include "apr_errno.h"
-#if APR_HAVE_STDIO_H
-#include <stdio.h>
-#endif
-#if APR_HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
#if APR_HAVE_SIGNAL_H
#include <signal.h>
#endif
-#include "apr_errno.h"
#ifdef __cplusplus
extern "C" {
@@ -256,104 +251,6 @@ int strncasecmp(const char *a, const char *b, size_t n);
apr_status_t apr_generate_random_bytes(unsigned char * buf, int length);
#endif
-/* Memory allocation/Pool debugging options...
- *
- * Look in the developer documentation for details of what these do.
- *
- * NB These should ALL normally be commented out unless you REALLY
- * need them!!
- */
-
-/*
-#define ALLOC_DEBUG
-#define POOL_DEBUG
-#define ALLOC_USE_MALLOC
-#define MAKE_TABLE_PROFILE
-#define ALLOC_STATS
-*/
-
-/**
- * @package APR memory allocation
- */
-typedef struct apr_pool_t apr_pool_t;
-
-/** The memory allocation structure
- */
-struct apr_pool_t {
- /** The first block in this pool. */
- union block_hdr *first;
- /** The last block in this pool. */
- union block_hdr *last;
- /** The list of cleanups to run on pool cleanup. */
- struct cleanup *cleanups;
- /** A list of processes to kill when this pool is cleared */
- struct process_chain *subprocesses;
- /** The first sub_pool of this pool */
- struct apr_pool_t *sub_pools;
- /** The next sibling pool */
- struct apr_pool_t *sub_next;
- /** The previous sibling pool */
- struct apr_pool_t *sub_prev;
- /** The parent pool of this pool */
- struct apr_pool_t *parent;
- /** The first free byte in this pool */
- char *free_first_avail;
-#ifdef ALLOC_USE_MALLOC
- /** The allocation list if using malloc */
- void *allocation_list;
-#endif
-#ifdef POOL_DEBUG
- /** a list of joined pools
- * @defvar apr_pool_t *joined */
- struct apr_pool_t *joined;
-#endif
- /** A function to control how pools behave when they receive ENOMEM
- * @deffunc int apr_abort(int retcode) */
- int (*apr_abort)(int retcode);
- /** A place to hand user data associated with this pool
- * @defvar datastruct *prog_data */
- struct datastruct *prog_data;
-};
-
-/* pool functions */
-
-/**
- * Create a new pool.
- * @param newcont The pool we have just created.
- * @param cont The parent pool. If this is NULL, the new pool is a root
- * pool. If it is non-NULL, the new pool will inherit all
- * of it's parent pool's attributes, except the apr_pool_t will
- * be a sub-pool.
- */
-apr_status_t apr_create_pool(apr_pool_t **newcont, apr_pool_t *cont);
-
-/**
- * Set the data associated with the current pool
- * @param data The user data associated with the pool.
- * @param key The key to use for association
- * @param cleanup The cleanup program to use to cleanup the data;
- * @param cont The current pool.
- * @tip The data to be attached to the pool should have the same
- * life span as the pool it is being attached to.
- *
- * Users of APR must take EXTREME care when choosing a key to
- * use for their data. It is possible to accidentally overwrite
- * data by choosing a key that another part of the program is using
- * It is advised that steps are taken to ensure that a unique
- * key is used at all times.
- */
-apr_status_t apr_set_userdata(const void *data, const char *key,
- apr_status_t (*cleanup) (void *),
- apr_pool_t *cont);
-
-/**
- * Return the data associated with the current pool.
- * @param data The key for the data to retrieve
- * @param key The user data associated with the pool.
- * @param cont The current pool.
- */
-apr_status_t apr_get_userdata(void **data, const char *key, apr_pool_t *cont);
-
/**
* Setup any APR internal data structures. This MUST be the first function
* called for any APR program.
diff --git a/include/apr_getopt.h b/include/apr_getopt.h
index 0fb15c1bc..cfa269667 100644
--- a/include/apr_getopt.h
+++ b/include/apr_getopt.h
@@ -55,6 +55,8 @@
#ifndef APR_GETOPT_H
#define APR_GETOPT_H
+#include "apr_pools.h"
+
/**
* @package APR command arguments
*/
diff --git a/include/apr_lib.h b/include/apr_lib.h
index 550e35a0f..f28f79a88 100644
--- a/include/apr_lib.h
+++ b/include/apr_lib.h
@@ -56,11 +56,7 @@
#define APR_LIB_H
#include "apr.h"
-#include "apr_pools.h"
-#include "apr_general.h"
-#include "apr_tables.h"
-#include "apr_file_io.h"
-#include "apr_thread_proc.h"
+#include "apr_errno.h"
#if APR_HAVE_CTYPE_H
#include <ctype.h>
@@ -68,9 +64,6 @@
#if APR_HAVE_STDARG_H
#include <stdarg.h>
#endif
-#if APR_HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
/**
* @package APR general-purpose library
@@ -266,23 +259,6 @@ APR_DECLARE(int) apr_vsnprintf(char *buf, size_t len, const char *format,
*/
APR_DECLARE(apr_status_t) apr_getpass(const char *prompt, char *pwbuf, size_t *bufsize);
-/**
- * Register a process to be killed when a pool dies.
- * @param a The pool to use to define the processes lifetime
- * @param pid The process to register
- * @param how How to kill the process, one of:
- * <PRE>
- * kill_never -- process is never sent any signals
- * kill_always -- process is sent SIGKILL on apr_pool_t cleanup
- * kill_after_timeout -- SIGTERM, wait 3 seconds, SIGKILL
- * just_wait -- wait forever for the process to complete
- * kill_only_once -- send SIGTERM and then wait
- * </PRE>
- * @deffunc void apr_note_subprocess(struct apr_pool_t *a, apr_proc_t *pid, enum kill_conditions how)
- */
-APR_DECLARE(void) apr_note_subprocess(struct apr_pool_t *a, apr_proc_t *pid,
- enum kill_conditions how);
-
#ifdef __cplusplus
}
#endif
diff --git a/include/apr_lock.h b/include/apr_lock.h
index 8557d1011..c0bc72697 100644
--- a/include/apr_lock.h
+++ b/include/apr_lock.h
@@ -55,7 +55,8 @@
#ifndef APR_LOCKS_H
#define APR_LOCKS_H
-#include "apr_general.h"
+#include "apr.h"
+#include "apr_pools.h"
#include "apr_errno.h"
#ifdef __cplusplus
diff --git a/include/apr_md5.h b/include/apr_md5.h
index 41048cfce..d3405c1ec 100644
--- a/include/apr_md5.h
+++ b/include/apr_md5.h
@@ -85,7 +85,7 @@
#ifndef APR_MD5_H
#define APR_MD5_H
-#include "apr_lib.h"
+#include "apr.h"
#include "apr_xlate.h"
#ifdef __cplusplus
diff --git a/include/apr_mmap.h b/include/apr_mmap.h
index 5f47ebd5b..194ba7800 100644
--- a/include/apr_mmap.h
+++ b/include/apr_mmap.h
@@ -55,10 +55,10 @@
#ifndef APR_MMAP_H
#define APR_MMAP_H
-#include "apr_general.h"
+#include "apr.h"
+#include "apr_pools.h"
#include "apr_errno.h"
-#include "apr_network_io.h"
-#include "apr_portable.h"
+#include "apr_file_io.h" /* for apr_file_t */
#ifdef __cplusplus
extern "C" {
diff --git a/include/apr_network_io.h b/include/apr_network_io.h
index 05ef4216f..f79b682a3 100644
--- a/include/apr_network_io.h
+++ b/include/apr_network_io.h
@@ -59,9 +59,11 @@
* @package APR Network library
*/
-#include "apr_general.h"
+#include "apr.h"
+#include "apr_pools.h"
#include "apr_file_io.h"
#include "apr_errno.h"
+
#if APR_HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
diff --git a/include/apr_pools.h b/include/apr_pools.h
index 790f04580..c089770fd 100644
--- a/include/apr_pools.h
+++ b/include/apr_pools.h
@@ -85,38 +85,65 @@ extern "C" {
*/
#include "apr.h"
-#include "apr_thread_proc.h"
+#include "apr_errno.h"
-#if APR_HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#if APR_HAVE_STDARG_H
-#include <stdarg.h>
-#endif
+/* Memory allocation/Pool debugging options...
+ *
+ * Look in the developer documentation for details of what these do.
+ *
+ * NB These should ALL normally be commented out unless you REALLY
+ * need them!!
+ */
+
+/*
+#define ALLOC_DEBUG
+#define POOL_DEBUG
+#define ALLOC_USE_MALLOC
+#define MAKE_TABLE_PROFILE
+#define ALLOC_STATS
+*/
-enum kill_conditions {
- kill_never, /* process is never sent any signals */
- kill_always, /* process is sent SIGKILL on apr_pool_t cleanup */
- kill_after_timeout, /* SIGTERM, wait 3 seconds, SIGKILL */
- just_wait, /* wait forever for the process to complete */
- kill_only_once /* send SIGTERM and then wait */
-};
+/**
+ * @package APR memory allocation
+ */
+typedef struct apr_pool_t apr_pool_t;
-/** A list of processes */
-struct process_chain {
- /** The process ID */
- apr_proc_t *pid;
- /** When the process should be sent a signal. <PRE>
- * kill_never -- process is never sent any signals
- * kill_always -- process is sent SIGKILL on apr_pool_t cleanup
- * kill_after_timeout -- SIGTERM, wait 3 seconds, SIGKILL
- * just_wait -- wait forever for the process to complete
- * kill_only_once -- send SIGTERM and then wait </PRE>
- */
- enum kill_conditions kill_how;
- /** The next process in the list
- * @defvar process_chain *next */
- struct process_chain *next;
+/** The memory allocation structure
+ */
+struct apr_pool_t {
+ /** The first block in this pool. */
+ union block_hdr *first;
+ /** The last block in this pool. */
+ union block_hdr *last;
+ /** The list of cleanups to run on pool cleanup. */
+ struct cleanup *cleanups;
+ /** A list of processes to kill when this pool is cleared */
+ struct process_chain *subprocesses;
+ /** The first sub_pool of this pool */
+ struct apr_pool_t *sub_pools;
+ /** The next sibling pool */
+ struct apr_pool_t *sub_next;
+ /** The previous sibling pool */
+ struct apr_pool_t *sub_prev;
+ /** The parent pool of this pool */
+ struct apr_pool_t *parent;
+ /** The first free byte in this pool */
+ char *free_first_avail;
+#ifdef ALLOC_USE_MALLOC
+ /** The allocation list if using malloc */
+ void *allocation_list;
+#endif
+#ifdef POOL_DEBUG
+ /** a list of joined pools
+ * @defvar apr_pool_t *joined */
+ struct apr_pool_t *joined;
+#endif
+ /** A function to control how pools behave when they receive ENOMEM
+ * @deffunc int apr_abort(int retcode) */
+ int (*apr_abort)(int retcode);
+ /** A place to hand user data associated with this pool
+ * @defvar datastruct *prog_data */
+ struct datastruct *prog_data;
};
/* pools have nested lifetimes -- sub_pools are destroyed when the
@@ -190,6 +217,45 @@ apr_status_t apr_init_alloc(void); /* Set up everything */
* automatically from apr_terminate.
*/
void apr_term_alloc(void); /* Tear down everything */
+
+/* pool functions */
+
+/**
+ * Create a new pool.
+ * @param newcont The pool we have just created.
+ * @param cont The parent pool. If this is NULL, the new pool is a root
+ * pool. If it is non-NULL, the new pool will inherit all
+ * of it's parent pool's attributes, except the apr_pool_t will
+ * be a sub-pool.
+ */
+apr_status_t apr_create_pool(apr_pool_t **newcont, apr_pool_t *cont);
+
+/**
+ * Set the data associated with the current pool
+ * @param data The user data associated with the pool.
+ * @param key The key to use for association
+ * @param cleanup The cleanup program to use to cleanup the data;
+ * @param cont The current pool.
+ * @tip The data to be attached to the pool should have the same
+ * life span as the pool it is being attached to.
+ *
+ * Users of APR must take EXTREME care when choosing a key to
+ * use for their data. It is possible to accidentally overwrite
+ * data by choosing a key that another part of the program is using
+ * It is advised that steps are taken to ensure that a unique
+ * key is used at all times.
+ */
+apr_status_t apr_set_userdata(const void *data, const char *key,
+ apr_status_t (*cleanup) (void *),
+ apr_pool_t *cont);
+
+/**
+ * Return the data associated with the current pool.
+ * @param data The key for the data to retrieve
+ * @param key The user data associated with the pool.
+ * @param cont The current pool.
+ */
+apr_status_t apr_get_userdata(void **data, const char *key, apr_pool_t *cont);
/**
* make a sub pool from the current pool
diff --git a/include/apr_portable.h b/include/apr_portable.h
index bcdd6a0e6..6faf91447 100644
--- a/include/apr_portable.h
+++ b/include/apr_portable.h
@@ -63,11 +63,8 @@
* @package APR portability Routines
*/
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include "apr_general.h"
+#include "apr.h"
+#include "apr_pools.h"
#include "apr_thread_proc.h"
#include "apr_file_io.h"
#include "apr_network_io.h"
@@ -89,6 +86,10 @@ extern "C" {
#include <sys/sem.h>
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
#ifdef WIN32
/* The primitives for Windows types */
typedef HANDLE apr_os_file_t;
diff --git a/include/apr_shmem.h b/include/apr_shmem.h
index 60e552832..787e889e9 100644
--- a/include/apr_shmem.h
+++ b/include/apr_shmem.h
@@ -60,7 +60,7 @@
*/
#include "apr.h"
-#include "apr_general.h"
+#include "apr_pools.h"
#include "apr_errno.h"
#ifdef __cplusplus
diff --git a/include/apr_strings.h b/include/apr_strings.h
index b45f29c7d..f189b7701 100644
--- a/include/apr_strings.h
+++ b/include/apr_strings.h
@@ -75,12 +75,16 @@
3. This notice may not be removed or altered from any source distribution.
*/
+#ifndef APR_STRINGS_H
+#define APR_STRINGS_H
#include "apr.h"
-#include "apr_lib.h"
+#include "apr_errno.h"
+#include "apr_pools.h"
-#ifndef APR_STRINGS_H
-#define APR_STRINGS_H
+#if APR_HAVE_STDARG_H
+#include <stdarg.h>
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/include/apr_tables.h b/include/apr_tables.h
index 09a9f2e4b..e38bc5eaa 100644
--- a/include/apr_tables.h
+++ b/include/apr_tables.h
@@ -55,15 +55,11 @@
#ifndef APR_TABLES_H
#define APR_TABLES_H
-#include "apr_general.h"
-#include "apr_file_io.h"
-#include "apr_thread_proc.h"
+#include "apr.h"
+#include "apr_pools.h"
#if APR_HAVE_STDARG_H
-#include <stdarg.h>
-#endif
-#if APR_HAVE_SYS_TYPES_H
-#include <sys/types.h>
+#include <stdarg.h> /* for va_list */
#endif
#ifdef __cplusplus
diff --git a/include/apr_thread_proc.h b/include/apr_thread_proc.h
index 8fd6b773d..bb218d212 100644
--- a/include/apr_thread_proc.h
+++ b/include/apr_thread_proc.h
@@ -55,9 +55,11 @@
#ifndef APR_THREAD_PROC_H
#define APR_THREAD_PROC_H
+#include "apr.h"
#include "apr_file_io.h"
-#include "apr_general.h"
+#include "apr_pools.h"
#include "apr_errno.h"
+
#if APR_HAVE_STRUCT_RLIMIT
#include <sys/time.h>
#include <sys/resource.h>
@@ -124,6 +126,31 @@ typedef struct apr_other_child_rec_t apr_other_child_rec_t;
typedef void *(APR_THREAD_FUNC *apr_thread_start_t)(void *);
+enum kill_conditions {
+ kill_never, /* process is never sent any signals */
+ kill_always, /* process is sent SIGKILL on apr_pool_t cleanup */
+ kill_after_timeout, /* SIGTERM, wait 3 seconds, SIGKILL */
+ just_wait, /* wait forever for the process to complete */
+ kill_only_once /* send SIGTERM and then wait */
+};
+
+/** A list of processes */
+struct process_chain {
+ /** The process ID */
+ apr_proc_t *pid;
+ /** When the process should be sent a signal. <PRE>
+ * kill_never -- process is never sent any signals
+ * kill_always -- process is sent SIGKILL on apr_pool_t cleanup
+ * kill_after_timeout -- SIGTERM, wait 3 seconds, SIGKILL
+ * just_wait -- wait forever for the process to complete
+ * kill_only_once -- send SIGTERM and then wait </PRE>
+ */
+ enum kill_conditions kill_how;
+ /** The next process in the list
+ * @defvar process_chain *next */
+ struct process_chain *next;
+};
+
/* Thread Function definitions */
/**
@@ -480,6 +507,24 @@ void apr_probe_writable_fds(void);
* @param sig How to kill the process.
*/
apr_status_t apr_kill(apr_proc_t *proc, int sig);
+
+/**
+ * Register a process to be killed when a pool dies.
+ * @param a The pool to use to define the processes lifetime
+ * @param pid The process to register
+ * @param how How to kill the process, one of:
+ * <PRE>
+ * kill_never -- process is never sent any signals
+ * kill_always -- process is sent SIGKILL on apr_pool_t cleanup
+ * kill_after_timeout -- SIGTERM, wait 3 seconds, SIGKILL
+ * just_wait -- wait forever for the process to complete
+ * kill_only_once -- send SIGTERM and then wait
+ * </PRE>
+ * @deffunc void apr_note_subprocess(struct apr_pool_t *a, apr_proc_t *pid, enum kill_conditions how)
+ */
+APR_DECLARE(void) apr_note_subprocess(apr_pool_t *a, apr_proc_t *pid,
+ enum kill_conditions how);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/apr_time.h b/include/apr_time.h
index 540c12c40..d0aff4d6e 100644
--- a/include/apr_time.h
+++ b/include/apr_time.h
@@ -55,7 +55,8 @@
#ifndef APR_TIME_H
#define APR_TIME_H
-#include "apr_general.h"
+#include "apr.h"
+#include "apr_pools.h"
#include "apr_errno.h"
#ifdef __cplusplus
diff --git a/include/apr_user.h b/include/apr_user.h
index a00308077..f45c0f532 100644
--- a/include/apr_user.h
+++ b/include/apr_user.h
@@ -56,6 +56,8 @@
#define APR_USER_H
#include "apr.h"
+#include "apr_errno.h"
+#include "apr_pools.h"
#if APR_HAS_USER
diff --git a/include/apr_xlate.h b/include/apr_xlate.h
index fb5eb14a8..1d78d8799 100644
--- a/include/apr_xlate.h
+++ b/include/apr_xlate.h
@@ -56,8 +56,7 @@
#define APR_XLATE_H
#include "apr.h"
-#include "apr_general.h"
-#include "apr_time.h"
+#include "apr_pools.h"
#include "apr_errno.h"
#ifdef __cplusplus
diff --git a/lib/apr_pools.c b/lib/apr_pools.c
index 736a0efd1..4368af4b2 100644
--- a/lib/apr_pools.c
+++ b/lib/apr_pools.c
@@ -69,6 +69,9 @@
#include "apr_lib.h"
#include "apr_lock.h"
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index 736a0efd1..4368af4b2 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -69,6 +69,9 @@
#include "apr_lib.h"
#include "apr_lock.h"
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
diff --git a/strings/apr_strnatcmp.c b/strings/apr_strnatcmp.c
index 1070ffdab..32140e3b3 100644
--- a/strings/apr_strnatcmp.c
+++ b/strings/apr_strnatcmp.c
@@ -23,9 +23,9 @@
#include <ctype.h>
#include <string.h>
#include <assert.h>
-#include <stdio.h>
#include "apr_strings.h"
+#include "apr_lib.h" /* for apr_is*() */
#if defined(__GNUC__)
# define UNUSED __attribute__((__unused__))