this function is required on some platforms to initialize the atomic operation's internal structures
- Parameters:
-
- Returns:
- APR_SUCCESS on successful completion
atomically decrement an apr_uint32_t by 1
- Parameters:
-
mem | pointer to the atomic value |
- Returns:
- zero if the value becomes zero on decrement, otherwise non-zero
Get the value of an environment variable
- Parameters:
-
value | the returned value, allocated from pool |
envvar | the name of the environment variable |
pool | where to allocate value and any temporary storage from |
Set the value of an environment variable
- Parameters:
-
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
- Parameters:
-
envvar | the name of the environment variable |
pool | where to allocate temporary storage from |
get the specified file's stats. The file is specified by filename, instead of using a pre-opened file.
- Parameters:
-
finfo | Where to store the information about the file, which is never touched if the call fails. |
fname | The name of the file to stat. |
wanted | The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values |
pool | the pool to use to allocate the new file. |
- Note:
- If
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.
Open the specified directory.
- Parameters:
-
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.
- Parameters:
-
thedir | the directory descriptor to close. |
Read the next entry from the specified directory.
- Parameters:
-
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 |
- Note:
- If
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.
- Parameters:
-
thedir | the directory descriptor to rewind. |
Extract the rootpath from the given filepath
- Parameters:
-
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
- Parameters:
-
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
- Parameters:
-
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
- Parameters:
-
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)
- Parameters:
-
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)
- Parameters:
-
path | the default path returned |
p | the pool to allocate any working storage |
Determine the encoding used internally by the FilePath functions
- Parameters:
-
style | points to a variable which receives the encoding style flag |
p | the pool to allocate any working storage |
Open the specified file.
- Parameters:
-
newf | The opened file descriptor. |
fname | The full path to the file (using / on all systems) |
flag | Or'ed value of:
APR_READ open for reading
APR_WRITE open for writing
APR_CREATE create the file if not there
APR_APPEND file ptr is set to end prior to all writes
APR_TRUNCATE set length to zero if file exists
APR_BINARY not a text file (This flag is ignored on
UNIX because it has no meaning)
APR_BUFFERED buffer the data. Default is non-buffered
APR_EXCL return error if APR_CREATE and file exists
APR_DELONCLOSE delete the file after closing.
APR_XTHREAD Platform dependent tag to open the file
for use across multiple threads
APR_SHARELOCK Platform dependent support for higher
level locked read/write access to support
writes across process/machines
APR_FILE_NOCLEANUP Do not register a cleanup with the pool
passed in on the pool argument (see below).
The apr_os_file_t handle in apr_file_t will not
be closed when the pool is destroyed.
APR_SENDFILE_ENABLED Open with appropriate platform semantics
for sendfile operations. Advisory only,
apr_socket_sendfile does not check this flag.
|
perm | Access permissions for file. |
pool | The pool to use. |
Close the specified file.
- Parameters:
-
file | The file descriptor to close. |
Delete the specified file.
- Parameters:
-
path | The full path to the file (using / on all systems) |
pool | The pool to use. |
Rename the specified file.
- Parameters:
-
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. |
- Warning:
- If a file exists at the new location, then it will be overwritten. Moving files or directories across devices may not be possible.
Create a hard link to the specified file.
- Parameters:
-
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.
- Parameters:
-
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. |
- Warning:
- If the new file already exists, its contents will be overwritten.
Append the specified file to another file.
- Parameters:
-
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
- Parameters:
-
fptr | The apr file we are testing. |
Open standard error as an apr file pointer.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
ch | The character to write. |
thefile | The file descriptor to write to |
Read a character from the specified file.
- Parameters:
-
ch | The character to read into |
thefile | The file descriptor to read from |
Put a character back onto a specified stream.
- Parameters:
-
ch | The character to write. |
thefile | The file descriptor to write to |
Read a line from the specified file
- Parameters:
-
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.
- Parameters:
-
str | The string to write. |
thefile | The file descriptor to write to |
Flush the file's buffer.
- Parameters:
-
thefile | The file descriptor to flush |
Transfer all file modified data and metadata to disk.
- Parameters:
-
thefile | The file descriptor to sync |
Transfer all file modified data to disk.
- Parameters:
-
thefile | The file descriptor to sync |
Duplicate the specified file descriptor.
- Parameters:
-
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
- Parameters:
-
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
- Parameters:
-
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
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
in | The newly created pipe's file for reading. |
out | The newly created pipe's file for writing. |
pool | The pool to operate on. |
- Bug:
- Some platforms cannot toggle between blocking and nonblocking, and when passing a pipe as a standard handle to an application which does not expect it, a non-blocking stream will fluxor the client app.
- Deprecated:
- See also:
- apr_file_pipe_create_ex
Create an anonymous pipe which portably supports async timeout options.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
thefile | The file to lock. |
type | The type of lock to establish on the file. |
Remove any outstanding locks on the file.
- Parameters:
-
thefile | The file to unlock. |
accessor and general file_io functions. return the file name of the current file.
- Parameters:
-
new_path | The path of the file. |
thefile | The currently open file. |
Return the data associated with the current file.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
fname | The file (name) to apply the permissions to. |
perms | The permission bits to apply to the file. |
- Warning:
- Some platforms may not be able to apply all of the available permission bits; APR_INCOMPLETE will be returned if some permissions are specified which could not be set.
-
Platforms which do not implement this feature will return APR_ENOTIMPL.
Set attributes of the specified file.
- Parameters:
-
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. |
- Warning:
- Platforms which do not implement this feature will return APR_ENOTIMPL.
Set the mtime of the specified file.
- Parameters:
-
fname | The full path to the file (using / on all systems) |
mtime | The mtime to apply to the file. |
pool | The pool to use. |
- Warning:
- Platforms which do not implement this feature will return APR_ENOTIMPL.
Create a new directory on the file system.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
path | the path for the directory to be removed. (use / on all systems) |
pool | the pool to use. |
get the specified file's stats.
- Parameters:
-
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
- Parameters:
-
fp | The file to truncate |
offset | The offset to truncate to. |
Open a temporary file
- Parameters:
-
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.
- Parameters:
-
temp_dir | The temp directory. |
p | The pool to use for any necessary allocations. |
Setup any APR internal data structures. This MUST be the first function called for any APR library. It is safe to call apr_initialize several times as long as apr_terminate is called the same number of times.
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.
- Parameters:
-
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 |
Initialize the arguments for parsing by apr_getopt().
- Parameters:
-
os | The options structure created for apr_getopt() |
cont | The pool to operate on |
argc | The number of arguments to parse |
argv | The array of arguments to parse |
Parse the options initialized by apr_getopt_init().
- Parameters:
-
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: |
- Returns:
- There are four potential status values on exit. They are:
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 "-".
- Parameters:
-
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. |
- Returns:
- There are four potential status values on exit. They are:
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).
Create and initialize a mutex that can be used to synchronize both processes and threads. Note: There is considerable overhead in using this API if only cross-process or cross-thread mutual exclusion is required. See apr_proc_mutex.h and apr_thread_mutex.h for more specialized lock routines.
- Parameters:
-
mutex | the memory address where the newly created mutex will be stored. |
fname | A file name to use if the lock mechanism requires one. This argument should always be provided. The lock code itself will determine if it should be used. |
mech | The mechanism to use for the interprocess lock, if any; one of
APR_LOCK_FCNTL
APR_LOCK_FLOCK
APR_LOCK_SYSVSEM
APR_LOCK_POSIXSEM
APR_LOCK_PROC_PTHREAD
APR_LOCK_DEFAULT pick the default mechanism for the platform
|
pool | the pool from which to allocate the mutex. |
- Warning:
- Check APR_HAS_foo_SERIALIZE defines to see if the platform supports APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
Re-open a mutex in a child process.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
mutex | the mutex on which to attempt the lock acquiring. |
Release the lock for the given mutex.
- Parameters:
-
mutex | the mutex from which to release the lock. |
Destroy the mutex and free the memory associated with the lock.
- Parameters:
-
mutex | the mutex to destroy. |
Iterate over a hash table running the provided function once for every element in the hash table. The
- Parameters:
-
comp | function will be invoked for every element in the hash table. |
comp | The function to run |
rec | The data to pass as the first argument to the function |
ht | The hash table to iterate over |
- Returns:
- FALSE if one of the comp() iterations returned zero; TRUE if all iterations returned non-zero
- See also:
- apr_hash_do_callback_fn_t
apr_vformatter() is a generic printf-style formatting routine with some extensions.
- Parameters:
-
flush_func | The function to call when the buffer is full |
c | The buffer to write to |
fmt | The format string |
ap | The arguments to use to fill out the format string. |
%pA takes a struct in_addr *, and prints it as a.b.c.d %pI takes an apr_sockaddr_t * and prints it as a.b.c.d:port or [ipv6-address]:port %pT takes an apr_os_thread_t * and prints it in decimal ('0' is printed if !APR_HAS_THREADS) %pt takes an apr_os_thread_t * and prints it in hexadecimal ('0' is printed if !APR_HAS_THREADS) %pm takes an apr_status_t * and prints the appropriate error string (from apr_strerror) corresponding to that error code. %pp takes a void * and outputs it in hex %pB takes a apr_uint32_t * as bytes and outputs it's apr_strfsize %pF same as above, but takes a apr_off_t * %pS same as above, but takes a apr_size_t *
%pA, %pI, %pT, %pp are available from APR 1.0.0 onwards (and in 0.9.x).
%pt is only available from APR 1.2.0 onwards.
%pm, %pB, %pF and %pS are only available from APR 1.3.0 onwards.
The %p hacks are to force gcc's printf warning code to skip
over a pointer argument without complaining. This does
mean that the ANSI-style %p (output a void * in hex format) won't
work as expected at all, but that seems to be a fair trade-off
for the increased robustness of having printf-warnings work.
Additionally, apr_vformatter allows for arbitrary output methods
using the apr_vformatter_buff and flush_func.
The apr_vformatter_buff has two elements curpos and endpos.
curpos is where apr_vformatter will write the next byte of output.
It proceeds writing output to curpos, and updating curpos, until
either the end of output is reached, or curpos == endpos (i.e. the
buffer is full).
If the end of output is reached, apr_vformatter returns the
number of bytes written.
When the buffer is full, the flush_func is called. The flush_func
can return -1 to indicate that no further output should be attempted,
and apr_vformatter will return immediately with -1. Otherwise
the flush_func should flush the buffer in whatever manner is
appropriate, re apr_pool_t nitialize curpos and endpos, and return 0.
Note that flush_func is only invoked as a result of attempting to
write another byte at curpos when curpos >= endpos. So for
example, it's possible when the output exactly matches the buffer
space available that curpos == endpos will be true when
apr_vformatter returns.
apr_vformatter does not call out to any other code, it is entirely
self-contained. This allows the callers to do things which are
otherwise "unsafe". For example, apr_psprintf uses the "scratch"
space at the unallocated end of a block, and doesn't actually
complete the allocation until apr_vformatter returns. apr_psprintf
would be completely broken if apr_vformatter were to call anything
that used this same pool. Similarly http_bprintf() uses the "scratch"
space at the end of its output buffer, and doesn't actually note
that the space is in use until it either has to flush the buffer
or until apr_vformatter returns.
Display a prompt and read in the password from stdin.
- Parameters:
-
prompt | The prompt to display |
pwbuf | Buffer to store the password |
bufsize | The length of the password buffer. |
Create a socket.
- Parameters:
-
new_sock | The new socket that has been set up. |
family | The address family of the socket (e.g., APR_INET). |
type | The type of the socket (e.g., SOCK_STREAM). |
protocol | The protocol of the socket (e.g., APR_PROTO_TCP). |
cont | The pool for the apr_socket_t and associated storage. |
Shutdown either reading, writing, or both sides of a socket.
- Parameters:
-
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
|
- See also:
- apr_shutdown_how_e
Close a socket.
- Parameters:
-
thesocket | The socket to close |
Bind the socket to its associated port
- Parameters:
-
sock | The socket to bind |
sa | The socket address to bind to |
Listen to a bound socket for connections.
- Parameters:
-
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
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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 |
- Returns:
- an error is returned if it was not possible to determine the status, in which case *atreadeof is not changed.
Create apr_sockaddr_t from hostname, address family, and port.
- Parameters:
-
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.
- Parameters:
-
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)
- Parameters:
-
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
- Parameters:
-
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
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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. |
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.
- Parameters:
-
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 |
It is possible for both bytes to be sent and an error to be returned.
APR_EINTR is never returned.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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. |
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
- Parameters:
-
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
- Parameters:
-
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
- Parameters:
-
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
- Parameters:
-
sock | The socket to query |
t | Socket timeout returned from the query. |
Query the specified socket if at the OOB/Urgent data mark
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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).
- Parameters:
-
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.
- Parameters:
-
addr1 | One of the APR socket addresses. |
addr2 | The other APR socket address. |
Return the type of the socket.
- Parameters:
-
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
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
ipsub | The ip-subnet representation |
sa | The socket address to test |
- Returns:
- non-zero if the socket address is within the subnet, 0 otherwise
Return the protocol of the socket.
- Parameters:
-
sock | The socket to query. |
protocol | The returned protocol (e.g., APR_PROTO_TCP). |
Join a Multicast Group
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
sock | The socket to set the multicast ttl |
ttl | Time to live to Assign. 0-255, default=1 |
Toggle IP Multicast Loopback
- Parameters:
-
sock | The socket to set multicast loopback |
opt | 0=disable, 1=enable |
Set the Interface to be used for outgoing Multicast Transmissions.
- Parameters:
-
sock | The socket to set the multicast interface on |
iface | Address of the interface to use for Multicast |
Set up a pollset object
- Parameters:
-
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. |
Set up a pollset object
- Parameters:
-
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
- Parameters:
-
pollset | The pollset to destroy |
Add a socket or file descriptor to a pollset
- Parameters:
-
pollset | The pollset to which to add the descriptor |
descriptor | The descriptor to add |
Remove a descriptor from a pollset
- Parameters:
-
pollset | The pollset from which to remove the descriptor |
descriptor | The descriptor to remove |
Block for activity on the descriptor(s) in a pollset
- Parameters:
-
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) |
- Bug:
- With versions 1.4.2 and prior on Windows, a call with no descriptors and timeout will return immediately with the wrong error code.
Interrupt the blocked apr_pollset_poll() call.
- Parameters:
-
pollset | The pollset to use |
Poll the descriptors in the poll structure
- Parameters:
-
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. |
- Bug:
- With versions 1.4.2 and prior on Windows, a call with no descriptors and timeout will return immediately with the wrong error code.
Set up a pollcb object
- Parameters:
-
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
- Parameters:
-
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
- Parameters:
-
pollcb | The pollcb to which to add the descriptor |
descriptor | The descriptor to add |
Remove a descriptor from a pollcb
- Parameters:
-
pollcb | The pollcb from which to remove the descriptor |
descriptor | The descriptor to remove |
Block for activity on the descriptor(s) in a pollcb
- Parameters:
-
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. |
- Bug:
- With versions 1.4.2 and prior on Windows, a call with no descriptors and timeout will return immediately with the wrong error code.
Setup all of the internal structures required to use pools
Create a new pool.
- Parameters:
-
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.
- Deprecated:
- See also:
- apr_pool_create_unmanaged_ex.
Create a new unmanaged pool.
- Parameters:
-
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.
- Parameters:
-
- See also:
- apr_pool_create.
- Parameters:
-
- See also:
- apr_pool_create.
- Parameters:
-
- See also:
- apr_pool_create.
- Parameters:
-
- See also:
- apr_pool_create.
- Parameters:
-
file_line | Where the function is called from. This is usually APR_POOL__FILE_LINE__. |
Debug version of apr_pool_create_core_ex.
- Deprecated:
- See also:
- apr_pool_create_unmanaged_ex_debug.
Debug version of apr_pool_create_unmanaged_ex.
- Parameters:
-
- See also:
- apr_pool_create_unmanaged.
- Parameters:
-
- See also:
- apr_pool_create_unmanaged.
- Parameters:
-
- See also:
- apr_pool_create_unmanaged.
- Parameters:
-
file_line | Where the function is called from. This is usually APR_POOL__FILE_LINE__. |
Determine if pool a is an ancestor of pool b.
- Parameters:
-
a | The pool to search |
b | The pool to search for |
- Returns:
- True if a is an ancestor of b, NULL is considered an ancestor of all pools.
Set the data associated with the current pool
- Parameters:
-
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 |
- Warning:
- The data to be attached to the pool should have a life span at least as long as the pool it is being attached to.
Users of APR must take EXTREME care when choosing a key to use for their data. It is possible to accidentally overwrite data by choosing a key that another part of the program is using. 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
- Parameters:
-
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 |
- Note:
- same as apr_pool_userdata_set(), except that this version doesn't make a copy of the key (this function is useful, for example, when the key is a string literal)
- Warning:
- This should NOT be used if the key could change addresses by any means between the apr_pool_userdata_setn() call and a subsequent apr_pool_userdata_get() on that key, such as if a static string is used as a userdata key in a DSO and the DSO could be unloaded and reloaded between the _setn() and the _get(). You MUST use apr_pool_userdata_set() in such cases.
-
More generally, the key and the data to be attached to the pool should have a life span at least as long as the pool itself.
Return the data associated with the current pool.
- Parameters:
-
data | The user data associated with the pool. |
key | The key for the data to retrieve |
pool | The current pool. |
convert the file from apr type to os specific type.
- Parameters:
-
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.
- Parameters:
-
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
- Parameters:
-
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
- Parameters:
-
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.
- Parameters:
-
ostime | the native time format |
aprtime | the time to convert |
Get the imploded time in the platforms native format.
- Parameters:
-
ostime | the native time format |
aprtime | the time to convert |
convert the shm from apr type to os specific type.
- Parameters:
-
osshm | The os specific shm representation |
shm | The apr shm to convert. |
convert the file from os specific type to apr type.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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
- Parameters:
-
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.
- Parameters:
-
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
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
shm | The apr shm representation of osshm |
osshm | The os specific shm identity |
cont | The pool to use if it is needed. |
Create and initialize a mutex that can be used to synchronize processes.
- Parameters:
-
mutex | the memory address where the newly created mutex will be stored. |
fname | A file name to use if the lock mechanism requires one. This argument should always be provided. The lock code itself will determine if it should be used. |
mech | The mechanism to use for the interprocess lock, if any; one of
APR_LOCK_FCNTL
APR_LOCK_FLOCK
APR_LOCK_SYSVSEM
APR_LOCK_POSIXSEM
APR_LOCK_PROC_PTHREAD
APR_LOCK_DEFAULT pick the default mechanism for the platform
|
pool | the pool from which to allocate the mutex. |
- See also:
- apr_lockmech_e
- Warning:
- Check APR_HAS_foo_SERIALIZE defines to see if the platform supports APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable.
Re-open a mutex in a child process.
- Parameters:
-
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. |
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.
- Parameters:
-
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.
- Parameters:
-
mutex | the mutex on which to attempt the lock acquiring. |
Release the lock for the given mutex.
- Parameters:
-
mutex | the mutex from which to release the lock. |
Destroy the mutex and free the memory associated with the lock.
- Parameters:
-
mutex | the mutex to destroy. |
Destroy the mutex and free the memory associated with the lock.
- Parameters:
-
mutex | the mutex to destroy. |
- Note:
- This function is generally used to kill a cleanup on an already created mutex
Generate cryptographically insecure random bytes.
- Parameters:
-
g | The RNG state |
random | Buffer to fill with random bytes |
bytes | Length of buffer in bytes |
Generate cryptographically secure random bytes.
- Parameters:
-
g | The RNG state |
random | Buffer to fill with random bytes |
bytes | Length of buffer in bytes |
Return APR_SUCCESS if the cryptographic PRNG has been seeded with enough data, APR_ENOTENOUGHENTROPY otherwise.
- Parameters:
-
Return APR_SUCCESS if the PRNG has been seeded with enough data, APR_ENOTENOUGHENTROPY otherwise.
- Parameters:
-
Create and make accessable a shared memory segment.
- Parameters:
-
m | The shared memory structure to create. |
reqsize | The desired size of the segment. |
filename | The file to use for shared memory on platforms that require it. |
pool | the pool from which to allocate the shared memory structure. |
Remove named resource associated with a shared memory segment, preventing attachments to the resource, but not destroying it.
- Parameters:
-
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.
- Parameters:
-
m | The shared memory segment structure to destroy. |
Attach to a shared memory segment that was created by another process.
- Parameters:
-
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.
- Parameters:
-
m | The shared memory structure representing the segment to detach from. |
Create and initialize a new procattr variable
- Parameters:
-
new_attr | The newly created procattr. |
cont | The pool to use |
Determine if any of stdin, stdout, or stderr should be linked to pipes when starting a child process.
- Parameters:
-
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? |
- Note:
- If APR_NO_PIPE, there will be no special channel, the child inherits the parent's corresponding stdio stream. If APR_NO_FILE is specified, that corresponding stream is closed in the child (and will be INVALID_HANDLE_VALUE when inspected on Win32). This can have ugly side effects, as the next file opened in the child on Unix will fall into the stdio stream fd slot!
Set the child_in and/or parent_in values to existing apr_file_t values.
- Parameters:
-
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. |
- Bug:
- Note that calling this function with two NULL files on some platforms creates an APR_FULL_BLOCK pipe, but this behavior is neither portable nor is it supported.
- See also:
- apr_procattr_io_set instead for simple pipes.
Set the child_out and parent_out values to existing apr_file_t values.
- Parameters:
-
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. |
- Bug:
- Note that calling this function with two NULL files on some platforms creates an APR_FULL_BLOCK pipe, but this behavior is neither portable nor is it supported.
- See also:
- apr_procattr_io_set instead for simple pipes.
Set the child_err and parent_err values to existing apr_file_t values.
- Parameters:
-
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. |
- Bug:
- Note that calling this function with two NULL files on some platforms creates an APR_FULL_BLOCK pipe, but this behavior is neither portable nor is it supported.
- See also:
- apr_procattr_io_set instead for simple pipes.
Set which directory the child process should start executing in.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
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
- Parameters:
-
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
- Parameters:
-
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
- Parameters:
-
attr | The procattr we care about. |
groupname | The group name used |
Create a new process and execute a new program within that process.
- Parameters:
-
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. |
- Note:
- This function returns without waiting for the new process to terminate; use apr_proc_wait for that.
Wait for a child process to die
- Parameters:
-
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.
|
Wait for any current child process to die and return information about that child.
- Parameters:
-
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. |
- Bug:
- Passing proc as a *proc rather than **proc was an odd choice for some platforms... this should be revisited in 1.0
Detach the process from the controlling terminal.
- Parameters:
-
daemonize | set to non-zero if the process should daemonize and become a background process, else it will stay in the foreground. |
Notify the maintenance callback of a registered other child process that application has detected an event, such as death.
- Parameters:
-
proc | The process to check |
reason | The reason code to pass to the maintenance function |
status | The status to pass to the maintenance function |
Terminate a process.
- Parameters:
-
proc | The process to terminate. |
sig | How to kill the process. |
convert an ansi time_t to an apr_time_t
- Parameters:
-
result | the resulting apr_time_t |
input | the time_t to convert |
convert a time to its human readable components using an offset from GMT
- Parameters:
-
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
- Parameters:
-
result | the exploded time |
input | the time to explode |
convert a time to its human readable components in local timezone
- Parameters:
-
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
- Parameters:
-
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
- Parameters:
-
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.
- Parameters:
-
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.
- Parameters:
-
date_str | String to write to. |
t | the time to convert |
formats the exploded time according to the format specified
- Parameters:
-
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 |