From bc20e54bd4d3da17bc7f7ea56cf6d4fb4392d4f3 Mon Sep 17 00:00:00 2001 From: Bill Stoddard Date: Thu, 23 Jan 2003 21:01:08 +0000 Subject: [PATCH] dup the apr_mmap_t out of the request pool for sending down on the brigade git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@98478 13f79535-47bb-0310-9956-ffa450edef68 --- modules/cache/mod_file_cache.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/modules/cache/mod_file_cache.c b/modules/cache/mod_file_cache.c index 89b3547d1d..6a789ecfba 100644 --- a/modules/cache/mod_file_cache.c +++ b/modules/cache/mod_file_cache.c @@ -210,13 +210,11 @@ static void cache_the_file(cmd_parms *cmd, const char *filename, int mmap) #if APR_HAS_MMAP if (mmap) { - apr_mmap_t *mm; - /* MMAPFile directive. MMAP'ing the file * XXX: APR_HAS_LARGE_FILES issue; need to reject this request if * size is greater than MAX(apr_size_t) (perhaps greater than 1M?). */ - if ((rc = apr_mmap_create(&mm, fd, 0, + if ((rc = apr_mmap_create(&new_file->mm, fd, 0, (apr_size_t)new_file->finfo.size, APR_MMAP_READ, cmd->pool)) != APR_SUCCESS) { apr_file_close(fd); @@ -225,13 +223,6 @@ static void cache_the_file(cmd_parms *cmd, const char *filename, int mmap) return; } apr_file_close(fd); - /* We want to cache a duplicate apr_mmap_t to pass to each - * request so that nothing in the request will ever think that - * it's allowed to delete the mmap, since the "refcount" will - * never reach zero. */ - /* XXX: the transfer_ownership flag on this call - * will go away soon.. it's ignored right now. */ - apr_mmap_dup(&new_file->mm, mm, cmd->pool, 0); new_file->is_mmapped = TRUE; } #endif @@ -321,9 +312,11 @@ static int mmap_handler(request_rec *r, a_file *file) #if APR_HAS_MMAP conn_rec *c = r->connection; apr_bucket *b; + apr_mmap_t *mm; apr_bucket_brigade *bb = apr_brigade_create(r->pool, c->bucket_alloc); - b = apr_bucket_mmap_create(file->mm, 0, (apr_size_t)file->finfo.size, + apr_mmap_dup(&mm, file->mm, r->pool, 0); + b = apr_bucket_mmap_create(mm, 0, (apr_size_t)file->finfo.size, c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb, b); b = apr_bucket_eos_create(c->bucket_alloc); -- 2.40.0