GME
13
|
Functions | |
APR_DECLARE_NONSTD (apr_status_t) apr_pool_cleanup_null(void *data) | |
Variables | |
const void * | data |
const void apr_status_t(* | plain_cleanup )(void *) |
const void apr_status_t(*) apr_status_t(* | child_cleanup )(void *)) __attribute__((nonnull(3 |
const void apr_status_t(*) apr_status_t(* | APR_DECLARE )(void) apr_pool_pre_cleanup_register(apr_pool_t *p |
Cleanups are performed in the reverse order they were registered. That is: Last In, First Out. A cleanup function can safely allocate memory from the pool that is being cleaned up. It can also safely register additional cleanups which will be run LIFO, directly after the current cleanup terminates. Cleanups have to take caution in calling functions that create subpools. Subpools, created during cleanup will NOT automatically be cleaned up. In other words, cleanups are to clean up after themselves.
An empty cleanup function.
Passed to apr_pool_cleanup_register() when no cleanup is required.
data | The data to cleanup, will not be used by this function. |
Write a string to a file using a printf format.
fptr | The file to write to. |
format | The format string |
... | The values to substitute in the format string |
snprintf routine based on apr_vformatter. This means it understands the same extensions.
buf | The buffer to write to |
len | The size of the buffer |
format | The format string |
... | The arguments to use to fill out the format string. |
Iterate over a table running the provided function once for every element in the table. The varargs array must be a list of zero or more (char *) keys followed by a NULL pointer. If zero keys are given, the
comp | function will be invoked for every element in the table. Otherwise, the function is invoked only for those elements matching the keys specified. |
If an invocation of the
comp | function returns zero, iteration will continue using the next specified key, if any. |
comp | The function to run |
rec | The data to pass as the first argument to the function |
t | The table to iterate over |
... | A varargs array of zero or more (char *) keys followed by NULL |
Register a function to be called when a pool is cleared or destroyed.
Unlike apr_pool_cleanup_register which register a cleanup that is called AFTER all subpools are destroyed this function register a function that will be called before any of the subpool is destoryed.
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 |
Run the specified cleanup function immediately and unregister it.
The cleanup most recently registered with p having the same values of data and cleanup will be removed and cleanup will be called with data as the argument.
p | The pool to remove the cleanup from |
data | The data to remove from cleanup |
cleanup | The function to remove from cleanup |
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.
allocator | The allocator to give the mem back to |
memnode | The memory node to return |
Set the owner of the allocator
allocator | The allocator to set the owner for |
pool | The pool that is to own the allocator |
Set the current threshold at which the allocator should start giving blocks back to the system.
allocator | The allocator the set the threshold on |
size | The threshold. 0 == unlimited. |
atomically add 'val' to an apr_uint32_t
mem | pointer to the object |
val | amount to add |
atomically subtract 'val' from an apr_uint32_t
mem | pointer to the object |
val | amount to subtract |
atomically increment an apr_uint32_t by 1
mem | pointer to the object |
atomically decrement an apr_uint32_t by 1
mem | pointer to the atomic value |
compare an apr_uint32_t's value with 'cmp'. If they are the same swap the value with 'with'
mem | pointer to the value |
with | what to swap it with |
cmp | the value to compare it to |
exchange an apr_uint32_t's value with 'val'.
mem | pointer to the value |
val | what to swap it with |
exchange a pair of pointer values
mem | pointer to the pointer |
with | what to swap it with |
Set the value of an environment variable
envvar | the name of the environment variable |
value | the value to set |
pool | where to allocate temporary storage from |
Delete a variable from the environment
envvar | the name of the environment variable |
pool | where to allocate temporary storage from |
Open the specified directory.
new_dir | The opened directory descriptor. |
dirname | The full path to the directory (use / on all systems) |
pool | The pool to use. |
close the specified directory.
thedir | the directory descriptor to close. |
Read the next entry from the specified directory.
finfo | the file info structure and filled in by apr_dir_read |
wanted | The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values |
thedir | the directory descriptor returned from apr_dir_open |
APR_INCOMPLETE
is returned all the fields in finfo may not be filled in, and you need to check the finfo->valid
bitmask to verify that what you're looking for is there. When no more entries are available, APR_ENOENT is returned.Rewind the directory to the first entry.
thedir | the directory descriptor to rewind. |
Extract the rootpath from the given filepath
rootpath | the root file path returned with APR_SUCCESS or APR_EINCOMPLETE |
filepath | the pathname to parse for its root component |
flags | the desired rules to apply, from APR_FILEPATH_NATIVE Use native path seperators (e.g. '\' on Win32) APR_FILEPATH_TRUENAME Tests that the root exists, and makes it proper |
p | the pool to allocate the new path string from |
Merge additional file path onto the previously processed rootpath
newpath | the merged paths returned |
rootpath | the root file path (NULL uses the current working path) |
addpath | the path to add to the root path |
flags | the desired APR_FILEPATH_ rules to apply when merging |
p | the pool to allocate the new path string from |
Split a search path into separate components
pathelts | the returned components of the search path |
liststr | the search path (e.g., getenv("PATH") ) |
p | the pool to allocate the array and path components from |
Merge a list of search path components into a single search path
liststr | the returned search path; may be NULL if pathelts is empty |
pathelts | the components of the search path |
p | the pool to allocate the search path from |
Return the default file path (for relative file names)
path | the default path string returned |
flags | optional flag APR_FILEPATH_NATIVE to retrieve the default file path in os-native format. |
p | the pool to allocate the default path string from |
Set the default file path (for relative file names)
path | the default path returned |
p | the pool to allocate any working storage |
Determine the encoding used internally by the FilePath functions
style | points to a variable which receives the encoding style flag |
p | the pool to allocate any working storage |
apr_os_locale_encoding
and/or apr_os_default_encoding
to get the name of the path encoding if it's not UTF-8.Close the specified file.
file | The file descriptor to close. |
Delete the specified file.
path | The full path to the file (using / on all systems) |
pool | The pool to use. |
Rename the specified file.
from_path | The full path to the original file (using / on all systems) |
to_path | The full path to the new file (using / on all systems) |
pool | The pool to use. |
Create a hard link to the specified file.
from_path | The full path to the original file (using / on all systems) |
to_path | The full path to the new file (using / on all systems) |
Copy the specified file to another file.
from_path | The full path to the original file (using / on all systems) |
to_path | The full path to the new file (using / on all systems) |
perms | Access permissions for the new file if it is created. In place of the usual or'd combination of file permissions, the value APR_FILE_SOURCE_PERMS may be given, in which case the source file's permissions are copied. |
pool | The pool to use. |
Append the specified file to another file.
from_path | The full path to the source file (use / on all systems) |
to_path | The full path to the destination file (use / on all systems) |
perms | Access permissions for the destination file if it is created. In place of the usual or'd combination of file permissions, the value APR_FILE_SOURCE_PERMS may be given, in which case the source file's permissions are copied. |
pool | The pool to use. |
Are we at the end of the file
fptr | The apr file we are testing. |
Open standard error as an apr file pointer.
thefile | The apr file to use as stderr. |
pool | The pool to allocate the file out of. |
open standard output as an apr file pointer.
thefile | The apr file to use as stdout. |
pool | The pool to allocate the file out of. |
open standard input as an apr file pointer.
thefile | The apr file to use as stdin. |
pool | The pool to allocate the file out of. |
open standard error as an apr file pointer, with flags.
thefile | The apr file to use as stderr. |
flags | The flags to open the file with. Only the APR_EXCL, APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK, APR_SENDFILE_ENABLED and APR_LARGEFILE flags should be used. The APR_WRITE flag will be set unconditionally. |
pool | The pool to allocate the file out of. |
open standard output as an apr file pointer, with flags.
thefile | The apr file to use as stdout. |
flags | The flags to open the file with. Only the APR_EXCL, APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK, APR_SENDFILE_ENABLED and APR_LARGEFILE flags should be used. The APR_WRITE flag will be set unconditionally. |
pool | The pool to allocate the file out of. |
open standard input as an apr file pointer, with flags.
thefile | The apr file to use as stdin. |
flags | The flags to open the file with. Only the APR_EXCL, APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK, APR_SENDFILE_ENABLED and APR_LARGEFILE flags should be used. The APR_READ flag will be set unconditionally. |
pool | The pool to allocate the file out of. |
Read data from the specified file.
thefile | The file descriptor to read from. |
buf | The buffer to store the data to. |
nbytes | On entry, the number of bytes to read; on exit, the number of bytes read. |
Write data to the specified file.
thefile | The file descriptor to write to. |
buf | The buffer which contains the data. |
nbytes | On entry, the number of bytes to write; on exit, the number of bytes written. |
Write data from iovec array to the specified file.
thefile | The file descriptor to write to. |
vec | The array from which to get the data to write to the file. |
nvec | The number of elements in the struct iovec array. This must be smaller than APR_MAX_IOVEC_SIZE. If it isn't, the function will fail with APR_EINVAL. |
nbytes | The number of bytes written. |
Read data from the specified file, ensuring that the buffer is filled before returning.
thefile | The file descriptor to read from. |
buf | The buffer to store the data to. |
nbytes | The number of bytes to read. |
bytes_read | If non-NULL, this will contain the number of bytes read. |
Write data to the specified file, ensuring that all of the data is written before returning.
thefile | The file descriptor to write to. |
buf | The buffer which contains the data. |
nbytes | The number of bytes to write. |
bytes_written | If non-NULL, set to the number of bytes written. |
Write data from iovec array to the specified file, ensuring that all of the data is written before returning.
thefile | The file descriptor to write to. |
vec | The array from which to get the data to write to the file. |
nvec | The number of elements in the struct iovec array. This must be smaller than APR_MAX_IOVEC_SIZE. If it isn't, the function will fail with APR_EINVAL. |
nbytes | The number of bytes written. |
Write a character into the specified file.
ch | The character to write. |
thefile | The file descriptor to write to |
Read a character from the specified file.
ch | The character to read into |
thefile | The file descriptor to read from |
Put a character back onto a specified stream.
ch | The character to write. |
thefile | The file descriptor to write to |
Read a line from the specified file
str | The buffer to store the string in. |
len | The length of the string |
thefile | The file descriptor to read from |
Write the string into the specified file.
str | The string to write. |
thefile | The file descriptor to write to |
Flush the file's buffer.
thefile | The file descriptor to flush |
Transfer all file modified data and metadata to disk.
thefile | The file descriptor to sync |
Transfer all file modified data to disk.
thefile | The file descriptor to sync |
Duplicate the specified file descriptor.
new_file | The structure to duplicate into. |
old_file | The file to duplicate. |
p | The pool to use for the new file. |
Duplicate the specified file descriptor and close the original
new_file | The old file that is to be closed and reused |
old_file | The file to duplicate |
p | The pool to use for the new file |
Move the specified file descriptor to a new pool
new_file | Pointer in which to return the new apr_file_t |
old_file | The file to move |
p | The pool to which the descriptor is to be moved |
Give the specified apr file handle a new buffer
thefile | The file handle that is to be modified |
buffer | The buffer |
bufsize | The size of the buffer |
Move the read/write file offset to a specified byte within a file.
thefile | The file descriptor |
where | How to move the pointer, one of: APR_SET -- set the offset to offset APR_CUR -- add the offset to the current position APR_END -- add the offset to the current file size |
offset | The offset to move the pointer to. |
Create an anonymous pipe.
in | The newly created pipe's file for reading. |
out | The newly created pipe's file for writing. |
pool | The pool to operate on. |
Create an anonymous pipe which portably supports async timeout options.
in | The newly created pipe's file for reading. |
out | The newly created pipe's file for writing. |
blocking | one of these values defined in apr_thread_proc.h; |
pool | The pool to operate on. APR_FULL_BLOCK APR_READ_BLOCK APR_WRITE_BLOCK APR_FULL_NONBLOCK |
Create a named pipe.
filename | The filename of the named pipe |
perm | The permissions for the newly created pipe. |
pool | The pool to operate on. |
Get the timeout value for a pipe or manipulate the blocking state.
thepipe | The pipe we are getting a timeout for. |
timeout | The current timeout value in microseconds. |
Set the timeout value for a pipe or manipulate the blocking state.
thepipe | The pipe we are setting a timeout on. |
timeout | The timeout value in microseconds. Values < 0 mean wait forever, 0 means do not wait at all. |
file (un)locking functions. Establish a lock on the specified, open file. The lock may be advisory or mandatory, at the discretion of the platform. The lock applies to the file as a whole, rather than a specific range. Locks are established on a per-thread/process basis; a second lock by the same thread will not block.
thefile | The file to lock. |
type | The type of lock to establish on the file. |
Remove any outstanding locks on the file.
thefile | The file to unlock. |
accessor and general file_io functions. return the file name of the current file.
new_path | The path of the file. |
thefile | The currently open file. |
Return the data associated with the current file.
data | The user data associated with the file. |
key | The key to use for retrieving data associated with this file. |
file | The currently open file. |
Set the data associated with the current file.
file | The currently open file. |
data | The user data to associate with the file. |
key | The key to use for associating data with the file. |
cleanup | The cleanup routine to use when the file is destroyed. |
set the specified file's permission bits.
fname | The file (name) to apply the permissions to. |
perms | The permission bits to apply to the file. |
Set attributes of the specified file.
fname | The full path to the file (using / on all systems) |
attributes | Or'd combination of APR_FILE_ATTR_READONLY - make the file readonly APR_FILE_ATTR_EXECUTABLE - make the file executable APR_FILE_ATTR_HIDDEN - make the file hidden |
attr_mask | Mask of valid bits in attributes. |
pool | the pool to use. |
Set the mtime of the specified file.
fname | The full path to the file (using / on all systems) |
mtime | The mtime to apply to the file. |
pool | The pool to use. |
Create a new directory on the file system.
path | the path for the directory to be created. (use / on all systems) |
perm | Permissions for the new directory. |
pool | the pool to use. |
Creates a new directory on the file system, but behaves like 'mkdir -p'. Creates intermediate directories as required. No error will be reported if PATH already exists.
path | the path for the directory to be created. (use / on all systems) |
perm | Permissions for the new directory. |
pool | the pool to use. |
Remove directory from the file system.
path | the path for the directory to be removed. (use / on all systems) |
pool | the pool to use. |
get the specified file's stats.
finfo | Where to store the information about the file. |
wanted | The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values |
thefile | The file to get information about. |
Truncate the file's length to the specified offset
fp | The file to truncate |
offset | The offset to truncate to. |
Open a temporary file
fp | The apr file to use as a temporary file. |
templ | The template to use when creating a temp file. |
flags | The flags to open the file with. If this is zero, the file is opened with APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | APR_DELONCLOSE |
p | The pool to allocate the file out of. |
Find an existing directory suitable as a temporary storage location.
temp_dir | The temp directory. |
p | The pool to use for any necessary allocations. |
Determine if the given pattern is a regular expression.
pattern | The pattern to search for glob characters. |
Find all files that match a specified pattern.
pattern | The pattern to use for finding files. |
result | Array to use when storing the results |
p | The pool to use. |
Set up an application with normalized argc, argv (and optionally env) in order to deal with platform-specific oddities, such as Win32 services, code pages and signals. This must be the first function called for any APR program.
argc | Pointer to the argc that may be corrected |
argv | Pointer to the argv that may be corrected |
env | Pointer to the env that may be corrected, may be NULL |
Parse the options initialized by apr_getopt_init().
os | The apr_opt_t structure returned by apr_getopt_init() |
opts | A string of characters that are acceptable options to the program. Characters followed by ":" are required to have an option associated |
option_ch | The next option character parsed |
option_arg | The argument following the option character: |
APR_EOF -- No more options to parse APR_BADCH -- Found a bad option character APR_BADARG -- No argument followed the option flag APR_SUCCESS -- The next option was found.
Parse the options initialized by apr_getopt_init(), accepting long options beginning with "--" in addition to single-character options beginning with "-".
os | The apr_getopt_t structure created by apr_getopt_init() |
opts | A pointer to a list of apr_getopt_option_t structures, which can be initialized with { "name", optch, has_args }. has_args is nonzero if the option requires an argument. A structure with an optch value of 0 terminates the list. |
option_ch | Receives the value of "optch" from the apr_getopt_option_t structure corresponding to the next option matched. |
option_arg | Receives the argument following the option, if any. |
APR_EOF -- No more options to parse APR_BADCH -- Found a bad option character APR_BADARG -- No argument followed the option flag APR_SUCCESS -- The next option was found.When APR_SUCCESS is returned, os->ind gives the index of the first non-option argument. On error, a message will be printed to stdout unless os->err is set to 0. If os->interleave is set to nonzero, options can come after arguments, and os->argv will be permuted to leave non-option arguments at the end (the original argv is unaffected).
Re-open a mutex in a child process.
mutex | The newly re-opened mutex structure. |
fname | A file name to use if the mutex mechanism requires one. This argument should always be provided. The mutex code itself will determine if it should be used. This filename should be the same one that was passed to apr_global_mutex_create(). |
pool | The pool to operate on. |
Acquire the lock for the given mutex. If the mutex is already locked, the current thread will be put to sleep until the lock becomes available.
mutex | the mutex on which to acquire the lock. |
Attempt to acquire the lock for the given mutex. If the mutex has already been acquired, the call returns immediately with APR_EBUSY. Note: it is important that the APR_STATUS_IS_EBUSY(s) macro be used to determine if the return value was APR_EBUSY, for portability reasons.
mutex | the mutex on which to attempt the lock acquiring. |
Release the lock for the given mutex.
mutex | the mutex from which to release the lock. |
Destroy the mutex and free the memory associated with the lock.
mutex | the mutex to destroy. |
Display the name of the mutex, as it relates to the actual method used for the underlying apr_proc_mutex_t, if any. NULL is returned if there is no underlying apr_proc_mutex_t.
mutex | the name of the mutex |
Create a hash table with a custom hash function
pool | The pool to allocate the hash table out of |
hash_func | A custom hash function. |
Make a copy of a hash table
pool | The pool from which to allocate the new hash table |
h | The hash table to clone |
Continue iterating over the entries in a hash table.
hi | The iteration state |
Get the current entry's details from the iteration state.
hi | The iteration state |
key | Return pointer for the pointer to the key. |
klen | Return pointer for the key length. |
val | Return pointer for the associated value. |
Clear any key/value pairs in the hash table.
ht | The hash table |
Merge two hash tables into one new hash table. The values of the overlay hash override the values of the base if both have the same key. Both hash tables must use the same hash function.
p | The pool to use for the new hash table |
overlay | The table to add to the initial table |
base | The table that represents the initial values of the new table |
Merge two hash tables into one new hash table. If the same key is present in both tables, call the supplied merge function to produce a merged value for the key in the new table. Both hash tables must use the same hash function.
p | The pool to use for the new hash table |
h1 | The first of the tables to merge |
h2 | The second of the tables to merge |
merger | A callback function to merge values, or NULL to make values from h1 override values from h2 (same semantics as apr_hash_overlay()) |
data | Client data to pass to the merger function |
Display a prompt and read in the password from stdin.
prompt | The prompt to display |
pwbuf | Buffer to store the password |
bufsize | The length of the password buffer. |
Shutdown either reading, writing, or both sides of a socket.
thesocket | The socket to close |
how | How to shutdown the socket. One of: APR_SHUTDOWN_READ no longer allow read requests APR_SHUTDOWN_WRITE no longer allow write requests APR_SHUTDOWN_READWRITE no longer allow read or write requests |
Close a socket.
thesocket | The socket to close |
Bind the socket to its associated port
sock | The socket to bind |
sa | The socket address to bind to |
Listen to a bound socket for connections.
sock | The socket to listen on |
backlog | The number of outstanding connections allowed in the sockets listen queue. If this value is less than zero, the listen queue size is set to zero. |
Accept a new connection request
new_sock | A copy of the socket that is connected to the socket that made the connection request. This is the socket which should be used for all future communication. |
sock | The socket we are listening on. |
connection_pool | The pool for the new socket. |
Issue a connection request to a socket either on the same machine or a different one.
sock | The socket we wish to use for our side of the connection |
sa | The address of the machine we wish to connect to. |
Determine whether the receive part of the socket has been closed by the peer (such that a subsequent call to apr_socket_read would return APR_EOF), if the socket's receive buffer is empty. This function does not block waiting for I/O.
sock | The socket to check |
atreadeof | If APR_SUCCESS is returned, *atreadeof is set to non-zero if a subsequent read would return APR_EOF |
Create apr_sockaddr_t from hostname, address family, and port.
sa | The new apr_sockaddr_t. |
hostname | The hostname or numeric address string to resolve/parse, or NULL to build an address that corresponds to 0.0.0.0 or :: |
family | The address family to use, or APR_UNSPEC if the system should decide. |
port | The port number. |
flags | Special processing flags: APR_IPV4_ADDR_OK first query for IPv4 addresses; only look for IPv6 addresses if the first query failed; only valid if family is APR_UNSPEC and hostname isn't NULL; mutually exclusive with APR_IPV6_ADDR_OK APR_IPV6_ADDR_OK first query for IPv6 addresses; only look for IPv4 addresses if the first query failed; only valid if family is APR_UNSPEC and hostname isn't NULL and APR_HAVE_IPV6; mutually exclusive with APR_IPV4_ADDR_OK |
p | The pool for the apr_sockaddr_t and associated storage. |
Look up the host name from an apr_sockaddr_t.
hostname | The hostname. |
sa | The apr_sockaddr_t. |
flags | Special processing flags. |
Parse hostname/IP address with scope id and port.
Any of the following strings are accepted: 8080 (just the port number) www.apache.org (just the hostname) www.apache.org:8080 (hostname and port number) [fe80::1]:80 (IPv6 numeric address string only) [fe80::1eth0] (IPv6 numeric address string and scope id)
Invalid strings: (empty string) [abc] (not valid IPv6 numeric address string) abc:65536 (invalid port number)
addr | The new buffer containing just the hostname. On output, *addr will be NULL if no hostname/IP address was specfied. |
scope_id | The new buffer containing just the scope id. On output, *scope_id will be NULL if no scope id was specified. |
port | The port number. On output, *port will be 0 if no port was specified. ### FIXME: 0 is a legal port (per RFC 1700). this should ### return something besides zero if the port is missing. |
str | The input string to be parsed. |
p | The pool from which *addr and *scope_id are allocated. |
Get name of the current machine
buf | A buffer to store the hostname in. |
len | The maximum length of the hostname that can be stored in the buffer provided. The suggested length is APRMAXHOSTLEN + 1. |
cont | The pool to use. |
Return the data associated with the current socket
data | The user data associated with the socket. |
key | The key to associate with the user data. |
sock | The currently open socket. |
Set the data associated with the current socket.
sock | The currently open socket. |
data | The user data to associate with the socket. |
key | The key to associate with the data. |
cleanup | The cleanup to call when the socket is destroyed. |
Send data over a network.
sock | The socket to send the data over. |
buf | The buffer which contains the data to be sent. |
len | On entry, the number of bytes to send; on exit, the number of bytes sent. |
This functions acts like a blocking write by default. To change this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK socket option.
It is possible for both bytes to be sent and an error to be returned.
APR_EINTR is never returned.
Send multiple packets of data over a network.
sock | The socket to send the data over. |
vec | The array of iovec structs containing the data to send |
nvec | The number of iovec structs in the array |
len | Receives the number of bytes actually written |
This functions acts like a blocking write by default. To change this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK socket option. The number of bytes actually sent is stored in argument 3.
It is possible for both bytes to be sent and an error to be returned.
APR_EINTR is never returned.
sock | The socket to send from |
where | The apr_sockaddr_t describing where to send the data |
flags | The flags to use |
buf | The data to send |
len | The length of the data to send |
Read data from a socket. On success, the address of the peer from which the data was sent is copied into the from parameter, and the len parameter is updated to give the number of bytes written to buf.
from | Updated with the address from which the data was received |
sock | The socket to use |
flags | The flags to use |
buf | The buffer to use |
len | The length of the available buffer |
Read data from a network.
sock | The socket to read the data from. |
buf | The buffer to store the data in. |
len | On entry, the number of bytes to receive; on exit, the number of bytes received. |
This functions acts like a blocking read by default. To change this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK socket option. The number of bytes actually received is stored in argument 3.
It is possible for both bytes to be received and an APR_EOF or other error to be returned.
APR_EINTR is never returned.
Setup socket options for the specified socket
sock | The socket to set up. |
opt | The option we would like to configure. One of: APR_SO_DEBUG -- turn on debugging information APR_SO_KEEPALIVE -- keep connections active APR_SO_LINGER -- lingers on close if data is present APR_SO_NONBLOCK -- Turns blocking on/off for socket When this option is enabled, use the APR_STATUS_IS_EAGAIN() macro to see if a send or receive function could not transfer data without blocking. APR_SO_REUSEADDR -- The rules used in validating addresses supplied to bind should allow reuse of local addresses. APR_SO_SNDBUF -- Set the SendBufferSize APR_SO_RCVBUF -- Set the ReceiveBufferSize |
on | Value for the option. |
Setup socket timeout for the specified socket
sock | The socket to set up. |
t | Value for the timeout. t > 0 -- read and write calls return APR_TIMEUP if specified time elapsess with no data read or written t == 0 -- read and write calls never block t < 0 -- read and write calls block |
Query socket options for the specified socket
sock | The socket to query |
opt | The option we would like to query. One of: APR_SO_DEBUG -- turn on debugging information APR_SO_KEEPALIVE -- keep connections active APR_SO_LINGER -- lingers on close if data is present APR_SO_NONBLOCK -- Turns blocking on/off for socket APR_SO_REUSEADDR -- The rules used in validating addresses supplied to bind should allow reuse of local addresses. APR_SO_SNDBUF -- Set the SendBufferSize APR_SO_RCVBUF -- Set the ReceiveBufferSize APR_SO_DISCONNECTED -- Query the disconnected state of the socket. (Currently only used on Windows) |
on | Socket option returned on the call. |
Query socket timeout for the specified socket
sock | The socket to query |
t | Socket timeout returned from the query. |
Query the specified socket if at the OOB/Urgent data mark
sock | The socket to query |
atmark | Is set to true if socket is at the OOB/urgent mark, otherwise is set to false. |
Return an address associated with a socket; either the address to which the socket is bound locally or the the address of the peer to which the socket is connected.
sa | The returned apr_sockaddr_t. |
which | Whether to retrieve the local or remote address |
sock | The socket to use |
Return the IP address (in numeric address string format) in an APR socket address. APR will allocate storage for the IP address string from the pool of the apr_sockaddr_t.
addr | The IP address. |
sockaddr | The socket address to reference. |
Write the IP address (in numeric address string format) of the APR socket address sockaddr into the buffer buf (of size buflen).
sockaddr | The socket address to reference. |
See if the IP addresses in two APR socket addresses are equivalent. Appropriate logic is present for comparing IPv4-mapped IPv6 addresses with IPv4 addresses.
addr1 | One of the APR socket addresses. |
addr2 | The other APR socket address. |
Return the type of the socket.
sock | The socket to query. |
type | The returned type (e.g., SOCK_STREAM). |
Given an apr_sockaddr_t and a service name, set the port for the service
sockaddr | The apr_sockaddr_t that will have its port set |
servname | The name of the service you wish to use |
Build an ip-subnet representation from an IP address and optional netmask or number-of-bits.
ipsub | The new ip-subnet representation |
ipstr | The input IP address string |
mask_or_numbits | The input netmask or number-of-bits string, or NULL |
p | The pool to allocate from |
Test the IP address in an apr_sockaddr_t against a pre-built ip-subnet representation.
ipsub | The ip-subnet representation |
sa | The socket address to test |
Return the protocol of the socket.
sock | The socket to query. |
protocol | The returned protocol (e.g., APR_PROTO_TCP). |
Join a Multicast Group
sock | The socket to join a multicast group |
join | The address of the multicast group to join |
iface | Address of the interface to use. If NULL is passed, the default multicast interface will be used. (OS Dependent) |
source | Source Address to accept transmissions from (non-NULL implies Source-Specific Multicast) |
Leave a Multicast Group. All arguments must be the same as apr_mcast_join.
sock | The socket to leave a multicast group |
addr | The address of the multicast group to leave |
iface | Address of the interface to use. If NULL is passed, the default multicast interface will be used. (OS Dependent) |
source | Source Address to accept transmissions from (non-NULL implies Source-Specific Multicast) |
Set the Multicast Time to Live (ttl) for a multicast transmission.
sock | The socket to set the multicast ttl |
ttl | Time to live to Assign. 0-255, default=1 |
Toggle IP Multicast Loopback
sock | The socket to set multicast loopback |
opt | 0=disable, 1=enable |
Set the Interface to be used for outgoing Multicast Transmissions.
sock | The socket to set the multicast interface on |
iface | Address of the interface to use for Multicast |
Set up a pollset object
pollset | The pointer in which to return the newly created object |
size | The maximum number of descriptors that this pollset can hold |
p | The pool from which to allocate the pollset |
flags | Optional flags to modify the operation of the pollset. |
method | Poll method to use. See apr_pollset_method_e. If this method cannot be used, the default method will be used unless the APR_POLLSET_NODEFAULT flag has been specified. |
Destroy a pollset object
pollset | The pollset to destroy |
Add a socket or file descriptor to a pollset
pollset | The pollset to which to add the descriptor |
descriptor | The descriptor to add |
Remove a descriptor from a pollset
pollset | The pollset from which to remove the descriptor |
descriptor | The descriptor to remove |
Block for activity on the descriptor(s) in a pollset
pollset | The pollset to use |
timeout | The amount of time in microseconds to wait. This is a maximum, not a minimum. If a descriptor is signalled, the function will return before this time. If timeout is negative, the function will block until a descriptor is signalled or until apr_pollset_wakeup() has been called. |
num | Number of signalled descriptors (output parameter) |
descriptors | Array of signalled descriptors (output parameter) |
Interrupt the blocked apr_pollset_poll() call.
pollset | The pollset to use |
Poll the descriptors in the poll structure
aprset | The poll structure we will be using. |
numsock | The number of descriptors we are polling |
nsds | The number of descriptors signalled (output parameter) |
timeout | The amount of time in microseconds to wait. This is a maximum, not a minimum. If a descriptor is signalled, the function will return before this time. If timeout is negative, the function will block until a descriptor is signalled or until apr_pollset_wakeup() has been called. |
Return a printable representation of the default pollset method (APR_POLLSET_DEFAULT).
Set up a pollcb object
pollcb | The pointer in which to return the newly created object |
size | The maximum number of descriptors that a single _poll can return. |
p | The pool from which to allocate the pollcb |
flags | Optional flags to modify the operation of the pollcb. |
Set up a pollcb object
pollcb | The pointer in which to return the newly created object |
size | The maximum number of descriptors that a single _poll can return. |
p | The pool from which to allocate the pollcb |
flags | Optional flags to modify the operation of the pollcb. |
method | Poll method to use. See apr_pollset_method_e. If this method cannot be used, the default method will be used unless the APR_POLLSET_NODEFAULT flag has been specified. |
Add a socket or file descriptor to a pollcb
pollcb | The pollcb to which to add the descriptor |
descriptor | The descriptor to add |
Remove a descriptor from a pollcb
pollcb | The pollcb from which to remove the descriptor |
descriptor | The descriptor to remove |
Block for activity on the descriptor(s) in a pollcb
pollcb | The pollcb to use |
timeout | The amount of time in microseconds to wait. This is a maximum, not a minimum. If a descriptor is signalled, the function will return before this time. If timeout is negative, the function will block until a descriptor is signalled. |
func | Callback function to call for each active descriptor. |
baton | Opaque baton passed to the callback function. |
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__. |
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__. |
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__. |
Set the function to be called when an allocation failure occurs.
Determine if pool a is an ancestor of pool b.
a | The pool to search |
b | The pool to search for |
Tag a pool (give it a name)
pool | The pool to tag |
tag | The tag |
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. |
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.
convert the file from apr type to os specific type.
thefile | The os specific file we are converting to |
file | The apr file to convert. |
convert the dir from apr type to os specific type.
thedir | The os specific dir we are converting to |
dir | The apr dir to convert. |
Convert the socket from an apr type to an OS specific socket
thesock | The socket to convert. |
sock | The os specific equivalent of the apr socket.. |
Convert the proc mutex from os specific type to apr type
ospmutex | The os specific proc mutex we are converting to. |
pmutex | The apr proc mutex to convert. |
Get the exploded time in the platforms native format.
ostime | the native time format |
aprtime | the time to convert |
Get the imploded time in the platforms native format.
ostime | the native time format |
aprtime | the time to convert |
convert the shm from apr type to os specific type.
osshm | The os specific shm representation |
shm | The apr shm to convert. |
convert the file from os specific type to apr type.
file | The apr file we are converting to. |
thefile | The os specific file to convert |
flags | The flags that were used to open this file. |
cont | The pool to use if it is needed. |
convert the file from os specific type to apr type.
file | The apr file we are converting to. |
thefile | The os specific pipe to convert |
cont | The pool to use if it is needed. |
convert the file from os specific type to apr type.
file | The apr file we are converting to. |
thefile | The os specific pipe to convert |
register_cleanup | A cleanup will be registered on the apr_file_t to issue apr_file_close(). |
cont | The pool to use if it is needed. |
convert the dir from os specific type to apr type.
dir | The apr dir we are converting to. |
thedir | The os specific dir to convert |
cont | The pool to use when creating to apr directory. |
Convert a socket from the os specific type to the apr type
sock | The pool to use. |
thesock | The socket to convert to. |
cont | The socket we are converting to an apr type. |
Create a socket from an existing descriptor and local and remote socket addresses.
apr_sock | The new socket that has been set up |
os_sock_info | The os representation of the socket handle and other characteristics of the socket |
cont | The pool to use |
Convert the proc mutex from os specific type to apr type
pmutex | The apr proc mutex we are converting to. |
ospmutex | The os specific proc mutex to convert. |
cont | The pool to use if it is needed. |
Put the imploded time in the APR format.
aprtime | the APR time format |
ostime | the time to convert |
cont | the pool to use if necessary |
Put the exploded time in the APR format.
aprtime | the APR time format |
ostime | the time to convert |
cont | the pool to use if necessary |
convert the shared memory from os specific type to apr type.
shm | The apr shm representation of osshm |
osshm | The os specific shm identity |
cont | The pool to use if it is needed. |
Get the name of the current locale character set.
pool | the pool to allocate the name from, if needed |
Re-open a mutex in a child process.
mutex | The newly re-opened mutex structure. |
fname | A file name to use if the mutex mechanism requires one. This argument should always be provided. The mutex code itself will determine if it should be used. This filename should be the same one that was passed to apr_proc_mutex_create(). |
pool | The pool to operate on. |
Destroy the mutex and free the memory associated with the lock.
mutex | the mutex to destroy. |
Display the name of the mutex, as it relates to the actual method used. This matches the valid options for Apache's AcceptMutex directive
mutex | the name of the mutex |
Display the name of the default mutex: APR_LOCK_DEFAULT
Mix the randomness pools.
g | The PRNG state |
entropy_ | Entropy buffer |
bytes | Length of entropy_ in bytes |
Generate cryptographically secure random bytes.
g | The RNG state |
random | Buffer to fill with random bytes |
bytes | Length of buffer in bytes |
Ensures that E bits of conditional entropy are mixed into the PRNG before any further randomness is extracted.
g | The RNG state |
Return APR_SUCCESS if the cryptographic PRNG has been seeded with enough data, APR_ENOTENOUGHENTROPY otherwise.
r | The RNG state |
Return APR_SUCCESS if the PRNG has been seeded with enough data, APR_ENOTENOUGHENTROPY otherwise.
r | The PRNG state |
Mix the randomness pools after forking.
proc | The resulting process handle from apr_proc_fork() |
Remove named resource associated with a shared memory segment, preventing attachments to the resource, but not destroying it.
filename | The filename associated with shared-memory segment which needs to be removed |
pool | The pool used for file operations |
Destroy a shared memory segment and associated memory.
m | The shared memory segment structure to destroy. |
Attach to a shared memory segment that was created by another process.
m | The shared memory structure to create. |
filename | The file used to create the original segment. (This MUST match the original filename.) |
pool | the pool from which to allocate the shared memory structure for this process. |
Detach from a shared memory segment without destroying it.
m | The shared memory structure representing the segment to detach from. |
Enable the delivery of a particular signal
signum | The signal number |
Do a natural order comparison of two strings ignoring the case of the strings.
a | The first string to compare |
b | The second string to compare |
Create a null-terminated string by making a copy of a sequence of characters and appending a null byte
p | The pool to allocate out of |
s | The block of characters to duplicate |
n | The number of characters to duplicate |
Duplicate at most n characters of a string into memory allocated out of a pool; the new string will be NUL-terminated
p | The pool to allocate out of |
s | The string to duplicate |
n | The maximum number of characters to duplicate |
Concatenate multiple strings specified in a writev-style vector
p | The pool from which to allocate |
vec | The strings to concatenate |
nvec | The number of strings to concatenate |
nbytes | (output) strlen of new string (pass in NULL to omit) |
printf-style style printing routine. The data is output to a string allocated from a pool
p | The pool to allocate out of |
fmt | The format of the string |
ap | The arguments to use while printing the data |
Copy up to dst_size characters from src to dst; does not copy past a NUL terminator in src, but always terminates dst with a NUL regardless.
dst | The destination string |
src | The source string |
dst_size | The space available in dst; dst always receives NUL termination, so if src is longer than dst_size, the actual number of characters copied is dst_size - 1. |
Note the differences between this function and strncpy(): 1) strncpy() doesn't always NUL terminate; apr_cpystrn() does. 2) strncpy() pads the destination string with NULs, which is often unnecessary; apr_cpystrn() does not. 3) strncpy() returns a pointer to the beginning of the dst string; apr_cpystrn() returns a pointer to the NUL terminator of dst, to allow a check for truncation.
Remove all whitespace from a string
dest | The destination string. It is okay to modify the string in place. Namely dest == src |
src | The string to rid the spaces from. |
Convert the arguments to a program from one string to an array of strings terminated by a NULL pointer
arg_str | The arguments to convert |
argv_out | Output location. This is a pointer to an array of strings. |
token_context | Pool to use. |
Split a string into separate null-terminated tokens. The tokens are delimited in the string by one or more characters from the sep argument.
str | The string to separate; this should be specified on the first call to apr_strtok() for a given string, and NULL on subsequent calls. |
sep | The set of delimiters |
last | Internal state saved by apr_strtok() between calls. |
vsnprintf routine based on apr_vformatter. This means it understands the same extensions.
buf | The buffer to write to |
len | The size of the buffer |
format | The format string |
ap | The arguments to use to fill out the format string. |
create a string representation of an int, allocated from a pool
p | The pool from which to allocate |
n | The number to format |
create a string representation of a long, allocated from a pool
p | The pool from which to allocate |
n | The number to format |
create a string representation of an apr_off_t, allocated from a pool
p | The pool from which to allocate |
n | The number to format |
Convert a numeric string into an apr_off_t numeric value.
offset | The value of the parsed string. |
buf | The string to parse. It may contain optional whitespace, followed by an optional '+' (positive, default) or '-' (negative) character, followed by an optional '0x' prefix if base is 0 or 16, followed by numeric digits appropriate for base. |
end | A pointer to the end of the valid character in buf. If not NULL, it is set to the first invalid character in buf. |
base | A numeric base in the range between 2 and 36 inclusive, or 0. If base is zero, buf will be treated as base ten unless its digits are prefixed with '0x', in which case it will be treated as base 16. |
parse a base-10 numeric string into a 64-bit numeric value. Equivalent to apr_strtoi64(buf, (char**)NULL, 10).
buf | The string to parse |
Format a binary size (magnitiudes are 2^10 rather than 10^3) from an apr_off_t, as bytes, K, M, T, etc, to a four character compacted human readable string.
size | The size to format |
buf | The 5 byte text buffer (counting the trailing null) |
Determine if the array is empty (either NULL or having no elements).
a | The array to check |
Remove an element from an array (as a first-in, last-out stack).
arr | The array to remove an element from. |
Concatenate two arrays together.
dst | The destination array, and the one to go first in the combined array |
src | The source array to add to the destination array |
Copy the entire array.
p | The pool to allocate the copy of the array out of |
arr | The array to copy |
Copy the headers of the array, and arrange for the elements to be copied if and only if the code subsequently does a push or arraycat.
p | The pool to allocate the copy of the array out of |
arr | The array to copy |
Append one array to the end of another, creating a new array in the process.
p | The pool to allocate the new array out of |
first | The array to put first in the new array. |
second | The array to put second in the new array. |
Create a new table and copy another table into it.
p | The pool to allocate the new table out of |
t | The table to copy |
Create a new table whose contents are deep copied from the given table. A deep copy operation copies all fields, and makes copies of dynamically allocated memory pointed to by the fields.
p | The pool to allocate the new table out of |
t | The table to clone |
Delete all of the elements from a table.
t | The 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.
t | The table to add the data to. |
key | The key to use (case does not matter) |
val | The value to add |
Add a key/value pair to a table. If another element already exists with the same key, this will overwrite the old data.
t | The table to add the data to. |
key | The key to use (case does not matter) |
val | The value to add |
Remove data from the table.
t | The table to remove data from |
key | The 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 ", ".
t | The table to search for the data |
key | The key to merge data for (case does not matter) |
val | The data to 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 ", ".
t | The table to search for the data |
key | The key to merge data for (case does not matter) |
val | The data to add |
Add data to a table, regardless of whether there is another element with the same key.
t | The table to add to |
key | The key to use |
val | The value to add. |
Add data to a table, regardless of whether there is another element with the same key.
t | The table to add to |
key | The key to use |
val | The value to add. |
Merge two tables into one new table.
p | The pool to use for the new table |
overlay | The first table to put in the new table |
base | The table to add at the end of the new table |
Iterate over a table running the provided function once for every element in the table. The
vp | varargs parameter must be a list of zero or more (char *) keys followed by a NULL pointer. If zero keys are given, the |
comp | function will be invoked for every element in the table. Otherwise, the function is invoked only for those elements matching the keys specified. |
If an invocation of the
comp | function returns zero, iteration will continue using the next specified key, if any. |
comp | The function to run |
rec | The data to pass as the first argument to the function |
t | The table to iterate over |
vp | List of zero or more (char *) keys followed by NULL |
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.
a | The table to add the data to. |
b | The table to iterate over, adding its data to table a |
flags | How 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_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 { 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.
t | Table. |
flags | APR_OVERLAP_TABLES_MERGE to merge, or APR_OVERLAP_TABLES_SET to overwrite |
Determine if any of stdin, stdout, or stderr should be linked to pipes when starting a child process.
attr | The procattr we care about. |
in | Should stdin be a pipe back to the parent? |
out | Should stdout be a pipe back to the parent? |
err | Should stderr be a pipe back to the parent? |
Set the child_in and/or parent_in values to existing apr_file_t values.
attr | The procattr we care about. |
child_in | apr_file_t value to use as child_in. Must be a valid file. |
parent_in | apr_file_t value to use as parent_in. Must be a valid file. |
Set the child_out and parent_out values to existing apr_file_t values.
attr | The procattr we care about. |
child_out | apr_file_t value to use as child_out. Must be a valid file. |
parent_out | apr_file_t value to use as parent_out. Must be a valid file. |
Set the child_err and parent_err values to existing apr_file_t values.
attr | The procattr we care about. |
child_err | apr_file_t value to use as child_err. Must be a valid file. |
parent_err | apr_file_t value to use as parent_err. Must be a valid file. |
Set which directory the child process should start executing in.
attr | The procattr we care about. |
dir | Which dir to start in. By default, this is the same dir as the parent currently resides in, when the createprocess call is made. |
Set what type of command the child process will call.
attr | The procattr we care about. |
cmd | The type of command. One of: APR_SHELLCMD -- Anything that the shell can handle APR_PROGRAM -- Executable program (default) APR_PROGRAM_ENV -- Executable program, copy environment APR_PROGRAM_PATH -- Executable program on PATH, copy env |
Determine if the child should start in detached state.
attr | The procattr we care about. |
detach | Should the child start in detached state? Default is no. |
Specify an error function to be called in the child process if APR encounters an error in the child prior to running the specified program.
attr | The procattr describing the child process to be created. |
errfn | The function to call in the child process. |
Specify that apr_proc_create() should do whatever it can to report failures to the caller of apr_proc_create(), rather than find out in the child.
attr | The procattr describing the child process to be created. |
chk | Flag to indicate whether or not extra work should be done to try to report failures to the caller. |
Determine if the child should start in its own address space or using the current one from its parent
attr | The procattr we care about. |
addrspace | Should the child start in its own address space? Default is no on NetWare and yes on other platforms. |
Set the username used for running process
attr | The procattr we care about. |
username | The username used |
password | User password if needed. Password is needed on WIN32 or any other platform having APR_PROCATTR_USER_SET_REQUIRES_PASSWORD set. |
Set the group used for running process
attr | The procattr we care about. |
groupname | The group name used |
Create a new process and execute a new program within that process.
new_proc | The resulting process handle. |
progname | The program to run |
args | the arguments to pass to the new program. The first one should be the program name. |
env | The new environment table for the new process. This should be a list of NULL-terminated strings. This argument is ignored for APR_PROGRAM_ENV, APR_PROGRAM_PATH, and APR_SHELLCMD_ENV types of commands. |
attr | the procattr we should use to determine how to create the new process |
pool | The pool to use. |
Wait for a child process to die
proc | The process handle that corresponds to the desired child process |
exitcode | The returned exit status of the child, if a child process dies, or the signal that caused the child to die. On platforms that don't support obtaining this information, the status parameter will be returned as APR_ENOTIMPL. |
exitwhy | Why the child died, the bitwise or of: APR_PROC_EXIT -- process terminated normally APR_PROC_SIGNAL -- process was killed by a signal APR_PROC_SIGNAL_CORE -- process was killed by a signal, and generated a core dump. |
waithow | How should we wait. One of: APR_WAIT -- block until the child process dies. APR_NOWAIT -- return immediately regardless of if the child is dead or not. |
APR_CHILD_DONE -- child is no longer running. APR_CHILD_NOTDONE -- child is still running.
Wait for any current child process to die and return information about that child.
proc | Pointer to NULL on entry, will be filled out with child's information |
exitcode | The returned exit status of the child, if a child process dies, or the signal that caused the child to die. On platforms that don't support obtaining this information, the status parameter will be returned as APR_ENOTIMPL. |
exitwhy | Why the child died, the bitwise or of: APR_PROC_EXIT -- process terminated normally APR_PROC_SIGNAL -- process was killed by a signal APR_PROC_SIGNAL_CORE -- process was killed by a signal, and generated a core dump. |
waithow | How should we wait. One of: APR_WAIT -- block until the child process dies. APR_NOWAIT -- return immediately regardless of if the child is dead or not. |
p | Pool to allocate child information out of. |
Detach the process from the controlling terminal.
daemonize | set to non-zero if the process should daemonize and become a background process, else it will stay in the foreground. |
Stop watching the specified other child.
data | The data to pass to the maintenance function. This is used to find the process to unregister. |
Notify the maintenance callback of a registered other child process that application has detected an event, such as death.
proc | The process to check |
reason | The reason code to pass to the maintenance function |
status | The status to pass to the maintenance function |
rv = apr_proc_wait_all_procs(&proc, &exitcode, &status, APR_WAIT, p); if (APR_STATUS_IS_CHILD_DONE(rv)) { #if APR_HAS_OTHER_CHILD if (apr_proc_other_child_alert(&proc, APR_OC_REASON_DEATH, status) == APR_SUCCESS) { ; (already handled) } else #endif [... handling non-otherchild processes death ...]
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.
ocr | The registered other child |
reason | The 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.
reason | The reason code (e.g. APR_OC_REASON_RESTART) to running processes |
Terminate a process.
proc | The process to terminate. |
sig | How to kill the process. |
Register a process to be killed when a pool dies.
a | The pool to use to define the processes lifetime |
proc | The process to register |
how | How 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 |
convert a time to its human readable components using an offset from GMT
result | the exploded time |
input | the time to explode |
offs | the number of seconds offset to apply |
convert a time to its human readable components in GMT timezone
result | the exploded time |
input | the time to explode |
convert a time to its human readable components in local timezone
result | the exploded time |
input | the time to explode |
Convert time value from human readable format to a numeric apr_time_t e.g. elapsed usec since epoch
result | the resulting imploded time |
input | the input exploded time |
Convert time value from human readable format to a numeric apr_time_t that always represents GMT
result | the resulting imploded time |
input | the input exploded time |
apr_rfc822_date formats dates in the RFC822 format in an efficient manner. It is a fixed length format which requires the indicated amount of storage, including the trailing NUL terminator.
date_str | String to write to. |
t | the time to convert |
apr_ctime formats dates in the ctime() format in an efficient manner. it is a fixed length format and requires the indicated amount of storage including the trailing NUL terminator. Unlike ANSI/ISO C ctime(), apr_ctime() does not include a
at the end of the string.
date_str | String to write to. |
t | the time to convert |
formats the exploded time according to the format specified
s | string to write to |
retsize | The length of the returned string |
max | The maximum length of the string |
format | The format for the time string |
tm | The time to convert |
Improve the clock resolution for the lifetime of the given pool. Generally this is only desireable on benchmarking and other very time-sensitive applications, and has no impact on most platforms.
p | The pool to associate the finer clock resolution |
An APR internal function for fast ucs-2 wide Unicode format conversion to the utf-8 octet-encoded Unicode. This function is used for filename and other resource conversions for platforms providing native Unicode support.
Only the errors APR_EINVAL and APR_INCOMPLETE may occur, the former when the character code is invalid (in or out of context) and the later when more words were expected, but insufficient words remain.
Definition at line 642 of file apr_pools.h.
const void apr_status_t(*) apr_status_t(* child_cleanup)(void *)) __attribute__((nonnull(3 |
Definition at line 627 of file apr_pools.h.
const void apr_status_t(*) apr_status_t(*) void data) |
Definition at line 625 of file apr_pools.h.
const void apr_status_t(* plain_cleanup)(void *) |
Definition at line 626 of file apr_pools.h.