From: Jim Jagielski Date: Fri, 2 Jan 2009 19:58:08 +0000 (+0000) Subject: Add new struct element: name... X-Git-Tag: 2.3.1~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=005313c3ef9905d57b5f760e679a839c8eb6858f;p=apache Add new struct element: name... git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@730833 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/ap_slotmem.h b/include/ap_slotmem.h index 2abdefaa05..2e96659557 100644 --- a/include/ap_slotmem.h +++ b/include/ap_slotmem.h @@ -62,61 +62,63 @@ typedef struct ap_slotmem_t ap_slotmem_t; typedef apr_status_t ap_slotmem_callback_fn_t(void* mem, void *data, apr_pool_t *pool); struct ap_slotmem_storage_method { -/** - * call the callback on all worker slots - * @param s ap_slotmem_t to use. - * @param funct callback function to call for each element. - * @param data parameter for the callback function. - * @param pool is pool used to create scoreboard - * @return APR_SUCCESS if all went well - */ -apr_status_t (* slotmem_do)(ap_slotmem_t *s, ap_slotmem_callback_fn_t *func, void *data, apr_pool_t *pool); - -/** - * create a new slotmem with each item size is item_size. - * This would create shared memory, basically. - * @param pointer to store the address of the scoreboard. - * @param name is a key used for debugging and in mod_status output or allow another process to share this space. - * @param item_size size of each item - * @param item_num number of item to create. - * @param pool is pool used to create scoreboard - * @return APR_SUCCESS if all went well - */ -apr_status_t (* slotmem_create)(ap_slotmem_t **new, const char *name, apr_size_t item_size, int item_num, apr_pool_t *pool); - -/** - * attach to an existing slotmem. - * This would attach to shared memory, basically. - * @param pointer to store the address of the scoreboard. - * @param name is a key used for debugging and in mod_status output or allow another process to share this space. - * @param item_size size of each item - * @param item_num max number of item. - * @param pool is pool to memory allocate. - * @return APR_SUCCESS if all went well - */ -apr_status_t (* slotmem_attach)(ap_slotmem_t **new, const char *name, apr_size_t *item_size, int *item_num, apr_pool_t *pool); -/** - * get the memory associated with this worker slot. - * @param s ap_slotmem_t to use. - * @param item_id item to return for 0 to item_num - * @param mem address to store the pointer to the slot - * @return APR_SUCCESS if all went well - */ -apr_status_t (* slotmem_mem)(ap_slotmem_t *s, int item_id, void**mem); -/** - * lock the memory segment - * NOTE: All slots share the same mutex - * @param s ap_slotmem_t to use - * @return APR_SUCCESS if all went well - */ -apr_status_t (* slotmem_lock)(ap_slotmem_t *s); -/** - * unlock the memory segment - * NOTE: All slots share the same mutex - * @param s ap_slotmem_t to use. - * @return APR_SUCCESS if all went well - */ -apr_status_t (* slotmem_unlock)(ap_slotmem_t *s); + /* + * Name of the provider method + */ + const char *name; + /** + * call the callback on all worker slots + * @param s ap_slotmem_t to use. + * @param funct callback function to call for each element. + * @param data parameter for the callback function. + * @param pool is pool used to create scoreboard + * @return APR_SUCCESS if all went well + */ + apr_status_t (* slotmem_do)(ap_slotmem_t *s, ap_slotmem_callback_fn_t *func, void *data, apr_pool_t *pool); + /** + * create a new slotmem with each item size is item_size. + * This would create shared memory, basically. + * @param pointer to store the address of the scoreboard. + * @param name is a key used for debugging and in mod_status output or allow another process to share this space. + * @param item_size size of each item + * @param item_num number of item to create. + * @param pool is pool used to create scoreboard + * @return APR_SUCCESS if all went well + */ + apr_status_t (* slotmem_create)(ap_slotmem_t **new, const char *name, apr_size_t item_size, int item_num, apr_pool_t *pool); + /** + * attach to an existing slotmem. + * This would attach to shared memory, basically. + * @param pointer to store the address of the scoreboard. + * @param name is a key used for debugging and in mod_status output or allow another process to share this space. + * @param item_size size of each item + * @param item_num max number of item. + * @param pool is pool to memory allocate. + * @return APR_SUCCESS if all went well + */ + apr_status_t (* slotmem_attach)(ap_slotmem_t **new, const char *name, apr_size_t *item_size, int *item_num, apr_pool_t *pool); + /** + * get the memory associated with this worker slot. + * @param s ap_slotmem_t to use. + * @param item_id item to return for 0 to item_num + * @param mem address to store the pointer to the slot + * @return APR_SUCCESS if all went well + */ + apr_status_t (* slotmem_mem)(ap_slotmem_t *s, int item_id, void**mem); + /** + * lock the memory segment + * NOTE: All slots share the same mutex + * @param s ap_slotmem_t to use + * @return APR_SUCCESS if all went well + */ + apr_status_t (* slotmem_lock)(ap_slotmem_t *s); + /** + * unlock the memory segment + * NOTE: All slots share the same mutex + * @param s ap_slotmem_t to use. + * @return APR_SUCCESS if all went well + */ + apr_status_t (* slotmem_unlock)(ap_slotmem_t *s); }; typedef struct ap_slotmem_storage_method ap_slotmem_storage_method; diff --git a/modules/mem/mod_plainmem.c b/modules/mem/mod_plainmem.c index 968f7991fd..90ba950f87 100644 --- a/modules/mem/mod_plainmem.c +++ b/modules/mem/mod_plainmem.c @@ -151,10 +151,13 @@ static apr_status_t slotmem_mem(ap_slotmem_t *score, int id, void **mem) } static const ap_slotmem_storage_method storage = { + "plainmem", &slotmem_do, &slotmem_create, &slotmem_attach, - &slotmem_mem + &slotmem_mem, + NULL, + NULL }; static int pre_config(apr_pool_t *p, apr_pool_t *plog, diff --git a/modules/mem/mod_sharedmem.c b/modules/mem/mod_sharedmem.c index 9f6c34857f..874682a844 100644 --- a/modules/mem/mod_sharedmem.c +++ b/modules/mem/mod_sharedmem.c @@ -362,6 +362,7 @@ static apr_status_t slotmem_unlock(ap_slotmem_t *slot) } static const ap_slotmem_storage_method storage = { + "sharedmem", &slotmem_do, &slotmem_create, &slotmem_attach,