Could someone check if this is valid to fix the problems with httpd-ldap in apache
2.0.35, due to the new APR shared memory treatment?
I have tested this with Apache 2.0.35 and openldap 2.0.23.
Thanks,
Eduardo Garcia.
Index: httpd-ldap/ldap-cache/util_ldap_cache.c
===================================================================
RCS file: /home/cvspublic/httpd-ldap/ldap-cache/util_ldap_cache.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 util_ldap_cache.c
--- httpd-ldap/ldap-cache/util_ldap_cache.c 16 Oct 2001 21:29:08 -0000 1.1.1.1
+++ httpd-ldap/ldap-cache/util_ldap_cache.c 25 Apr 2002 16:23:10 -0000
@@ -291,11 +291,17 @@
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: httpd-ldap/ldap-cache/util_ldap_cache_mgr.c
===================================================================
RCS file: /home/cvspublic/httpd-ldap/ldap-cache/util_ldap_cache_mgr.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 util_ldap_cache_mgr.c
--- httpd-ldap/ldap-cache/util_ldap_cache_mgr.c 16 Oct 2001 21:29:08 -0000 1.1.1.1
+++ httpd-ldap/ldap-cache/util_ldap_cache_mgr.c 25 Apr 2002 16:23:19 -0000
@@ -117,7 +117,7 @@
#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 @@
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 @@
{
#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;
Index: httpd-ldap/ldap-cache/util_ldap_cache.h
===================================================================
RCS file: /home/cvspublic/httpd-ldap/ldap-cache/util_ldap_cache.h,v
retrieving revision 1.2
diff -u -r1.2 util_ldap_cache.h
--- httpd-ldap/ldap-cache/util_ldap_cache.h 8 Feb 2002 18:29:17 -0000 1.2
+++ httpd-ldap/ldap-cache/util_ldap_cache.h 25 Apr 2002 16:23:37 -0000
@@ -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 @@
} 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;