You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2005/07/28 13:53:30 UTC
svn commit: r225753 - /httpd/httpd/trunk/modules/ldap/util_ldap_cache.c
Author: jorton
Date: Thu Jul 28 04:53:25 2005
New Revision: 225753
URL: http://svn.apache.org/viewcvs?rev=225753&view=rev
Log:
* modules/ldap/util_ldap_cache.c (util_ldap_cache_init): Use the
actual available size of the shm segment not the requested size.
Ensure the requested size is aligned. Check errors from apr_rmm_init.
Modified:
httpd/httpd/trunk/modules/ldap/util_ldap_cache.c
Modified: httpd/httpd/trunk/modules/ldap/util_ldap_cache.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/ldap/util_ldap_cache.c?rev=225753&r1=225752&r2=225753&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ldap/util_ldap_cache.c (original)
+++ httpd/httpd/trunk/modules/ldap/util_ldap_cache.c Thu Jul 28 04:53:25 2005
@@ -407,8 +407,11 @@
{
#if APR_HAS_SHARED_MEMORY
apr_status_t result;
+ apr_size_t size;
- result = apr_shm_create(&st->cache_shm, st->cache_bytes, st->cache_file, st->pool);
+ size = APR_ALIGN_DEFAULT(st->cache_bytes);
+
+ result = apr_shm_create(&st->cache_shm, size, st->cache_file, st->pool);
if (result == APR_EEXIST) {
/*
* The cache could have already been created (i.e. we may be a child process). See
@@ -420,8 +423,17 @@
return result;
}
+ /* Determine the usable size of the shm segment. */
+ size = apr_shm_size_get(st->cache_shm);
+
/* This will create a rmm "handler" to get into the shared memory area */
- apr_rmm_init(&st->cache_rmm, NULL, (void *)apr_shm_baseaddr_get(st->cache_shm), st->cache_bytes, st->pool);
+ result = apr_rmm_init(&st->cache_rmm, NULL,
+ apr_shm_baseaddr_get(st->cache_shm), size,
+ st->pool);
+ if (result != APR_SUCCESS) {
+ return result;
+ }
+
#endif
apr_pool_cleanup_register(st->pool, st , util_ldap_cache_module_kill, apr_pool_cleanup_null);