From: Ian Holsman Date: Wed, 21 Nov 2001 17:01:42 +0000 (+0000) Subject: let mod_file_cache use the new apr_mmap_dup function X-Git-Tag: 2.0.29~69 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f13fbbaa705e4aa01574173fb4aab88f8805d5d3;p=thirdparty%2Fapache%2Fhttpd.git let mod_file_cache use the new apr_mmap_dup function Submitted by: Brian Pane git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@92092 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/cache/mod_file_cache.c b/modules/cache/mod_file_cache.c index 568e059098e..cc75eb41767 100644 --- a/modules/cache/mod_file_cache.c +++ b/modules/cache/mod_file_cache.c @@ -333,8 +333,20 @@ static int mmap_handler(request_rec *r, a_file *file) #if APR_HAS_MMAP apr_bucket *b; apr_bucket_brigade *bb = apr_brigade_create(r->pool); + apr_mmap_t *mm; + + /* Create a copy of the apr_mmap_t that's marked as + * a "non-owner." The reason for this is that the + * mmap bucket setaside function might later try to + * transfer ownership of the mmap from a request + * pool to a parent pool. For this particular mmap, + * though, we want the cache to retain ownership so + * that it never gets munmapped. Thus we give the + * bucket code a non-owner copy to work with. + */ + apr_mmap_dup(&mm, file->mm, r->pool, 0); - b = apr_bucket_mmap_create(file->mm, 0, (apr_size_t)file->finfo.size); + b = apr_bucket_mmap_create(mm, 0, (apr_size_t)file->finfo.size); APR_BRIGADE_INSERT_TAIL(bb, b); b = apr_bucket_eos_create(); APR_BRIGADE_INSERT_TAIL(bb, b);