Apache2
ap_slotmem_provider_t Struct Reference

#include <ap_slotmem.h>

Data Fields

const char * name
 
apr_status_t(* doall )(ap_slotmem_instance_t *s, ap_slotmem_callback_fn_t *func, void *data, apr_pool_t *pool)
 
apr_status_t(* create )(ap_slotmem_instance_t **inst, const char *name, apr_size_t item_size, unsigned int item_num, ap_slotmem_type_t type, apr_pool_t *pool)
 
apr_status_t(* attach )(ap_slotmem_instance_t **inst, const char *name, apr_size_t *item_size, unsigned int *item_num, apr_pool_t *pool)
 
apr_status_t(* dptr )(ap_slotmem_instance_t *s, unsigned int item_id, void **mem)
 
apr_status_t(* get )(ap_slotmem_instance_t *s, unsigned int item_id, unsigned char *dest, apr_size_t dest_len)
 
apr_status_t(* put )(ap_slotmem_instance_t *slot, unsigned int item_id, unsigned char *src, apr_size_t src_len)
 
unsigned int(* num_slots )(ap_slotmem_instance_t *s)
 
unsigned int(* num_free_slots )(ap_slotmem_instance_t *s)
 
apr_size_t(* slot_size )(ap_slotmem_instance_t *s)
 
apr_status_t(* grab )(ap_slotmem_instance_t *s, unsigned int *item_id)
 
apr_status_t(* release )(ap_slotmem_instance_t *s, unsigned int item_id)
 
apr_status_t(* fgrab )(ap_slotmem_instance_t *s, unsigned int item_id)
 

Field Documentation

◆ attach

apr_status_t(* ap_slotmem_provider_t::attach) (ap_slotmem_instance_t **inst, const char *name, apr_size_t *item_size, unsigned int *item_num, apr_pool_t *pool)

attach to an existing slotmem. This would attach to shared memory, basically.

Parameters
instwhere to store pointer to slotmem
namea key used for debugging and in mod_status output or allow another process to share this space.
item_sizesize of each item
item_nummax number of item.
poolis pool to memory allocate.
Returns
APR_SUCCESS if all went well

◆ create

apr_status_t(* ap_slotmem_provider_t::create) (ap_slotmem_instance_t **inst, const char *name, apr_size_t item_size, unsigned int item_num, ap_slotmem_type_t type, apr_pool_t *pool)

create a new slotmem with each item size is item_size. This would create shared memory, basically.

Parameters
instwhere to store pointer to slotmem
namea key used for debugging and in mod_status output or allow another process to share this space.
item_sizesize of each item
item_numnumber of item to create.
typetype of slotmem.
poolis pool used
Returns
APR_SUCCESS if all went well

◆ doall

apr_status_t(* ap_slotmem_provider_t::doall) (ap_slotmem_instance_t *s, ap_slotmem_callback_fn_t *func, void *data, apr_pool_t *pool)

call the callback on all worker slots

Parameters
sap_slotmem_instance_t to use.
functcallback function to call for each element.
dataparameter for the callback function.
poolis pool used
Returns
APR_SUCCESS if all went well

◆ dptr

apr_status_t(* ap_slotmem_provider_t::dptr) (ap_slotmem_instance_t *s, unsigned int item_id, void **mem)

get the memory ptr associated with this worker slot.

Parameters
sap_slotmem_instance_t to use.
item_iditem to return for 0 to item_num
memaddress to store the pointer to the slot
Returns
APR_SUCCESS if all went well

◆ fgrab

apr_status_t(* ap_slotmem_provider_t::fgrab) (ap_slotmem_instance_t *s, unsigned int item_id)

forced grab (or alloc) a slot associated with this item_id

Parameters
sap_slotmem_instance_t to use.
item_idto the specified slot id and marked as in-use
Returns
APR_SUCCESS if all went well

◆ get

apr_status_t(* ap_slotmem_provider_t::get) (ap_slotmem_instance_t *s, unsigned int item_id, unsigned char *dest, apr_size_t dest_len)

get/read the data associated with this worker slot.

Parameters
sap_slotmem_instance_t to use.
item_iditem to return for 0 to item_num
destaddress to store the data
dest_lenlength of dataset to retrieve
Returns
APR_SUCCESS if all went well

◆ grab

apr_status_t(* ap_slotmem_provider_t::grab) (ap_slotmem_instance_t *s, unsigned int *item_id)

grab (or alloc) a free slot

Parameters
sap_slotmem_instance_t to use.
item_idptr to the available slot id and marked as in-use
Returns
APR_SUCCESS if all went well

◆ name

const char* ap_slotmem_provider_t::name

◆ num_free_slots

unsigned int(* ap_slotmem_provider_t::num_free_slots) (ap_slotmem_instance_t *s)

return number of free (not used) slots allocated for this entry. Valid for slots which are AP_SLOTMEM_TYPE_PREGRAB as well as any which use get/release.

Parameters
sap_slotmem_instance_t to use.
Returns
number of slots

◆ num_slots

unsigned int(* ap_slotmem_provider_t::num_slots) (ap_slotmem_instance_t *s)

return number of slots allocated for this entry.

Parameters
sap_slotmem_instance_t to use.
Returns
number of slots

◆ put

apr_status_t(* ap_slotmem_provider_t::put) (ap_slotmem_instance_t *slot, unsigned int item_id, unsigned char *src, apr_size_t src_len)

put/write the data associated with this worker slot.

Parameters
sap_slotmem_instance_t to use.
item_iditem to return for 0 to item_num
srcaddress of the data to store in the slot
src_lenlength of dataset to store in the slot
Returns
APR_SUCCESS if all went well

◆ release

apr_status_t(* ap_slotmem_provider_t::release) (ap_slotmem_instance_t *s, unsigned int item_id)

release (or free) the slot associated with this item_id

Parameters
sap_slotmem_instance_t to use.
item_idslot id to free and mark as no longer in-use
Returns
APR_SUCCESS if all went well

◆ slot_size

apr_size_t(* ap_slotmem_provider_t::slot_size) (ap_slotmem_instance_t *s)

return slot size allocated for this entry.

Parameters
sap_slotmem_instance_t to use.
Returns
size of slot

The documentation for this struct was generated from the following file: