From 8494021db28902cf7d92008b3c68d5bf8447465f Mon Sep 17 00:00:00 2001 From: Ian Holsman Date: Wed, 21 Nov 2001 17:01:42 +0000 Subject: [PATCH] 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 --- modules/cache/mod_file_cache.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/cache/mod_file_cache.c b/modules/cache/mod_file_cache.c index 568e059098..cc75eb4176 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); -- 2.50.1