httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <bp...@pacbell.net>
Subject Re: mod_include vs file descriptors
Date Tue, 13 Nov 2001 16:05:59 GMT
Cliff Woolley wrote:

>On Tue, 13 Nov 2001, Brian Pane wrote:
>
>>As a simpler solution, is there any reason why we can't close the
>>file descriptor when turning a file bucket into an mmap bucket?
>>
>> static void file_destroy(void *data)
>> {
>>+    apr_bucket_file *a = (apr_bucket_file *)data;
>>+    apr_file_close(a->fd);
>>     if (apr_bucket_shared_destroy(data)) {
>>-        /* no need to close the file here; it will get
>>-         * done automatically when the pool gets cleaned up */
>>         free(data);
>>     }
>> }
>>
>
>Well, for one thing, the apr_file_close() would go inside the if() exactly
>where the commenet is now, not outside the if.  But you can't do this
>anyway, because the buckets code doesn't necessarily "own" the file
>descriptor.  This would break mod_file_cache, for example, if a bucket
>with a cached file descriptor were ever apr_bucket_read()'ed.
>

How about a "close-on-mmap" flag for file buckets, which
mod_core would set when creating file buckets but mod_file_cache
wouldn't?

--Brian




Mime
View raw message