apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject Re: [PATCH] Re: mmap_setaside?
Date Wed, 14 Nov 2001 18:12:43 GMT
On Wed, 14 Nov 2001, Brian Pane wrote:

> Actually, the more I think about it, the less I like the idea of
> exposing mmap_cleanup in any form (including the function pointer
> in the struct).  The problem is that it introduces extra coupling
> between the mmap code and the bucket code, so that the latter can
> take advantage of an implementation detail of the former (the fact
> that there happens to be exactly one cleanup function registered
> per apr_mmap_t in its original pool).

I had sort of the same objection, which is why I didn't just go ahead and
do this.  <sigh>

> As an alternate implementation, how about this?
>   apr_status_t apr_pool_cleanup_transfer(apr_pool_t *src, apr_pool_t *dst,
>                                          void *object);

That has problems, too, because it doesn't work right for all types of
objects.  It only happens to work for MMAPs because MMAPs don't have other
stuff allocated from the pool, like internal locks and stuff.  (I believe
this would break horribly if you ran it on an apr_file_t, for example.)

I think the ideal situation would be if we had an apr_mmap_dup() similar
to our apr_file_dup().  apr_file_dup() already solves this problem for
files by ensuring that a duplicate copy of the file descriptor lives as
long as the given pool.  apr_mmap_dup() in the case of duping into an
ancestor pool could do exactly what we're trying to get mmap_setaside() to
do: copy the apr_mmap_t() into the ancestor pool and tweak the cleanups.
In the case of disjoint pools, it could do something else (what I haven't
decided yet).  Then mmap_setaside() becomes as easy as file_setaside() is.



   Cliff Woolley
   Charlottesville, VA

View raw message