]> granicus.if.org Git - apache/commitdiff
Apply a patch to compile cleanly again against changes to the shared memory
authorGraham Leggett <minfrin@apache.org>
Fri, 26 Apr 2002 21:54:38 +0000 (21:54 +0000)
committerGraham Leggett <minfrin@apache.org>
Fri, 26 Apr 2002 21:54:38 +0000 (21:54 +0000)
implementation in APR.
PR:
Obtained from:
Submitted by: Eduardo Garcia Lopez <egarcia@stream18.com>
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
modules/experimental/util_ldap_cache.h
modules/experimental/util_ldap_cache_mgr.c

index 9d9844ddd6c118a813204b51283f7b62aeac655f..83665a6146954c52a57526f718ea9c20d2cbe80b 100644 (file)
@@ -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,
index 8e717997340e1fd61fcc6cd737c1cbf6abe1bf75..f2be43d0244a47296c6c46361fec060b26344208 100644 (file)
@@ -69,6 +69,7 @@
  */
 
 #include <apr_shm.h>
+#include <apr_rmm.h> /* 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;
index 49eece895820ca5772942a741e8acdf1789f3869..89064a0aed8504c3bde11952d2dad2331f693d0a 100644 (file)
@@ -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;