From 3b2f5cea1f910b5e38e5d6da70b424057acfe5da Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Fri, 26 Apr 2002 21:54:38 +0000 Subject: [PATCH] Apply a patch to compile cleanly again against changes to the shared memory implementation in APR. PR: Obtained from: Submitted by: Eduardo Garcia Lopez Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94818 13f79535-47bb-0310-9956-ffa450edef68 --- modules/experimental/util_ldap_cache.c | 8 +++++++- modules/experimental/util_ldap_cache.h | 4 +++- modules/experimental/util_ldap_cache_mgr.c | 6 +++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/experimental/util_ldap_cache.c b/modules/experimental/util_ldap_cache.c index 9d9844ddd6..83665a6146 100644 --- a/modules/experimental/util_ldap_cache.c +++ b/modules/experimental/util_ldap_cache.c @@ -291,11 +291,17 @@ apr_status_t util_ldap_cache_module_kill(void *data) 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, diff --git a/modules/experimental/util_ldap_cache.h b/modules/experimental/util_ldap_cache.h index 8e71799734..f2be43d024 100644 --- a/modules/experimental/util_ldap_cache.h +++ b/modules/experimental/util_ldap_cache.h @@ -69,6 +69,7 @@ */ #include +#include /* EDD */ typedef struct util_cache_node_t { void *payload; /* Pointer to the payload */ @@ -102,7 +103,8 @@ typedef struct util_ald_cache_t { } 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; diff --git a/modules/experimental/util_ldap_cache_mgr.c b/modules/experimental/util_ldap_cache_mgr.c index 49eece8958..89064a0aed 100644 --- a/modules/experimental/util_ldap_cache_mgr.c +++ b/modules/experimental/util_ldap_cache_mgr.c @@ -117,7 +117,7 @@ void util_ald_free(const void *ptr) #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); @@ -134,7 +134,7 @@ void *util_ald_alloc(unsigned long size) 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); } @@ -147,7 +147,7 @@ const char *util_ald_strdup(const char *s) { #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; -- 2.40.0