apr  1.7.0
About: APR (Apache Portable Runtime) project offers software libraries that provide a predictable and consistent interface to underlying platform-specific implementations (APR core library).
  Fossies Dox: apr-1.7.0.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Time Routines

Data Structures

struct  apr_time_exp_t
 

Macros

#define APR_TIME_C(val)   APR_INT64_C(val)
 
#define APR_TIME_T_FMT   APR_INT64_T_FMT
 
#define APR_USEC_PER_SEC   APR_TIME_C(1000000)
 
#define apr_time_sec(time)   ((time) / APR_USEC_PER_SEC)
 
#define apr_time_usec(time)   ((time) % APR_USEC_PER_SEC)
 
#define apr_time_msec(time)   (((time) / 1000) % 1000)
 
#define apr_time_as_msec(time)   ((time) / 1000)
 
#define apr_time_from_msec(msec)   ((apr_time_t)(msec) * 1000)
 
#define apr_time_from_sec(sec)   ((apr_time_t)(sec) * APR_USEC_PER_SEC)
 
#define apr_time_make(sec, usec)
 
#define APR_RFC822_DATE_LEN   (30)
 
#define APR_CTIME_LEN   (25)
 

Typedefs

typedef apr_int64_t apr_time_t
 
typedef apr_int64_t apr_interval_time_t
 
typedef apr_int32_t apr_short_interval_time_t
 
typedef struct apr_time_exp_t apr_time_exp_t
 

Functions

 APR_DECLARE (apr_time_t) apr_time_now(void)
 
 APR_DECLARE (apr_status_t) apr_time_ansi_put(apr_time_t *result
 
 APR_DECLARE (void) apr_sleep(apr_interval_time_t t)
 

Variables

const APR_DECLARE_DATA char apr_month_snames [12][4]
 
const APR_DECLARE_DATA char apr_day_snames [7][4]
 
time_t input
 
apr_time_t apr_int32_t offs
 
apr_time_t t
 
apr_size_t * retsize
 
apr_size_t apr_size_t max
 
apr_size_t apr_size_t const char * format
 
apr_size_t apr_size_t const char apr_time_exp_ttm
 

Detailed Description

Macro Definition Documentation

◆ APR_CTIME_LEN

#define APR_CTIME_LEN   (25)

length of a CTIME date

Definition at line 198 of file apr_time.h.

◆ APR_RFC822_DATE_LEN

#define APR_RFC822_DATE_LEN   (30)

length of a RFC822 Date

Definition at line 186 of file apr_time.h.

◆ apr_time_as_msec

#define apr_time_as_msec (   time)    ((time) / 1000)
Returns
apr_time_t as a msec

Definition at line 72 of file apr_time.h.

◆ APR_TIME_C

#define APR_TIME_C (   val)    APR_INT64_C(val)

mechanism to properly type apr_time_t literals

Definition at line 49 of file apr_time.h.

◆ apr_time_from_msec

#define apr_time_from_msec (   msec)    ((apr_time_t)(msec) * 1000)
Returns
milliseconds as an apr_time_t

Definition at line 75 of file apr_time.h.

◆ apr_time_from_sec

#define apr_time_from_sec (   sec)    ((apr_time_t)(sec) * APR_USEC_PER_SEC)
Returns
seconds as an apr_time_t

Definition at line 78 of file apr_time.h.

◆ apr_time_make

#define apr_time_make (   sec,
  usec 
)
Value:
+ (apr_time_t)(usec))
Returns
a second and usec combination as an apr_time_t

Definition at line 81 of file apr_time.h.

◆ apr_time_msec

#define apr_time_msec (   time)    (((time) / 1000) % 1000)
Returns
apr_time_t as a msec

Definition at line 69 of file apr_time.h.

◆ apr_time_sec

#define apr_time_sec (   time)    ((time) / APR_USEC_PER_SEC)
Returns
apr_time_t as a second

Definition at line 63 of file apr_time.h.

◆ APR_TIME_T_FMT

#define APR_TIME_T_FMT   APR_INT64_T_FMT

mechanism to properly print apr_time_t values

Definition at line 52 of file apr_time.h.

◆ apr_time_usec

#define apr_time_usec (   time)    ((time) % APR_USEC_PER_SEC)
Returns
apr_time_t as a usec

Definition at line 66 of file apr_time.h.

◆ APR_USEC_PER_SEC

#define APR_USEC_PER_SEC   APR_TIME_C(1000000)

number of microseconds per second

Definition at line 60 of file apr_time.h.

Typedef Documentation

◆ apr_interval_time_t

typedef apr_int64_t apr_interval_time_t

intervals for I/O timeouts, in microseconds

Definition at line 55 of file apr_time.h.

◆ apr_short_interval_time_t

typedef apr_int32_t apr_short_interval_time_t

short interval for I/O timeouts, in microseconds

Definition at line 57 of file apr_time.h.

◆ apr_time_exp_t

See also
apr_time_exp_t

Definition at line 90 of file apr_time.h.

◆ apr_time_t

typedef apr_int64_t apr_time_t

number of microseconds since 00:00:00 January 1, 1970 UTC

Definition at line 45 of file apr_time.h.

Function Documentation

◆ APR_DECLARE() [1/3]

APR_DECLARE ( apr_status_t  )

Convert an ansi time_t to an apr_time_t

Parameters
resultthe resulting apr_time_t
inputthe time_t to convert

Convert a time to its human readable components using an offset from GMT.

Parameters
resultthe exploded time
inputthe time to explode
offsthe number of seconds offset to apply

Convert a time to its human readable components (GMT).

Parameters
resultthe exploded time
inputthe time to explode

Convert a time to its human readable components in the local timezone.

Parameters
resultthe exploded time
inputthe time to explode

Convert time value from human readable format to a numeric apr_time_t (elapsed microseconds since the epoch).

Parameters
resultthe resulting imploded time
inputthe input exploded time

Convert time value from human readable format to a numeric apr_time_t that always represents GMT.

Parameters
resultthe resulting imploded time
inputthe input exploded time

apr_rfc822_date formats dates in the RFC822 format in an efficient manner. It is a fixed length format which requires APR_RFC822_DATA_LEN bytes of storage, including the trailing NUL terminator.

Parameters
date_strString to write to.
tthe time to convert

apr_ctime formats dates in the ctime() format in an efficient manner. It is a fixed length format and requires APR_CTIME_LEN bytes of storage including the trailing NUL terminator. Unlike ANSI/ISO C ctime(), apr_ctime() does not include a \n at the end of the string.

Parameters
date_strString to write to.
tthe time to convert

Formats the exploded time according to the format specified

Parameters
sstring to write to
retsizeThe length of the returned string
maxThe maximum length of the string
formatThe format for the time string
tmThe time to convert

The problem with trying to output the entire iovec is that we cannot maintain the behaviour that a real writev would have. If we iterate over the iovec one at a time, we lose the atomic properties of writev(). The other option is to combine the entire iovec into one buffer that we could then send in one call to write(). This is not reasonable since we do not know how much data an iovec could contain.

The only reasonable option, that maintains the semantics of a real writev(), is to only write the first iovec. Callers of file_writev() must deal with partial writes as they normally would. If you want to ensure an entire iovec is written, use apr_file_writev_full().

Definition at line 21 of file apr_atomic.c.

References apr__atomic_generic64_init(), APR_SUCCESS, and p.

◆ APR_DECLARE() [2/3]

APR_DECLARE ( apr_time_t  )
Returns
the current time

Definition at line 244 of file apr_strings.c.

References apr_isspace, APR_USEC_PER_SEC, aprtime, base, c, FileTimeToAprTime(), INT64_MAX, INT64_MIN, s, and val.

◆ APR_DECLARE() [3/3]

APR_DECLARE ( void  )

Sleep for the specified number of micro-seconds.

Parameters
tdesired amount of time to sleep.
Warning
May sleep for longer than the specified time.

Improve the clock resolution for the lifetime of the given pool. Generally this is only desirable on benchmarking and other very time-sensitive applications, and has no impact on most platforms.

Parameters
pThe pool to associate the finer clock resolution

Tear down any APR internal data structures which aren't torn down automatically, same as apr_terminate()

Remarks
An APR program must call either the apr_terminate() or apr_terminate2 function once it it has finished using APR services. The APR developers suggest using atexit(apr_terminate) to ensure this is done. apr_terminate2 exists to allow non-c language apps to tear down apr, while apr_terminate() is recommended from c language applications.

Destroy an allocator

Parameters
allocatorThe allocator to be destroyed
Remarks
Any memnodes not given back to the allocator prior to destroying will not be free()d.

Free a list of blocks of mem, giving them back to the allocator. The list is typically terminated by a memnode with its next field set to NULL.

Parameters
allocatorThe allocator to give the mem back to
memnodeThe memory node to return

Set the owner of the allocator

Parameters
allocatorThe allocator to set the owner for
poolThe pool that is to own the allocator
Remarks
Typically pool is the highest level pool using the allocator

Set the current threshold at which the allocator should start giving blocks back to the system.

Parameters
allocatorThe allocator to set the threshold on
sizeThe threshold. 0 == unlimited.

Like apr_cstr_split(), but append to existing array instead of creating a new one. Allocate the copied substrings in pool (i.e., caller decides whether or not to pass array->pool as pool).

Since
New in 1.6

Associate a value with a key in a hash table.

Parameters
htThe hash table
keyPointer to the key
klenLength of the key. Can be APR_HASH_KEY_STRING to use the string length.
valValue to associate with the key
Remarks
If the value is NULL the hash entry is deleted. The key is stored as is, and so must have a lifetime at least as long as the hash table's pool.

Get the current entry's details from the iteration state.

Parameters
hiThe iteration state
keyReturn pointer for the pointer to the key.
klenReturn pointer for the key length.
valReturn pointer for the associated value.
Remarks
The return pointers should point to a variable that will be set to the corresponding data, or they may be NULL if the data isn't interesting.

Clear any key/value pairs in the hash table.

Parameters
htThe hash table

Tear down all of the internal structures required to use pools

Remarks
Programs do NOT need to call this directly. APR will call this automatically from apr_terminate.

Clear all memory in the pool and run all the cleanups. This also destroys all subpools.

Parameters
pThe pool to clear
Remarks
This does not actually free the memory, it just allows the pool to re-use this memory for the next allocation.
See also
apr_pool_destroy()

Debug version of apr_pool_clear.

Parameters
pSee: apr_pool_clear.
file_lineWhere the function is called from. This is usually APR_POOL__FILE_LINE__.
Remarks
Only available when APR_POOL_DEBUG is defined. Call this directly if you have your apr_pool_clear calls in a wrapper function and wish to override the file_line argument to reflect the caller of your wrapper function. If you do not have apr_pool_clear in a wrapper, trust the macro and don't call apr_pool_destroy_clear directly.

Destroy the pool. This takes similar action as apr_pool_clear() and then frees all the memory.

Parameters
pThe pool to destroy
Remarks
This will actually free the memory

Debug version of apr_pool_destroy.

Parameters
pSee: apr_pool_destroy.
file_lineWhere the function is called from. This is usually APR_POOL__FILE_LINE__.
Remarks
Only available when APR_POOL_DEBUG is defined. Call this directly if you have your apr_pool_destroy calls in a wrapper function and wish to override the file_line argument to reflect the caller of your wrapper function. If you do not have apr_pool_destroy in a wrapper, trust the macro and don't call apr_pool_destroy_debug directly.

Set the function to be called when an allocation failure occurs.

Remarks
If the program wants APR to exit on a memory allocation error, then this function can be called to set the callback to use (for performing cleanup and then exiting). If this function is not called, then APR will return an error and expect the calling program to deal with the error accordingly.

Tag a pool (give it a name)

Parameters
poolThe pool to tag
tagThe tag

Register a function to be called when a pool is cleared or destroyed

Parameters
pThe pool to register the cleanup with
dataThe data to pass to the cleanup function.
plain_cleanupThe function to call when the pool is cleared or destroyed
child_cleanupThe 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.

Parameters
pThe pool to remove the cleanup from
dataThe data of the registered cleanup
cleanupThe function to remove from cleanup
Remarks
For some strange reason only the plain_cleanup is handled by this function

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.

Parameters
pThe pool of the registered cleanup
dataThe data of the registered cleanup
plain_cleanupThe plain cleanup function of the registered cleanup
child_cleanupThe 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.

Initialize a PRNG state

Parameters
gThe PRNG state
pThe pool to allocate from
pool_hashPool hash functions
key_hashKey hash functions
prng_hashPRNG hash functions

Mix the randomness pools.

Parameters
gThe PRNG state
entropy_Entropy buffer
bytesLength of entropy_ in bytes

Ensures that E bits of conditional entropy are mixed into the PRNG before any further randomness is extracted.

Parameters
gThe RNG state

Mix the randomness pools after forking.

Parameters
procThe resulting process handle from apr_proc_fork()
Remarks
Call this in the child after forking to mix the randomness pools. Note that its generally a bad idea to fork a process with a real PRNG in it - better to have the PRNG externally and get the randomness from there. However, if you really must do it, then you should supply all your entropy to all the PRNGs - don't worry, they won't produce the same output.
Note that apr_proc_fork() calls this for you, so only weird applications need ever call it themselves.

Free memory using the same mechanism as the skip list.

Parameters
slThe skip list
memThe object to free
Remarks
If a pool was provided to apr_skiplist_init(), memory will be added to a free list maintained with the skip list and be available to operations on the skip list or to other calls to apr_skiplist_alloc(). Otherwise, memory will be freed using the C standard library heap functions.

Set the comparison functions to be used for searching the skip list.

Parameters
slThe skip list
XXX1FIXME
XXX2FIXME
Remarks
If existing comparison functions are being replaced, the index will be replaced during this call. That is a potentially expensive operation.

Set the indexing functions to the specified comparison functions and rebuild the index.

Parameters
slThe skip list
XXX1FIXME
XXX2FIXME
Remarks
If an index already exists, it will not be replaced and the comparison functions will not be changed.

Remove all elements from the skip list.

Parameters
slThe skip list
myfreeA function to be called for each removed element

Remove each element from the skip list.

Parameters
slThe skip list
myfreeA function to be called for each removed element

Set a predefined maximum height for the skip list.

Parameters
slThe skip list
toThe preheight to set, or a nul/negative value to disable.
Remarks
When a preheight is used, the height of each inserted element is computed randomly up to this preheight instead of the current skip list's height plus one used by the default implementation. Using a preheight can probably ensure more fairness with long living elements (since with an adaptative height, former elements may have been created with a low height, hence a longest path to reach them while the skip list grows). On the other hand, the default behaviour (preheight <= 0) with a growing and decreasing maximum height is more adaptative/suitable for short living values.
Note
Should be called before any insertion/add.

Remove all elements from an array.

Parameters
arrThe array to remove all elements from.
Remarks
As the underlying storage is allocated from a pool, no memory is freed by this operation, but is available for reuse.

Concatenate two arrays together.

Parameters
dstThe destination array, and the one to go first in the combined array
srcThe source array to add to the destination array

Delete all of the elements from a table.

Parameters
tThe table to clear

Add a key/value pair to a table. If another element already exists with the same key, this will overwrite the old data.

Parameters
tThe table to add the data to.
keyThe key to use (case does not matter)
valThe value to add
Remarks
When adding data, this function makes a copy of both the key and the value.

Add a key/value pair to a table. If another element already exists with the same key, this will overwrite the old data.

Parameters
tThe table to add the data to.
keyThe key to use (case does not matter)
valThe value to add
Warning
When adding data, this function does not make a copy of the key or the value, so care should be taken to ensure that the values will not change after they have been added..

Remove data from the table.

Parameters
tThe table to remove data from
keyThe key of the data being removed (case does not matter)

Add data to a table by merging the value with data that has already been stored. The merging is done by concatenating the two values, separated by the string ", ".

Parameters
tThe table to search for the data
keyThe key to merge data for (case does not matter)
valThe data to add
Remarks
If the key is not found, then this function acts like apr_table_add()

Add data to a table by merging the value with data that has already been stored. The merging is done by concatenating the two values, separated by the string ", ".

Parameters
tThe table to search for the data
keyThe key to merge data for (case does not matter)
valThe data to add
Remarks
If the key is not found, then this function acts like apr_table_addn()

Add data to a table, regardless of whether there is another element with the same key.

Parameters
tThe table to add to
keyThe key to use
valThe value to add.
Remarks
When adding data, this function makes a copy of both the key and the value.

Add data to a table, regardless of whether there is another element with the same key.

Parameters
tThe table to add to
keyThe key to use
valThe value to add.
Remarks
When adding data, this function does not make a copy of the key or the value, so care should be taken to ensure that the values will not change after they have been added.

For each element in table b, either use setn or mergen to add the data to table a. Which method is used is determined by the flags passed in.

Parameters
aThe table to add the data to.
bThe table to iterate over, adding its data to table a
flagsHow to add the table to table a. One of: APR_OVERLAP_TABLES_SET Use apr_table_setn APR_OVERLAP_TABLES_MERGE Use apr_table_mergen APR_OVERLAP_TABLES_ADD Use apr_table_addn
Remarks
When merging duplicates, the two values are concatenated, separated by the string ", ".
This function is highly optimized, and uses less memory and CPU cycles than a function that just loops through table b calling other functions.Conceptually, apr_table_overlap does this:
 apr_array_header_t *barr = apr_table_elts(b);
 apr_table_entry_t *belt = (apr_table_entry_t *)barr->elts;
 int i;
 for (i = 0; i < barr->nelts; ++i) {
     if (flags & APR_OVERLAP_TABLES_MERGE) {
         apr_table_mergen(a, belt[i].key, belt[i].val);
     }
     else if (flags & APR_OVERLAP_TABLES_ADD) {
         apr_table_addn(a, belt[i].key, belt[i].val);
     }
     else {
         apr_table_setn(a, belt[i].key, belt[i].val);
     }
 }

Except that it is more efficient (less space and cpu-time) especially when b has many elements.

Notice the assumptions on the keys and values in b – they must be in an ancestor of a's pool. In practice b and a are usually from the same pool.

Eliminate redundant entries in a table by either overwriting or merging duplicates.

Parameters
tTable.
flagsAPR_OVERLAP_TABLES_MERGE to merge, or APR_OVERLAP_TABLES_SET to overwrite, or APR_OVERLAP_TABLES_ADD to add
Remarks
When merging duplicates, the two values are concatenated, separated by the string ", ".

Register an other_child – a child associated to its registered maintence callback. This callback is invoked when the process dies, is disconnected or disappears.

Parameters
procThe child process to register.
maintenancemaintenance is a function that is invoked with a reason and the data pointer passed here.
dataOpaque context data passed to the maintenance function.
write_fdAn fd that is probed for writing. If it is ever unwritable then the maintenance is invoked with reason OC_REASON_UNWRITABLE.
pThe pool to use for allocating memory.
Bug:

write_fd duplicates the proc->out stream, it's really redundant and should be replaced in the APR 1.0 API with a bitflag of which proc->in/out/err handles should be health checked.

no platform currently tests the pipes health.

Stop watching the specified other child.

Parameters
dataThe data to pass to the maintenance function. This is used to find the process to unregister.
Warning
Since this can be called by a maintenance function while we're scanning the other_children list, all scanners should protect themself by loading ocr->next before calling any maintenance function.

Test one specific other child processes and invoke the maintenance callback with the appropriate reason code, if still running, or the appropriate reason code if the process is no longer healthy.

Parameters
ocrThe registered other child
reasonThe reason code (e.g. APR_OC_REASON_RESTART) if still running

Test all registered other child processes and invoke the maintenance callback with the appropriate reason code, if still running, or the appropriate reason code if the process is no longer healthy.

Parameters
reasonThe reason code (e.g. APR_OC_REASON_RESTART) to running processes

Register a process to be killed when a pool dies.

Parameters
aThe pool to use to define the processes lifetime
procThe process to register
howHow to kill the process, one of:
        APR_KILL_NEVER         -- process is never sent any signals
        APR_KILL_ALWAYS        -- process is sent SIGKILL on apr_pool_t cleanup
        APR_KILL_AFTER_TIMEOUT -- SIGTERM, wait 3 seconds, SIGKILL
        APR_JUST_WAIT          -- wait forever for the process to complete
        APR_KILL_ONLY_ONCE     -- send SIGTERM and then wait

Tear down any APR internal data structures which aren't torn down automatically, same as apr_terminate()

Remarks
An APR program must call either the apr_terminate() or apr_terminate2 function once it it has finished using APR services. The APR developers suggest using atexit(apr_terminate) to ensure this is done. apr_terminate2 exists to allow non-c language apps to tear down apr, while apr_terminate() is recommended from c language applications.

Destroy an allocator

Parameters
allocatorThe allocator to be destroyed
Remarks
Any memnodes not given back to the allocator prior to destroying will not be free()d.

Free a list of blocks of mem, giving them back to the allocator. The list is typically terminated by a memnode with its next field set to NULL.

Parameters
allocatorThe allocator to give the mem back to
memnodeThe memory node to return

Set the owner of the allocator

Parameters
allocatorThe allocator to set the owner for
poolThe pool that is to own the allocator
Remarks
Typically pool is the highest level pool using the allocator

Set the current threshold at which the allocator should start giving blocks back to the system.

Parameters
allocatorThe allocator to set the threshold on
sizeThe threshold. 0 == unlimited.

Like apr_cstr_split(), but append to existing array instead of creating a new one. Allocate the copied substrings in pool (i.e., caller decides whether or not to pass array->pool as pool).

Since
New in 1.6

Associate a value with a key in a hash table.

Parameters
htThe hash table
keyPointer to the key
klenLength of the key. Can be APR_HASH_KEY_STRING to use the string length.
valValue to associate with the key
Remarks
If the value is NULL the hash entry is deleted. The key is stored as is, and so must have a lifetime at least as long as the hash table's pool.

Get the current entry's details from the iteration state.

Parameters
hiThe iteration state
keyReturn pointer for the pointer to the key.
klenReturn pointer for the key length.
valReturn pointer for the associated value.
Remarks
The return pointers should point to a variable that will be set to the corresponding data, or they may be NULL if the data isn't interesting.

Clear any key/value pairs in the hash table.

Parameters
htThe hash table

Tear down all of the internal structures required to use pools

Remarks
Programs do NOT need to call this directly. APR will call this automatically from apr_terminate.

Clear all memory in the pool and run all the cleanups. This also destroys all subpools.

Parameters
pThe pool to clear
Remarks
This does not actually free the memory, it just allows the pool to re-use this memory for the next allocation.
See also
apr_pool_destroy()

Debug version of apr_pool_clear.

Parameters
pSee: apr_pool_clear.
file_lineWhere the function is called from. This is usually APR_POOL__FILE_LINE__.
Remarks
Only available when APR_POOL_DEBUG is defined. Call this directly if you have your apr_pool_clear calls in a wrapper function and wish to override the file_line argument to reflect the caller of your wrapper function. If you do not have apr_pool_clear in a wrapper, trust the macro and don't call apr_pool_destroy_clear directly.

Destroy the pool. This takes similar action as apr_pool_clear() and then frees all the memory.

Parameters
pThe pool to destroy
Remarks
This will actually free the memory

Debug version of apr_pool_destroy.

Parameters
pSee: apr_pool_destroy.
file_lineWhere the function is called from. This is usually APR_POOL__FILE_LINE__.
Remarks
Only available when APR_POOL_DEBUG is defined. Call this directly if you have your apr_pool_destroy calls in a wrapper function and wish to override the file_line argument to reflect the caller of your wrapper function. If you do not have apr_pool_destroy in a wrapper, trust the macro and don't call apr_pool_destroy_debug directly.

Set the function to be called when an allocation failure occurs.

Remarks
If the program wants APR to exit on a memory allocation error, then this function can be called to set the callback to use (for performing cleanup and then exiting). If this function is not called, then APR will return an error and expect the calling program to deal with the error accordingly.

Tag a pool (give it a name)

Parameters
poolThe pool to tag
tagThe tag

Register a function to be called when a pool is cleared or destroyed

Parameters
pThe pool to register the cleanup with
dataThe data to pass to the cleanup function.
plain_cleanupThe function to call when the pool is cleared or destroyed
child_cleanupThe 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.

Parameters
pThe pool to remove the cleanup from
dataThe data of the registered cleanup
cleanupThe function to remove from cleanup
Remarks
For some strange reason only the plain_cleanup is handled by this function

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.

Parameters
pThe pool of the registered cleanup
dataThe data of the registered cleanup
plain_cleanupThe plain cleanup function of the registered cleanup
child_cleanupThe 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.

Initialize a PRNG state

Parameters
gThe PRNG state
pThe pool to allocate from
pool_hashPool hash functions
key_hashKey hash functions
prng_hashPRNG hash functions

Mix the randomness pools.

Parameters
gThe PRNG state
entropy_Entropy buffer
bytesLength of entropy_ in bytes

Ensures that E bits of conditional entropy are mixed into the PRNG before any further randomness is extracted.

Parameters
gThe RNG state

Mix the randomness pools after forking.

Parameters
procThe resulting process handle from apr_proc_fork()
Remarks
Call this in the child after forking to mix the randomness pools. Note that its generally a bad idea to fork a process with a real PRNG in it - better to have the PRNG externally and get the randomness from there. However, if you really must do it, then you should supply all your entropy to all the PRNGs - don't worry, they won't produce the same output.
Note that apr_proc_fork() calls this for you, so only weird applications need ever call it themselves.

Free memory using the same mechanism as the skip list.

Parameters
slThe skip list
memThe object to free
Remarks
If a pool was provided to apr_skiplist_init(), memory will be added to a free list maintained with the skip list and be available to operations on the skip list or to other calls to apr_skiplist_alloc(). Otherwise, memory will be freed using the C standard library heap functions.

Set the comparison functions to be used for searching the skip list.

Parameters
slThe skip list
XXX1FIXME
XXX2FIXME
Remarks
If existing comparison functions are being replaced, the index will be replaced during this call. That is a potentially expensive operation.

Set the indexing functions to the specified comparison functions and rebuild the index.

Parameters
slThe skip list
XXX1FIXME
XXX2FIXME
Remarks
If an index already exists, it will not be replaced and the comparison functions will not be changed.

Remove all elements from the skip list.

Parameters
slThe skip list
myfreeA function to be called for each removed element

Remove each element from the skip list.

Parameters
slThe skip list
myfreeA function to be called for each removed element

Set a predefined maximum height for the skip list.

Parameters
slThe skip list
toThe preheight to set, or a nul/negative value to disable.
Remarks
When a preheight is used, the height of each inserted element is computed randomly up to this preheight instead of the current skip list's height plus one used by the default implementation. Using a preheight can probably ensure more fairness with long living elements (since with an adaptative height, former elements may have been created with a low height, hence a longest path to reach them while the skip list grows). On the other hand, the default behaviour (preheight <= 0) with a growing and decreasing maximum height is more adaptative/suitable for short living values.
Note
Should be called before any insertion/add.

Remove all elements from an array.

Parameters
arrThe array to remove all elements from.
Remarks
As the underlying storage is allocated from a pool, no memory is freed by this operation, but is available for reuse.

Concatenate two arrays together.

Parameters
dstThe destination array, and the one to go first in the combined array
srcThe source array to add to the destination array

Delete all of the elements from a table.

Parameters
tThe table to clear

Add a key/value pair to a table. If another element already exists with the same key, this will overwrite the old data.

Parameters
tThe table to add the data to.
keyThe key to use (case does not matter)
valThe value to add
Remarks
When adding data, this function makes a copy of both the key and the value.

Add a key/value pair to a table. If another element already exists with the same key, this will overwrite the old data.

Parameters
tThe table to add the data to.
keyThe key to use (case does not matter)
valThe value to add
Warning
When adding data, this function does not make a copy of the key or the value, so care should be taken to ensure that the values will not change after they have been added..

Remove data from the table.

Parameters
tThe table to remove data from
keyThe key of the data being removed (case does not matter)

Add data to a table by merging the value with data that has already been stored. The merging is done by concatenating the two values, separated by the string ", ".

Parameters
tThe table to search for the data
keyThe key to merge data for (case does not matter)
valThe data to add
Remarks
If the key is not found, then this function acts like apr_table_add()

Add data to a table by merging the value with data that has already been stored. The merging is done by concatenating the two values, separated by the string ", ".

Parameters
tThe table to search for the data
keyThe key to merge data for (case does not matter)
valThe data to add
Remarks
If the key is not found, then this function acts like apr_table_addn()

Add data to a table, regardless of whether there is another element with the same key.

Parameters
tThe table to add to
keyThe key to use
valThe value to add.
Remarks
When adding data, this function makes a copy of both the key and the value.

Add data to a table, regardless of whether there is another element with the same key.

Parameters
tThe table to add to
keyThe key to use
valThe value to add.
Remarks
When adding data, this function does not make a copy of the key or the value, so care should be taken to ensure that the values will not change after they have been added.

For each element in table b, either use setn or mergen to add the data to table a. Which method is used is determined by the flags passed in.

Parameters
aThe table to add the data to.
bThe table to iterate over, adding its data to table a
flagsHow to add the table to table a. One of: APR_OVERLAP_TABLES_SET Use apr_table_setn APR_OVERLAP_TABLES_MERGE Use apr_table_mergen APR_OVERLAP_TABLES_ADD Use apr_table_addn
Remarks
When merging duplicates, the two values are concatenated, separated by the string ", ".
This function is highly optimized, and uses less memory and CPU cycles than a function that just loops through table b calling other functions.Conceptually, apr_table_overlap does this:
 apr_array_header_t *barr = apr_table_elts(b);
 apr_table_entry_t *belt = (apr_table_entry_t *)barr->elts;
 int i;
 for (i = 0; i < barr->nelts; ++i) {
     if (flags & APR_OVERLAP_TABLES_MERGE) {
         apr_table_mergen(a, belt[i].key, belt[i].val);
     }
     else if (flags & APR_OVERLAP_TABLES_ADD) {
         apr_table_addn(a, belt[i].key, belt[i].val);
     }
     else {
         apr_table_setn(a, belt[i].key, belt[i].val);
     }
 }

Except that it is more efficient (less space and cpu-time) especially when b has many elements.

Notice the assumptions on the keys and values in b – they must be in an ancestor of a's pool. In practice b and a are usually from the same pool.

Eliminate redundant entries in a table by either overwriting or merging duplicates.

Parameters
tTable.
flagsAPR_OVERLAP_TABLES_MERGE to merge, or APR_OVERLAP_TABLES_SET to overwrite, or APR_OVERLAP_TABLES_ADD to add
Remarks
When merging duplicates, the two values are concatenated, separated by the string ", ".

Register an other_child – a child associated to its registered maintence callback. This callback is invoked when the process dies, is disconnected or disappears.

Parameters
procThe child process to register.
maintenancemaintenance is a function that is invoked with a reason and the data pointer passed here.
dataOpaque context data passed to the maintenance function.
write_fdAn fd that is probed for writing. If it is ever unwritable then the maintenance is invoked with reason OC_REASON_UNWRITABLE.
pThe pool to use for allocating memory.
Bug:

write_fd duplicates the proc->out stream, it's really redundant and should be replaced in the APR 1.0 API with a bitflag of which proc->in/out/err handles should be health checked.

no platform currently tests the pipes health.

Stop watching the specified other child.

Parameters
dataThe data to pass to the maintenance function. This is used to find the process to unregister.
Warning
Since this can be called by a maintenance function while we're scanning the other_children list, all scanners should protect themself by loading ocr->next before calling any maintenance function.

Test one specific other child processes and invoke the maintenance callback with the appropriate reason code, if still running, or the appropriate reason code if the process is no longer healthy.

Parameters
ocrThe registered other child
reasonThe reason code (e.g. APR_OC_REASON_RESTART) if still running

Test all registered other child processes and invoke the maintenance callback with the appropriate reason code, if still running, or the appropriate reason code if the process is no longer healthy.

Parameters
reasonThe reason code (e.g. APR_OC_REASON_RESTART) to running processes

Register a process to be killed when a pool dies.

Parameters
aThe pool to use to define the processes lifetime
procThe process to register
howHow to kill the process, one of:
        APR_KILL_NEVER         -- process is never sent any signals
        APR_KILL_ALWAYS        -- process is sent SIGKILL on apr_pool_t cleanup
        APR_KILL_AFTER_TIMEOUT -- SIGTERM, wait 3 seconds, SIGKILL
        APR_JUST_WAIT          -- wait forever for the process to complete
        APR_KILL_ONLY_ONCE     -- send SIGTERM and then wait

Definition at line 35 of file apr_atomic.c.

Variable Documentation

◆ apr_day_snames

const APR_DECLARE_DATA char apr_day_snames[7][4]

day names

Definition at line 37 of file timestr.c.

Referenced by apr_ctime(), APR_DECLARE(), and apr_rfc822_date().

◆ apr_month_snames

const APR_DECLARE_DATA char apr_month_snames[12][4]

month names

Definition at line 33 of file timestr.c.

Referenced by apr_ctime(), APR_DECLARE(), and apr_rfc822_date().

◆ format

apr_size_t apr_size_t const char* format

Definition at line 219 of file apr_time.h.

◆ input

Definition at line 131 of file apr_time.h.

◆ max

apr_size_t apr_size_t max

Definition at line 219 of file apr_time.h.

Referenced by alloc_array(), apr_strftime(), and win32_strftime_extra().

◆ offs

apr_time_t apr_int32_t offs

Definition at line 141 of file apr_time.h.

◆ retsize

apr_size_t* retsize

Definition at line 219 of file apr_time.h.

◆ t

Definition at line 195 of file apr_time.h.

◆ tm

apr_size_t apr_size_t const char apr_time_exp_t* tm
APR_USEC_PER_SEC
#define APR_USEC_PER_SEC
Definition: apr_time.h:60
apr_time_t
apr_int64_t apr_time_t
Definition: apr_time.h:45