httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject Re: mod_include vs file descriptors
Date Tue, 13 Nov 2001 15:20:38 GMT
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.

--Cliff

--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA



Mime
View raw message