summaryrefslogtreecommitdiffstats
path: root/docs/manual/mod/mod_slotmem_shm.xml
blob: 0e475794d2c1515160696f5e3f9b5b419a82eeb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?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_shm.xml.meta">

<name>mod_slotmem_shm</name>
<description>Slot-based shared memory provider.</description>
<status>Extension</status>
<sourcefile>mod_slotmem_shm.c</sourcefile>
<identifier>mod_slotmem_shm_module</identifier>

<summary>
    <p><code>mod_slotmem_shm</code> is a memory provider which
    provides for creation and access to a shared memory segment
    in which the datasets are organized in "slots."
    </p>

    <p>All shared memory is cleared and cleaned with each
    restart, whether graceful or not. The data itself is
    stored and restored within a file noted by the <code>name</code>
    parameter in the <code>create</code> and <code>attach</code>
    calls.
    </p>

    <p><code>mod_slotmem_shm</code> provides the following API functions:
    </p>

    <dl>
      <dt>apr_status_t doall(ap_slotmem_instance_t *s, ap_slotmem_callback_fn_t *func, void *data, apr_pool_t *pool)</dt>
      <dd>call the callback on all worker slots</dd>

      <dt>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)</dt>
      <dd>create a new slotmem with each item size is item_size. <code>name</code> is the filename for the persistent store of
      the shared memory. Values are:
       <dl>
         <dt><code>"none"</code></dt>
         <dd><code>Does not persist shared memory in file.</code></dd>
         <dt><code>"anonymous"</code></dt>
         <dd><code>$server_root/logs/anonymous.slotmem</code></dd>
         <dt><code>":file-name"</code></dt>
         <dd><code>$server_root/logs/file-name.slotmem</code></dd>
         <dt><code>"absolute-file-name"</code></dt>
         <dd><code>$absolute-file-name.slotmem</code></dd>
       </dl></dd>

      <dt>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)</dt>
      <dd>attach to an existing slotmem. See <code>create</code> for description of <code>name</code> parameter.</dd>

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

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

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

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

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

      <dt>apr_status_t grab(ap_slotmem_instance_t *s, unsigned int item_id);</dt>
      <dd>grab or allocate a slot and mark as in-use (does not do any data copying)</dd>

      <dt>apr_status_t release(ap_slotmem_instance_t *s, unsigned int item_id);</dt>
      <dd>release or free a slot and mark as not in-use (does not do any data copying)</dd>
    </dl>

</summary>

</modulesynopsis>