| <?xml version="1.0"?> |
| <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd"> |
| <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?> |
| <!-- $LastChangedRevision$ --> |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <modulesynopsis metafile="mod_slotmem_plain.xml.meta"> |
| |
| <name>mod_slotmem_plain</name> |
| <description>Slot-based shared memory provider.</description> |
| <status>Extension</status> |
| <sourcefile>mod_slotmem_plain.c</sourcefile> |
| <identifier>slotmem_plain_module</identifier> |
| |
| <summary> |
| <p><module>mod_slotmem_plain</module> is a memory provider which |
| provides for creation and access to a plain memory segment |
| in which the datasets are organized in "slots." |
| </p> |
| |
| <p>If the memory needs to be shared between threads and |
| processes, a better provider would be |
| <module>mod_slotmem_shm</module>. |
| </p> |
| |
| <p><module>mod_slotmem_plain</module> provides the following API functions: |
| </p> |
| |
| <highlight language="c"> |
| /* 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 */ |
| 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 */ |
| 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) |
| </highlight> |
| |
| </summary> |
| |
| </modulesynopsis> |