~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to srclib/apr/include/apr_shm.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
 
2
 * applicable.
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
#ifndef APR_SHM_H
 
18
#define APR_SHM_H
 
19
 
 
20
/**
 
21
 * @file apr_shm.h
 
22
 * @brief APR Shared Memory Routines
 
23
 */
 
24
 
 
25
#include "apr.h"
 
26
#include "apr_pools.h"
 
27
#include "apr_errno.h"
 
28
 
 
29
#ifdef __cplusplus
 
30
extern "C" {
 
31
#endif /* __cplusplus */
 
32
 
 
33
/**
 
34
 * @defgroup apr_shm Shared Memory Routines
 
35
 * @ingroup APR 
 
36
 * @{
 
37
 */
 
38
 
 
39
/**
 
40
 * Private, platform-specific data struture representing a shared memory
 
41
 * segment.
 
42
 */
 
43
typedef struct apr_shm_t apr_shm_t;
 
44
 
 
45
/**
 
46
 * Create and make accessable a shared memory segment.
 
47
 * @param m The shared memory structure to create.
 
48
 * @param reqsize The desired size of the segment.
 
49
 * @param filename The file to use for shared memory on platforms that
 
50
 *        require it.
 
51
 * @param pool the pool from which to allocate the shared memory
 
52
 *        structure.
 
53
 * @remark A note about Anonymous vs. Named shared memory segments:
 
54
 *         Not all plaforms support anonymous shared memory segments, but in
 
55
 *         some cases it is prefered over other types of shared memory
 
56
 *         implementations. Passing a NULL 'file' parameter to this function
 
57
 *         will cause the subsystem to use anonymous shared memory segments.
 
58
 *         If such a system is not available, APR_ENOTIMPL is returned.
 
59
 * @remark A note about allocation sizes:
 
60
 *         On some platforms it is necessary to store some metainformation
 
61
 *         about the segment within the actual segment. In order to supply
 
62
 *         the caller with the requested size it may be necessary for the
 
63
 *         implementation to request a slightly greater segment length
 
64
 *         from the subsystem. In all cases, the apr_shm_baseaddr_get()
 
65
 *         function will return the first usable byte of memory.
 
66
 * 
 
67
 */
 
68
APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
 
69
                                         apr_size_t reqsize,
 
70
                                         const char *filename,
 
71
                                         apr_pool_t *pool);
 
72
 
 
73
/**
 
74
 * Remove shared memory segment associated with a filename.
 
75
 * @param filename The filename associated with shared-memory segment which
 
76
 *        needs to be removed
 
77
 * @param pool The pool used for file operations
 
78
 * @remark This function is only supported on platforms which support
 
79
 * name-based shared memory segments, and will return APR_ENOTIMPL on
 
80
 * platforms without such support.
 
81
 */
 
82
APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename,
 
83
                                         apr_pool_t *pool);
 
84
 
 
85
/**
 
86
 * Destroy a shared memory segment and associated memory.
 
87
 * @param m The shared memory segment structure to destroy.
 
88
 */
 
89
APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m);
 
90
 
 
91
/**
 
92
 * Attach to a shared memory segment that was created
 
93
 * by another process.
 
94
 * @param m The shared memory structure to create.
 
95
 * @param filename The file used to create the original segment.
 
96
 *        (This MUST match the original filename.)
 
97
 * @param pool the pool from which to allocate the shared memory
 
98
 *        structure for this process.
 
99
 */
 
100
APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m,
 
101
                                         const char *filename,
 
102
                                         apr_pool_t *pool);
 
103
 
 
104
/**
 
105
 * Detach from a shared memory segment without destroying it.
 
106
 * @param m The shared memory structure representing the segment
 
107
 *        to detach from.
 
108
 */
 
109
APR_DECLARE(apr_status_t) apr_shm_detach(apr_shm_t *m);
 
110
 
 
111
/**
 
112
 * Retrieve the base address of the shared memory segment.
 
113
 * NOTE: This address is only usable within the callers address
 
114
 * space, since this API does not guarantee that other attaching
 
115
 * processes will maintain the same address mapping.
 
116
 * @param m The shared memory segment from which to retrieve
 
117
 *        the base address.
 
118
 * @return address, aligned by APR_ALIGN_DEFAULT.
 
119
 */
 
120
APR_DECLARE(void *) apr_shm_baseaddr_get(const apr_shm_t *m);
 
121
 
 
122
/**
 
123
 * Retrieve the length of a shared memory segment in bytes.
 
124
 * @param m The shared memory segment from which to retrieve
 
125
 *        the segment length.
 
126
 */
 
127
APR_DECLARE(apr_size_t) apr_shm_size_get(const apr_shm_t *m);
 
128
 
 
129
/**
 
130
 * Get the pool used by this shared memory segment.
 
131
 */
 
132
APR_POOL_DECLARE_ACCESSOR(shm);
 
133
 
 
134
/** @} */ 
 
135
 
 
136
#ifdef __cplusplus
 
137
}
 
138
#endif
 
139
 
 
140
#endif  /* APR_SHM_T */