GME
13
|
Allocate a block of memory from a pool and set all of the memory to 0
p | The pool to allocate from |
size | The amount of memory to allocate |
Definition at line 461 of file apr_pools.h.
#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__) |
the place in the code where the particular function was called
Definition at line 143 of file apr_pools.h.
#define apr_pool_create | ( | newpool, | |
parent | |||
) | apr_pool_create_ex(newpool, parent, NULL, NULL) |
Create a new pool.
newpool | The pool we have just created. |
parent | 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 its parent pool's attributes, except the apr_pool_t will be a sub-pool. |
Definition at line 318 of file apr_pools.h.
#define apr_pool_create_core | ( | newpool | ) | apr_pool_create_unmanaged_ex(newpool, NULL, NULL) |
Create a new pool.
newpool | The pool we have just created. |
Definition at line 339 of file apr_pools.h.
#define apr_pool_create_unmanaged | ( | newpool | ) | apr_pool_create_unmanaged_ex(newpool, NULL, NULL) |
Definition at line 341 of file apr_pools.h.
#define APR_POOL_DEBUG 0 |
Pool debug levels
| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | --------------------------------- | | | | | | | | x | General debug code enabled (useful in combination with --with-efence).
| | | | | | | x | | Verbose output on stderr (report CREATE, CLEAR, DESTROY).
| | | | x | | | | | Verbose output on stderr (report PALLOC, PCALLOC).
| | | | | | x | | | Lifetime checking. On each use of a pool, check its lifetime. If the pool is out of scope, abort(). In combination with the verbose flag above, it will output LIFE in such an event prior to aborting.
| | | | | x | | | | Pool owner checking. On each use of a pool, check if the current thread is the pools owner. If not, abort(). In combination with the verbose flag above, it will output OWNER in such an event prior to aborting. Use the debug function apr_pool_owner_set() to switch a pools ownership.
When no debug level was specified, assume general debug mode. If level 0 was specified, debugging is switched off
Definition at line 139 of file apr_pools.h.
#define APR_POOL_DECLARE_ACCESSOR | ( | type | ) |
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \ (const apr_##type##_t *the##type)
Declaration helper macro to construct apr_foo_pool_get()s.
This standardized macro is used by opaque (APR) data types to return the apr_pool_t that is associated with the data type.
APR_POOL_DECLARE_ACCESSOR() is used in a header file to declare the accessor function. A typical usage and result would be:
APR_POOL_DECLARE_ACCESSOR(file); becomes: APR_DECLARE(apr_pool_t *) apr_file_pool_get(apr_file_t *ob);
Definition at line 81 of file apr_pools.h.
#define APR_POOL_IMPLEMENT_ACCESSOR | ( | type | ) |
APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \ (const apr_##type##_t *the##type) \ { return the##type->pool; }
Implementation helper macro to provide apr_foo_pool_get()s.
In the implementation, the APR_POOL_IMPLEMENT_ACCESSOR() is used to actually define the function. It assumes the field is named "pool".
Definition at line 91 of file apr_pools.h.
typedef int(* apr_abortfunc_t)(int retcode) |
A function that is called when allocation fails.
Definition at line 148 of file apr_pools.h.
typedef struct apr_pool_t apr_pool_t |
The fundamental pool type
Definition at line 60 of file apr_pools.h.
apr_pool_t apr_abortfunc_t apr_allocator_t* allocator __attribute__ | ( | (nonnull(1)) | ) |
apr_pool_t* pool __attribute__ | ( | (nonnull(2)) | ) |
const char apr_pool_t* pool __attribute__ | ( | (nonnull(1, 2, 3)) | ) |
Setup all of the internal structures required to use pools
Create a new pool.
newpool | The pool we have just created. |
parent | 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 its parent pool's attributes, except the apr_pool_t will be a sub-pool. |
abort_fn | A function to use if the pool cannot allocate more memory. |
allocator | The allocator to use with the new pool. If NULL the allocator of the parent pool will be used. |
Create a new pool.
Create a new unmanaged pool.
newpool | The pool we have just created. |
abort_fn | A function to use if the pool cannot allocate more memory. |
allocator | The allocator to use with the new pool. If NULL a new allocator will be crated with newpool as owner. |
Debug version of apr_pool_create_ex.
newpool |
parent |
abort_fn |
allocator |
file_line | Where the function is called from. This is usually APR_POOL__FILE_LINE__. |
Debug version of apr_pool_create_core_ex.
Debug version of apr_pool_create_unmanaged_ex.
newpool |
abort_fn |
allocator |
file_line | Where the function is called from. This is usually APR_POOL__FILE_LINE__. |
Determine if pool a is an ancestor of pool b.
a | The pool to search |
b | The pool to search for |
Set the data associated with the current pool
data | The user data associated with the pool. |
key | The key to use for association |
cleanup | The cleanup program to use to cleanup the data (NULL if none) |
pool | The current pool |
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. Therefore it is advised that steps are taken to ensure that unique keys are used for all of the userdata objects in a particular pool (the same key in two different pools or a pool and one of its subpools is okay) at all times. Careful namespace prefixing of key names is a typical way to help ensure this uniqueness.
Set the data associated with the current pool
data | The user data associated with the pool. |
key | The key to use for association |
cleanup | The cleanup program to use to cleanup the data (NULL if none) |
pool | The current pool |
Return the data associated with the current pool.
data | The user data associated with the pool. |
key | The key for the data to retrieve |
pool | The current pool. |
APR_DECLARE | ( | void | ) |
Tear down all of the internal structures required to use pools
Clear all memory in the pool and run all the cleanups. This also destroys all subpools.
p | The pool to clear |
Debug version of apr_pool_clear.
p | See: apr_pool_clear. |
file_line | Where the function is called from. This is usually APR_POOL__FILE_LINE__. |
Destroy the pool. This takes similar action as apr_pool_clear() and then frees all the memory.
p | The pool to destroy |
Debug version of apr_pool_destroy.
p | See: apr_pool_destroy. |
file_line | Where the function is called from. This is usually APR_POOL__FILE_LINE__. |
Set the function to be called when an allocation failure occurs.
Tag a pool (give it a name)
pool | The pool to tag |
tag | The tag |
Register a function to be called when a pool is cleared or destroyed
p | The pool register the cleanup with |
data | The data to pass to the cleanup function. |
plain_cleanup | The function to call when the pool is cleared or destroyed |
child_cleanup | The function to call when a child process is about to exec - this function is called in the child, obviously! |
Remove a previously registered cleanup function.
The cleanup most recently registered with p having the same values of data and cleanup will be removed.
p | The pool to remove the cleanup from |
data | The data of the registered cleanup |
cleanup | The function to remove from cleanup |
Replace the child cleanup function of a previously registered cleanup.
The cleanup most recently registered with p having the same values of data and plain_cleanup will have the registered child cleanup function replaced with child_cleanup.
p | The pool of the registered cleanup |
data | The data of the registered cleanup |
plain_cleanup | The plain cleanup function of the registered cleanup |
child_cleanup | The function to register as the child cleanup |
Run all registered child cleanups, in preparation for an exec() call in a forked child -- close files, etc., but *don't* flush I/O buffers, *don't* wait for subprocesses, and *don't* free any memory.
APR_DECLARE | ( | apr_allocator_t * | ) |
Find the pool's allocator
pool | The pool to get the allocator from. |
APR_DECLARE | ( | void * | ) |
Allocate a block of memory from a pool
p | The pool to allocate from |
size | The amount of memory to allocate |
Debug version of apr_palloc
p | See: apr_palloc |
size | See: apr_palloc |
file_line | Where the function is called from. This is usually APR_POOL__FILE_LINE__. |
Debug version of apr_pcalloc
p | See: apr_pcalloc |
size | See: apr_pcalloc |
file_line | Where the function is called from. This is usually APR_POOL__FILE_LINE__. |
Get the abort function associated with the specified pool.
pool | The pool for retrieving the abort function. |
APR_DECLARE | ( | apr_pool_t * | ) |
Get the parent pool of the specified pool.
pool | The pool for retrieving the parent pool. |
const char *tag __attribute__ | ( | (nonnull(2, 4)) | ) |
Definition at line 563 of file apr_pools.h.
Definition at line 197 of file apr_pools.h.
Definition at line 207 of file apr_pools.h.
apr_bucket ** b |
Definition at line 525 of file apr_pools.h.
const void apr_status_t(*) apr_status_t(*) void apr_status_t(* cleanup)(void *)) __attribute__((nonnull(3))) |
Definition at line 561 of file apr_pools.h.
apr_abortfunc_t apr_allocator_t const char* file_line |
Definition at line 261 of file apr_pools.h.
const char* key |
Definition at line 560 of file apr_pools.h.
Definition at line 197 of file apr_pools.h.
apr_size_t size |
Definition at line 440 of file apr_pools.h.