Apache HTTPD
Typedefs | Functions | Variables
Skip list implementation

Typedefs

typedef int(* apr_skiplist_compare) (void *, void *)
 
typedef void(* apr_skiplist_freefunc) (void *)
 
typedef struct apr_skiplist apr_skiplist
 
typedef struct apr_skiplistnode apr_skiplistnode
 

Functions

 APR_DECLARE (void *) apr_skiplist_alloc(apr_skiplist *sl
 
 APR_DECLARE (void) apr_skiplist_free(apr_skiplist *sl
 
 APR_DECLARE (apr_status_t) apr_skiplist_init(apr_skiplist **sl
 
 APR_DECLARE (apr_skiplistnode *) apr_skiplist_getlist(apr_skiplist *sl)
 
 APR_DECLARE (size_t) apr_skiplist_size(const apr_skiplist *sl)
 
 APR_DECLARE (apr_skiplist *) apr_skiplist_merge(apr_skiplist *sl1
 

Variables

size_t size
 
void * mem
 
apr_pool_tp
 
apr_skiplist_compare XXX1
 
apr_skiplist_compare apr_skiplist_compare XXX2
 
void * data
 
void apr_skiplistnode ** iter
 
void apr_skiplistnode apr_skiplist_compare func
 
void apr_skiplistnode apr_skiplist_compare comp
 
void apr_skiplist_freefunc myfree
 
int to
 
apr_skiplistsl2
 

Detailed Description

Refer to http://en.wikipedia.org/wiki/Skip_list for information about the purpose of and ideas behind skip lists.

Typedef Documentation

◆ apr_skiplist

Opaque structure used to represent the skip list

Definition at line 56 of file apr_skiplist.h.

◆ apr_skiplist_compare

typedef int(* apr_skiplist_compare) (void *, void *)

apr_skiplist_compare is the function type that must be implemented per object type that is used in a skip list for comparisons to maintain order

Definition at line 45 of file apr_skiplist.h.

◆ apr_skiplist_freefunc

typedef void(* apr_skiplist_freefunc) (void *)

apr_skiplist_freefunc is the function type that must be implemented to handle elements as they are removed from a skip list.

Definition at line 51 of file apr_skiplist.h.

◆ apr_skiplistnode

Opaque structure

Definition at line 65 of file apr_skiplist.h.

Function Documentation

◆ APR_DECLARE() [1/6]

APR_DECLARE ( apr_skiplist )

Merge two skip lists. XXX SEMANTICS

Parameters
sl1One of two skip lists to be merged
sl2The other of two skip lists to be merged

◆ APR_DECLARE() [2/6]

APR_DECLARE ( apr_skiplistnode )

Return the list maintained by the skip list abstraction.

Parameters
slThe skip list

Insert an element into the skip list using the specified comparison function if it does not already exist.

Parameters
slThe skip list
dataThe element to insert
compThe comparison function to use for placement into the skip list

Insert an element into the skip list using the existing comparison function if it does not already exist.

Parameters
slThe skip list
dataThe element to insert
Remarks
If no comparison function has been set for the skip list, the element will not be inserted and NULL will be returned.

Add an element into the skip list using the specified comparison function allowing for duplicates.

Parameters
slThe skip list
dataThe element to add
compThe comparison function to use for placement into the skip list

Add an element into the skip list using the existing comparison function allowing for duplicates.

Parameters
slThe skip list
dataThe element to insert
Remarks
If no comparison function has been set for the skip list, the element will not be inserted and NULL will be returned.

Add an element into the skip list using the specified comparison function removing the existing duplicates.

Parameters
slThe skip list
dataThe element to insert
compThe comparison function to use for placement into the skip list
myfreeA function to be called for each removed duplicate
Remarks
If no comparison function has been set for the skip list, the element will not be inserted, none will be replaced, and NULL will be returned.

Add an element into the skip list using the existing comparison function removing the existing duplicates.

Parameters
slThe skip list
dataThe element to insert
myfreeA function to be called for each removed duplicate
Remarks
If no comparison function has been set for the skip list, the element will not be inserted, none will be replaced, and NULL will be returned.

◆ APR_DECLARE() [3/6]

APR_DECLARE ( apr_status_t  )

Allocate a new skip list

Parameters
slThe pointer in which to return the newly created skip list
pThe pool from which to allocate the skip list (optional).
Remarks
Unlike most APR functions, a pool is optional. If no pool is provided, the C standard library heap functions will be used instead.

Remove a node from the skip list.

Parameters
slThe skip list
iterThe skip list node to remove
myfreeA function to be called for the removed element

Remove an element from the skip list using the specified comparison function for locating the element. In the case of duplicates, the 1st entry will be removed.

Parameters
slThe skip list
dataThe element to remove
myfreeA function to be called for each removed element
compThe comparison function to use for placement into the skip list
Remarks
If the element is not found, 0 will be returned. Otherwise, the heightXXX will be returned.

Remove an element from the skip list using the existing comparison function for locating the element. In the case of duplicates, the 1st entry will be removed.

Parameters
slThe skip list
dataThe element to remove
myfreeA function to be called for each removed element
Remarks
If the element is not found, 0 will be returned. Otherwise, the heightXXX will be returned.
If no comparison function has been set for the skip list, the element will not be removed and 0 will be returned.

Return the height of the list (number of skip paths), in O(1).

Parameters
slThe skip list

Return the predefined maximum height of the skip list.

Parameters
slThe skip list

< 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.

◆ APR_DECLARE() [4/6]

APR_DECLARE ( size_t  ) const

Return the size of the list (number of elements), in O(1).

Parameters
slThe skip list

◆ APR_DECLARE() [5/6]

APR_DECLARE ( void *  )

Allocate memory using the same mechanism as the skip list.

Parameters
slThe skip list
sizeThe amount to allocate
Remarks
If a pool was provided to apr_skiplist_init(), memory will be allocated from the pool or from a free list maintained with the skip list. Otherwise, memory will be allocated using the C standard library heap functions.

Return the next matching element in the skip list using the specified comparison function.

Parameters
slThe skip list
dataThe value to search for
iterA pointer to the returned skip list node representing the element found
funcThe comparison function to use

Return the next matching element in the skip list using the current comparison function.

Parameters
slThe skip list
dataThe value to search for
iterA pointer to the returned skip list node representing the element found

Return the last matching element in the skip list using the specified comparison function.

Parameters
slThe skip list
dataThe value to search for
iterA pointer to the returned skip list node representing the element found
compThe comparison function to use

Return the last matching element in the skip list using the current comparison function.

Parameters
slThe skip list
dataThe value to search for
iterA pointer to the returned skip list node representing the element found

Return the next element in the skip list.

Parameters
slThe skip list
iterOn entry, a pointer to the skip list node to start with; on return, a pointer to the skip list node representing the element returned
Remarks
If iter points to a NULL value on entry, NULL will be returned.

Return the previous element in the skip list.

Parameters
slThe skip list
iterOn entry, a pointer to the skip list node to start with; on return, a pointer to the skip list node representing the element returned
Remarks
If iter points to a NULL value on entry, NULL will be returned.

Return the element of the skip list node

Parameters
iterThe skip list node

Return the first element in the skip list, removing the element from the skip list.

Parameters
slThe skip list
myfreeA function to be called for the removed element
Remarks
NULL will be returned if there are no elements

Return the first element in the skip list, leaving the element in the skip list.

Parameters
slThe skip list
Remarks
NULL will be returned if there are no elements

Definition at line 131 of file apr_atomic.c.

◆ APR_DECLARE() [6/6]

APR_DECLARE ( void  )

Free memory using the same mechanism as the skip list.

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

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

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

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

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

Remove all elements from the skip list.

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

Remove each element from the skip list.

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

Set a predefined maximum height for the skip list.

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

< 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

Definition at line 224 of file apr_pools.h.

Variable Documentation

◆ comp

Definition at line 166 of file apr_skiplist.h.

◆ data

void * data

Definition at line 141 of file apr_skiplist.h.

◆ func

Definition at line 143 of file apr_skiplist.h.

◆ iter

Definition at line 142 of file apr_skiplist.h.

◆ mem

void* mem

Definition at line 88 of file apr_skiplist.h.

◆ myfree

Definition at line 254 of file apr_skiplist.h.

◆ p

Definition at line 97 of file apr_skiplist.h.

◆ size

size_t size

Definition at line 76 of file apr_skiplist.h.

◆ sl2

Definition at line 373 of file apr_skiplist.h.

◆ to

int to

Definition at line 366 of file apr_skiplist.h.

◆ XXX1

Definition at line 109 of file apr_skiplist.h.

◆ XXX2

Definition at line 110 of file apr_skiplist.h.