You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Tim Moloney <mo...@mrsl.com> on 2002/03/06 14:42:26 UTC

Re: httpd-ldap and apr shared memory

Aaron Bannert wrote:

> On Wed, Mar 06, 2002 at 07:05:04AM -0500, Tim Moloney wrote:
> 
>>Further investigation shows that the new shared memory API in APR does
>>not include the functionality of the old API.  Specifically, the
>>following functions are missing:
>>
>>  apr_shm_malloc()
>>  apr_shm_calloc()
>>  apr_shm_free()
>>
>>So the solution to get httpd-ldap running is to complete APR's new
>>shared memory API.  Adding this functionality is beyond me but I'll
>>post it here so that someone more knowledgable can fix it.
>>
>>By the way, I currently have httpd-ldap running by commenting out the
>>httpd-ldap code that uses shared memory.
> 
> Actually, the malloc/calloc/free code was moved somewhere more generic.
> This allows the apr_shm.h API to deal with only the basics of shared
> memory allocation/deallocation, and do so in a way that is fully
> cross-platform. The old API didn't support non-process-inheritance
> systems like Win32, OS/2, etc.
> 
> See apr_rmm.h in apr-util. If you need more details I'd be happy to
> answer your questions over on the dev@apr.apache.org mailing list.


I took a look at apr_rmm.h and I vaguely understand what it's doing.

I see two approaches to fixing httpd-ldap.

- Replace the shm calls with rmm calls.  If this is done, what is the
   memory buffer (third arg) that is passed to apr_rmm_create()?

- Use the rmm calls on the shared memory.  Would the shared memory would
   be the memory buffer (third arg) passed to apr_rmm_create()?

Either way...

- What is "the appropriate type of lock" for rmm (second arg to
   apr_rmm_create())?

- Are the rmm pool and the shm pool the same (fifth arg to
   apr_rmm_create())?

-- 
Tim Moloney
ManTech Real-time Systems Laboratory
2015 Cattlemen Road                             \     /
Sarasota, FL  34232                     .________\(O)/________.
(941) 377-6775 x208                        '  '  O(.)O  '  '


Re: httpd-ldap and apr shared memory

Posted by Aaron Bannert <aa...@clove.org>.
On Wed, Mar 06, 2002 at 08:42:26AM -0500, Tim Moloney wrote:
> I took a look at apr_rmm.h and I vaguely understand what it's doing.
> 
> I see two approaches to fixing httpd-ldap.
> 
> - Replace the shm calls with rmm calls.  If this is done, what is the
>   memory buffer (third arg) that is passed to apr_rmm_create()?
> 
> - Use the rmm calls on the shared memory.  Would the shared memory would
>   be the memory buffer (third arg) passed to apr_rmm_create()?

I think you're on the right track.

create the shm
set up the anylock (it's just for determining the scope of the lock)
create the rmm (pass in the anylock and the shm)

then in the child, like in child_init():

attach to the shm
attach to the rmm

> Either way...
> 
> - What is "the appropriate type of lock" for rmm (second arg to
>   apr_rmm_create())?

It's a way to tell the internals of the rmm how wide of a scope
to use for the locking. It comes down to:
intrathread, intraprocess, both (aka global)

> - Are the rmm pool and the shm pool the same (fifth arg to
>   apr_rmm_create())?

The pool is just a way to keep track of resources and release
them at the appropriate time. In this case they're probably the same.

-aaron