<-
Apache > HTTP 服务器 > 文档 > 版本 2.4 > 模块

Apache 模块 mod_slotmem_shm

可用语言:  en  |  fr 

描述基于槽的共享内存提供程序。
状态扩展
模块标识符slotmem_shm_module
源文件mod_slotmem_shm.c

摘要

mod_slotmem_shm 是一个内存提供程序,它提供创建和访问共享内存段的功能,其中数据集以“槽”的形式组织。

每次重启(无论是否优雅重启)都会清除和清理所有共享内存。数据本身存储在由createattach调用中的name参数指定的文件中,并从该文件中恢复。如果未指定绝对路径,则该文件将相对于由DefaultRuntimeDir指令指定的路径创建。

mod_slotmem_shm 提供以下 API 函数

/* call the callback on all worker slots */
apr_status_t doall(ap_slotmem_instance_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. 'name' is used to generate a filename for the persistent
   store of the shared memory if configured. Values are:
      "none"                - Anonymous shared memory and no persistent store
      "file-name"           - [DefaultRuntimeDir]/file-name
      "/absolute-file-name" - Absolute file name */
apr_status_t create(ap_slotmem_instance_t **new, const char *name, apr_size_t item_size, unsigned int item_num, ap_slotmem_type_t type, apr_pool_t *pool)

/* attach to an existing slotmem. See 'create()' for description of 'name' parameter */
apr_status_t attach(ap_slotmem_instance_t **new, const char *name, apr_size_t *item_size, unsigned int *item_num, apr_pool_t *pool)

/* get the direct pointer to the memory associated with this worker slot */
apr_status_t dptr(ap_slotmem_instance_t *s, unsigned int item_id, void **mem)

/* get/read the memory from this slot to dest */
apr_status_t get(ap_slotmem_instance_t *s, unsigned int item_id, unsigned char *dest, apr_size_t dest_len)

/* put/write the data from src to this slot */
apr_status_t put(ap_slotmem_instance_t *slot, unsigned int item_id, unsigned char *src, apr_size_t src_len)

/* return the total number of slots in the segment */
unsigned int num_slots(ap_slotmem_instance_t *s)

/* return the total data size, in bytes, of a slot in the segment */
apr_size_t slot_size(ap_slotmem_instance_t *s)

/* grab or allocate the first free slot and mark as in-use (does not do any data copying) */
apr_status_t grab(ap_slotmem_instance_t *s, unsigned int *item_id)

/* forced grab or allocate the specified slot and mark as in-use (does not do any data copying) */
apr_status_t fgrab(ap_slotmem_instance_t *s, unsigned int item_id)

/* release or free a slot and mark as not in-use (does not do any data copying) */
apr_status_t release(ap_slotmem_instance_t *s, unsigned int item_id)
Support Apache!

指令

此模块不提供任何指令。

错误修复清单

另请参阅

可用语言:  en  |  fr 

top

评论

注意
这不是问答区。此处发布的评论应指向有关改进文档或服务器的建议,如果这些建议已实施或被认为无效/不相关,则可能会被我们的版主删除。有关如何管理 Apache HTTP Server 的问题,请咨询我们的 IRC 频道 #httpd(在 Libera.chat 上)或发送到我们的邮件列表