apr_status_t util_ldap_cache_init(apr_pool_t *pool, apr_size_t reqsize)
{
+ apr_anylock_t rmm_lock;
+
apr_status_t result = APR_SUCCESS;
apr_pool_cleanup_register(pool, NULL, util_ldap_cache_module_kill, apr_pool_cleanup_null);
#if APR_HAS_SHARED_MEMORY
- result = apr_shm_init(&util_ldap_shm, reqsize, "/tmp/ldap_cache", pool);
+ result = apr_shm_create(&util_ldap_shm, reqsize, "/tmp/ldap_cache", pool);
+
+ /* This will create a rmm "handler" to get into the shared memory area */
+ apr_rmm_init(&util_ldap_rmm, &rmm_lock,
+ (void *)apr_shm_baseaddr_get(&util_ldap_shm) , reqsize, pool);
#endif
util_ldap_cache = util_ald_create_cache(50,
util_ldap_url_node_hash,
*/
#include <apr_shm.h>
+#include <apr_rmm.h> /* EDD */
typedef struct util_cache_node_t {
void *payload; /* Pointer to the payload */
} util_ald_cache_t;
#if APR_HAS_SHARED_MEMORY
-apr_shmem_t *util_ldap_shm;
+apr_shm_t *util_ldap_shm;
+apr_rmm_t *util_ldap_rmm;
#endif
util_ald_cache_t *util_ldap_cache;
apr_thread_rwlock_t *util_ldap_cache_lock;
#if APR_HAS_SHARED_MEMORY
if (util_ldap_shm) {
if (ptr)
- apr_shm_free(util_ldap_shm, (void *)ptr);
+ apr_rmm_free(util_ldap_rmm, apr_rmm_offset_get(util_ldap_rmm, (void *)ptr));
} else {
if (ptr)
free((void *)ptr);
return NULL;
#if APR_HAS_SHARED_MEMORY
if (util_ldap_shm) {
- return (void *)apr_shm_calloc(util_ldap_shm, size);
+ return (void *)apr_rmm_addr_get(util_ldap_rmm, apr_rmm_calloc(util_ldap_rmm, size));
} else {
return (void *)calloc(sizeof(char), size);
}
{
#if APR_HAS_SHARED_MEMORY
if (util_ldap_shm) {
- char *buf = apr_shm_malloc(util_ldap_shm, strlen(s)+1);
+ char *buf = (char *)apr_rmm_addr_get(util_ldap_rmm, apr_rmm_calloc(util_ldap_rmm, strlen(s)+1));
if (buf) {
strcpy(buf, s);
return buf;