]> granicus.if.org Git - apache/commitdiff
let mod_file_cache use the new apr_mmap_dup function
authorIan Holsman <ianh@apache.org>
Wed, 21 Nov 2001 17:01:42 +0000 (17:01 +0000)
committerIan Holsman <ianh@apache.org>
Wed, 21 Nov 2001 17:01:42 +0000 (17:01 +0000)
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

index 568e059098e606f54f6c6ed16a10f19384be0d18..cc75eb417671a3fbe6f4d2dea11deb51d661c238 100644 (file)
@@ -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);