Main Page | Modules | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

apr_pools.c File Reference

#include "apr.h"
#include "apr_private.h"
#include "apr_atomic.h"
#include "apr_portable.h"
#include "apr_strings.h"
#include "apr_general.h"
#include "apr_pools.h"
#include "apr_allocator.h"
#include "apr_lib.h"
#include "apr_thread_mutex.h"
#include "apr_hash.h"
#include "apr_time.h"
#include "apr_want.h"

Include dependency graph for apr_pools.c:

Go to the source code of this file.

Defines

#define APR_WANT_MEMFUNC
#define MIN_ALLOC   8192
#define MAX_INDEX   20
#define BOUNDARY_INDEX   12
#define BOUNDARY_SIZE   (1 << BOUNDARY_INDEX)
#define TIMEOUT_USECS   3000000
#define TIMEOUT_INTERVAL   46875
#define SIZEOF_ALLOCATOR_T   APR_ALIGN_DEFAULT(sizeof(apr_allocator_t))
#define APR_POOL_DEBUG_GENERAL   0x01
#define APR_POOL_DEBUG_VERBOSE   0x02
#define APR_POOL_DEBUG_LIFETIME   0x04
#define APR_POOL_DEBUG_OWNER   0x08
#define APR_POOL_DEBUG_VERBOSE_ALLOC   0x10
#define APR_POOL_DEBUG_VERBOSE_ALL
#define SIZEOF_POOL_T   APR_ALIGN_DEFAULT(sizeof(apr_pool_t))
#define list_insert(node, point)
#define list_remove(node)
#define APR_PSPRINTF_MIN_STRINGSIZE   32

Typedefs

typedef cleanup_t cleanup_t

Functions

 APR_DECLARE (apr_status_t)
 APR_DECLARE (void)
 APR_DECLARE (apr_pool_t *)
static APR_INLINE apr_memnode_tallocator_alloc (apr_allocator_t *allocator, apr_size_t size)
static APR_INLINE void allocator_free (apr_allocator_t *allocator, apr_memnode_t *node)
 APR_DECLARE (apr_memnode_t *)
static void run_cleanups (cleanup_t **c)
static void run_child_cleanups (cleanup_t **c)
static void free_proc_chain (struct process_chain *procs)
 APR_DECLARE (void *)
static int psprintf_flush (apr_vformatter_buff_t *vbuff)
 APR_DECLARE (char *)
 APR_DECLARE_NONSTD (char *)
 APR_DECLARE (apr_abortfunc_t)
 APR_DECLARE (apr_allocator_t *)
 APR_DECLARE (int)
static void cleanup_pool_for_exec (apr_pool_t *p)
 APR_DECLARE_NONSTD (apr_status_t)

Variables

static apr_byte_t apr_pools_initialized = 0
static apr_pool_tglobal_pool = NULL
static apr_allocator_tglobal_allocator = NULL


Define Documentation

#define APR_POOL_DEBUG_GENERAL   0x01
 

Definition at line 386 of file apr_pools.c.

#define APR_POOL_DEBUG_LIFETIME   0x04
 

Definition at line 388 of file apr_pools.c.

#define APR_POOL_DEBUG_OWNER   0x08
 

Definition at line 389 of file apr_pools.c.

#define APR_POOL_DEBUG_VERBOSE   0x02
 

Definition at line 387 of file apr_pools.c.

#define APR_POOL_DEBUG_VERBOSE_ALL
 

Value:

Definition at line 392 of file apr_pools.c.

#define APR_POOL_DEBUG_VERBOSE_ALLOC   0x10
 

Definition at line 390 of file apr_pools.c.

#define APR_PSPRINTF_MIN_STRINGSIZE   32
 

Definition at line 887 of file apr_pools.c.

Referenced by psprintf_flush().

#define APR_WANT_MEMFUNC
 

Definition at line 30 of file apr_pools.c.

#define BOUNDARY_INDEX   12
 

Definition at line 49 of file apr_pools.c.

Referenced by allocator_alloc(), APR_DECLARE(), and psprintf_flush().

#define BOUNDARY_SIZE   (1 << BOUNDARY_INDEX)
 

Definition at line 50 of file apr_pools.c.

Referenced by allocator_alloc(), APR_DECLARE(), and psprintf_flush().

#define list_insert node,
point   ) 
 

Value:

do {           \
    node->ref = point->ref;                     \
    *node->ref = node;                          \
    node->next = point;                         \
    point->ref = &node->next;                   \
} while (0)

Definition at line 582 of file apr_pools.c.

Referenced by APR_DECLARE(), and psprintf_flush().

#define list_remove node   ) 
 

Value:

do {                  \
    *node->ref = node->next;                    \
    node->next->ref = node->ref;                \
} while (0)

Definition at line 590 of file apr_pools.c.

Referenced by APR_DECLARE(), and psprintf_flush().

#define MAX_INDEX   20
 

Definition at line 47 of file apr_pools.c.

Referenced by allocator_free(), and APR_DECLARE().

#define MIN_ALLOC   8192
 

Definition at line 46 of file apr_pools.c.

Referenced by allocator_alloc().

#define SIZEOF_ALLOCATOR_T   APR_ALIGN_DEFAULT(sizeof(apr_allocator_t))
 

Definition at line 77 of file apr_pools.c.

Referenced by APR_DECLARE().

#define SIZEOF_POOL_T   APR_ALIGN_DEFAULT(sizeof(apr_pool_t))
 

Definition at line 467 of file apr_pools.c.

#define TIMEOUT_INTERVAL   46875
 

Definition at line 60 of file apr_pools.c.

Referenced by free_proc_chain().

#define TIMEOUT_USECS   3000000
 

Definition at line 59 of file apr_pools.c.

Referenced by free_proc_chain().


Typedef Documentation

typedef struct cleanup_t cleanup_t
 

Definition at line 400 of file apr_pools.c.


Function Documentation

static APR_INLINE apr_memnode_t* allocator_alloc apr_allocator_t allocator,
apr_size_t  size
[static]
 

Definition at line 169 of file apr_pools.c.

References APR_ALIGN, APR_MEMNODE_T_SIZE, BOUNDARY_INDEX, BOUNDARY_SIZE, apr_allocator_t::current_free_index, apr_memnode_t::endp, apr_memnode_t::first_avail, apr_allocator_t::free, apr_memnode_t::index, apr_allocator_t::max_free_index, apr_allocator_t::max_index, MIN_ALLOC, apr_memnode_t::next, NULL, and ref.

Referenced by APR_DECLARE(), and psprintf_flush().

static APR_INLINE void allocator_free apr_allocator_t allocator,
apr_memnode_t node
[static]
 

Definition at line 305 of file apr_pools.c.

References APR_ALLOCATOR_MAX_FREE_UNLIMITED, apr_memnode_t::index, MAX_INDEX, apr_memnode_t::next, and NULL.

Referenced by APR_DECLARE().

APR_DECLARE int   ) 
 

Definition at line 1771 of file apr_pools.c.

References NULL.

APR_DECLARE char *   ) 
 

Definition at line 961 of file apr_pools.c.

References allocator_free(), APR_ALIGN, APR_ALIGN_DEFAULT, APR_ENOMEM, BOUNDARY_INDEX, BOUNDARY_SIZE, apr_vformatter_buff_t::curpos, apr_memnode_t::endp, apr_vformatter_buff_t::endpos, apr_memnode_t::first_avail, psprintf_data::free, apr_memnode_t::free_index, psprintf_data::got_a_new_node, list_insert, list_remove, apr_memnode_t::next, psprintf_data::node, NULL, psprintf_data::pool, psprintf_flush(), and psprintf_data::vbuff.

Here is the call graph for this function:

APR_DECLARE apr_memnode_t  ) 
 

Definition at line 368 of file apr_pools.c.

References allocator_alloc().

Here is the call graph for this function:

APR_DECLARE_NONSTD char *   ) 
 

Definition at line 1725 of file apr_pools.c.

static void cleanup_pool_for_exec apr_pool_t p  )  [static]
 

Definition at line 1968 of file apr_pools.c.

References run_child_cleanups().

Here is the call graph for this function:

static void free_proc_chain struct process_chain procs  )  [static]
 

Definition at line 2016 of file apr_pools.c.

References APR_CHILD_NOTDONE, APR_DECLARE(), APR_KILL_AFTER_TIMEOUT, APR_KILL_ALWAYS, APR_KILL_NEVER, APR_KILL_ONLY_ONCE, APR_NOWAIT, apr_pcalloc, APR_SUCCESS, APR_WAIT, process_chain::kill_how, process_chain::next, NULL, process_chain::proc, TIMEOUT_INTERVAL, and TIMEOUT_USECS.

Here is the call graph for this function:

static int psprintf_flush apr_vformatter_buff_t vbuff  )  [static]
 

Definition at line 889 of file apr_pools.c.

References apr_pool_t::active, apr_pool_t::allocator, allocator_alloc(), APR_ALIGN, APR_PSPRINTF_MIN_STRINGSIZE, BOUNDARY_INDEX, BOUNDARY_SIZE, apr_vformatter_buff_t::curpos, apr_memnode_t::endp, apr_vformatter_buff_t::endpos, apr_memnode_t::first_avail, psprintf_data::free, apr_memnode_t::free_index, psprintf_data::got_a_new_node, list_insert, list_remove, apr_memnode_t::next, psprintf_data::node, NULL, psprintf_data::pool, and psprintf_data::vbuff.

Referenced by APR_DECLARE().

Here is the call graph for this function:

static void run_child_cleanups cleanup_t **  c  )  [static]
 

Definition at line 1957 of file apr_pools.c.

References cleanup_t::child_cleanup_fn, cleanup_t::data, and cleanup_t::next.

Referenced by cleanup_pool_for_exec().

static void run_cleanups cleanup_t **  c  )  [static]
 

Definition at line 1946 of file apr_pools.c.

References cleanup_t::data, cleanup_t::next, and cleanup_t::plain_cleanup_fn.


Variable Documentation

apr_byte_t apr_pools_initialized = 0 [static]
 

Definition at line 474 of file apr_pools.c.

apr_allocator_t* global_allocator = NULL [static]
 

Definition at line 478 of file apr_pools.c.

apr_pool_t* global_pool = NULL [static]
 

Definition at line 475 of file apr_pools.c.

Referenced by open_scoreboard().