Apache HTTPD
Classes | Macros | Typedefs | Functions | Variables
General Purpose Library Routines

Classes

struct  apr_vformatter_buff_t
 

Macros

#define HUGE_STRING_LEN   8192
 
#define apr_killpg(x, y)   (killpg ((x), (y)))
 

Typedefs

typedef struct apr_vformatter_buff_t apr_vformatter_buff_t
 

Functions

 APR_DECLARE (const char *) apr_filepath_name_get(const char *pathname)
 
 APR_DECLARE (int) apr_vformatter(int(*flush_func)(apr_vformatter_buff_t *b)
 

Variables

apr_vformatter_buff_tc
 
apr_vformatter_buff_t const charfmt
 
apr_vformatter_buff_t const char va_list ap
 
charpwbuf
 
char apr_size_tbufsize
 

Detailed Description

This is collection of oddballs that didn't fit anywhere else, and might move to more appropriate headers with the release of APR 1.0.

Macro Definition Documentation

◆ apr_killpg

#define apr_killpg (   x,
  y 
)    (killpg ((x), (y)))

apr_killpg Small utility macros to make things easier to read. Not usually a goal, to be sure..

Definition at line 98 of file apr_lib.h.

◆ HUGE_STRING_LEN

#define HUGE_STRING_LEN   8192

A constant representing a 'large' string.

Definition at line 52 of file apr_lib.h.

Typedef Documentation

◆ apr_vformatter_buff_t

See also
apr_vformatter_buff_t

Definition at line 59 of file apr_lib.h.

Function Documentation

◆ APR_DECLARE() [1/2]

APR_DECLARE ( const char ) const

return the final element of the pathname

Parameters
pathnameThe path to get the final element of
Returns
the final element of the path
Remarks
For example:
                "/foo/bar/gum"    -> "gum"
                "/foo/bar/gum/"   -> ""
                "gum"             -> "gum"
                "bs\\path\\stuff" -> "stuff"

Skip the common prefix prefix from the C string str, and return a pointer to the next character after the prefix. Return NULL if str does not start with prefix.

Since
New in 1.6.

Get the value associated with a given key from the table. After this call, the data is still in the table.

Parameters
tThe table to search for the key
keyThe key to search for (case does not matter)
Returns
The value associated with the key, or NULL if the key does not exist.

Get values associated with a given key from the table. If more than one value exists, return a comma separated list of values. After this call, the data is still in the table.

Parameters
pThe pool to allocate the combined value from, if necessary
tThe table to search for the key
keyThe key to search for (case does not matter)
Returns
The value associated with the key, or NULL if the key does not exist.

◆ APR_DECLARE() [2/2]

APR_DECLARE ( int  )

apr_vformatter() is a generic printf-style formatting routine with some extensions.

Parameters
flush_funcThe function to call when the buffer is full
cThe buffer to write to
fmtThe format string
apThe arguments to use to fill out the format string.
Remarks
The extensions are:

- %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
promptThe prompt to display
pwbufBuffer to store the password
bufsizeThe length of the password buffer.
Remarks
If the password entered must be truncated to fit in the provided buffer, APR_ENAMETOOLONG will be returned. Note that the bufsize paramater is passed by reference for no reason; its value will never be modified by the apr_password_get() function.

< File is read-only

< File is executable

< all protections

< File is read-only

< File is read-only

< Write by user

<

Deprecated:
See also
APR_FPROT_UWRITE

< Write by group

<

Deprecated:
See also
APR_FPROT_GWRITE

< Write by others

<

Deprecated:
See also
APR_FPROT_WWRITE

< Write by user

<

Deprecated:
See also
APR_FPROT_UWRITE

< Write by group

<

Deprecated:
See also
APR_FPROT_GWRITE

< Write by others

<

Deprecated:
See also
APR_FPROT_WWRITE

< File is executable

< File is executable

< Execute by user

<

Deprecated:
See also
APR_FPROT_UEXECUTE

< Execute by group

<

Deprecated:
See also
APR_FPROT_GEXECUTE

< Execute by others

<

Deprecated:
See also
APR_FPROT_WEXECUTE

< Execute by user

<

Deprecated:
See also
APR_FPROT_UEXECUTE

< Execute by group

<

Deprecated:
See also
APR_FPROT_GEXECUTE

< Execute by others

<

Deprecated:
See also
APR_FPROT_WEXECUTE

< Stat the link not the file itself if it is a link

< Stat the link not the file itself if it is a link

< ->name in proper case

< ->name in proper case

< Access Time

< Create the file if not there

< Open the file for reading

< Open the file for writing

< Delete the file after close

< Open should fail if APR_FOPEN_CREATE and file exists.

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

< Read by user

<

Deprecated:
See also
APR_FPROT_UREAD

< Write by user

<

Deprecated:
See also
APR_FPROT_UWRITE

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

< ->name in proper case

< Modification Time

< Access Time

< Creation or inode-changed time

< Type

< Size of the file

< Storage size consumed by the file

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

< ->name in proper case

< ->name in proper case

< Type

< all protections

< ->name in proper case

< ->name in proper case

< File is read-only

< File is hidden

< File is read-only

< File is read-only

< File is hidden

< File is hidden

< Platform dependent flag to enable * non blocking file io

< Open the file for reading

< Open the file for writing

< Open the file for reading

< Open the file for writing

< Open the file for buffered I/O

< Create the file if not there

< Open should fail if APR_FOPEN_CREATE and file exists.

< Open the file and truncate to 0 length

< Open should fail if APR_FOPEN_CREATE and file exists.

< Create the file if not there

< Open the file and truncate to 0 length

< Append to the end of the file

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

< Delete the file after close

< Open the file for buffered I/O

< Open the file for writing

< Open the file for writing

< Open the file for reading

< Append to the end of the file

< an atomic unix apr_stat()

< Open the file for writing

< Create the file if not there

< Open the file and truncate to 0 length

< Open the file for writing

< Create the file if not there

< Append to the end of the file

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

< File is read-only

< File is executable

< all protections

< File is read-only

< File is read-only

< Write by user

<

Deprecated:
See also
APR_FPROT_UWRITE

< Write by group

<

Deprecated:
See also
APR_FPROT_GWRITE

< Write by others

<

Deprecated:
See also
APR_FPROT_WWRITE

< Write by user

<

Deprecated:
See also
APR_FPROT_UWRITE

< Write by group

<

Deprecated:
See also
APR_FPROT_GWRITE

< Write by others

<

Deprecated:
See also
APR_FPROT_WWRITE

< File is executable

< File is executable

< Execute by user

<

Deprecated:
See also
APR_FPROT_UEXECUTE

< Execute by group

<

Deprecated:
See also
APR_FPROT_GEXECUTE

< Execute by others

<

Deprecated:
See also
APR_FPROT_WEXECUTE

< Execute by user

<

Deprecated:
See also
APR_FPROT_UEXECUTE

< Execute by group

<

Deprecated:
See also
APR_FPROT_GEXECUTE

< Execute by others

<

Deprecated:
See also
APR_FPROT_WEXECUTE

< Access Time

< Stat the link not the file itself if it is a link

< Stat the link not the file itself if it is a link

< Stat the link not the file itself if it is a link

< Create the file if not there

< Open the file for reading

< Open the file for writing

< Open should fail if APR_FOPEN_CREATE and file exists.

< Delete the file after close

< Open the file for reading

< Open the file for writing

< Open the file for reading

< Open the file for writing

< Create the file if not there

< Open should fail if APR_FOPEN_CREATE and file exists.

< Open should fail if APR_FOPEN_CREATE and file exists.

< Create the file if not there

< Append to the end of the file

< Open the file and truncate to 0 length

< Platform dependent flag to enable * non blocking file io

< use OS's default permissions

<

Deprecated:
See also
APR_FPROT_OS_DEFAULT

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

< Open the file for buffered I/O

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

< Open the file for buffered I/O

< Open the file for writing

< Open the file for writing

< Open the file for reading

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

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

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

< ->name in proper case

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

< Size of the file

< Size of the file

< dev and inode

< Number of links

< ->name in proper case

< Type

< Type

< ->name in proper case

< File is read-only

< File is hidden

< File is read-only

< File is read-only

< File is hidden

< File is hidden

< Open the file for reading

< use OS's default permissions

<

Deprecated:
See also
APR_FPROT_OS_DEFAULT

< Platform dependent flag to enable * non blocking file io

< Open the file for reading

< Open the file for writing

< Create the file if not there

< Open should fail if APR_FOPEN_CREATE and file exists.

< Open the file and truncate to 0 length

< Open the file and truncate to 0 length

< Open should fail if APR_FOPEN_CREATE and file exists.

< Create the file if not there

< Delete the file after close

< Open the file for reading

< Open the file for writing

< Platform dependent tag to open the file for use across multiple threads

< Append to the end of the file

< Open the file for buffered I/O

< Platform dependent flag to enable * sparse file support, see WARNING below

< Do not register a cleanup when the file is opened. The apr_os_file_t handle in apr_file_t will not be closed when the pool is destroyed.

< Append to the end of the file

< Open the file for buffered I/O

< Open the file for writing

< Open the file for writing

< Open the file for reading

< Platform dependent tag to open the file for use across multiple threads

< Platform dependent tag to open the file for use across multiple threads

< Platform dependent tag to open the file for use across multiple threads

< Platform dependent tag to open the file for use across multiple threads

< Platform dependent tag to open the file for use across multiple threads

< Platform dependent tag to open the file for use across multiple threads

< Exclusive lock. Only one process may hold an exclusive lock at any given time. This is analogous to a "write lock".

< Platform dependent tag to open the file for use across multiple threads

< Platform dependent tag to open the file for use across multiple threads

< Platform dependent tag to open the file for use across multiple threads

< Platform dependent tag to open the file for use across multiple threads

< Size of the file

< Platform dependent tag to open the file for use across multiple threads

< Size of the file

Definition at line 74 of file apr_atomic.c.

Variable Documentation

◆ ap

Definition at line 176 of file apr_lib.h.

◆ bufsize

char apr_size_t* bufsize

Definition at line 190 of file apr_lib.h.

◆ c

Definition at line 175 of file apr_lib.h.

◆ fmt

Definition at line 175 of file apr_lib.h.

◆ pwbuf

char* pwbuf

Definition at line 189 of file apr_lib.h.