You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Greg Stein <gs...@lyra.org> on 2000/11/09 01:48:24 UTC
Re: cvs commit: apache-2.0/src/modules/standard mod_file_cache.c
Euh... that would indicate a problem with ap_send_fd(). We pass in an
offset, so it should use it. We shouldn't have to see beforehand.
Am I missing something about ap_send_fd's API?
Cheers,
-g
On Wed, Nov 08, 2000 at 11:07:46PM -0000, trawick@locus.apache.org wrote:
> trawick 00/11/08 15:07:38
>
> Modified: src/modules/standard mod_file_cache.c
> Log:
> When caching file handles (vs. mmaps) reset the file pointer
> before serving, since a filter may have caused the file pointer
> to advance.
>
> Revision Changes Path
> 1.32 +8 -0 apache-2.0/src/modules/standard/mod_file_cache.c
>
> Index: mod_file_cache.c
> ===================================================================
> RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_file_cache.c,v
> retrieving revision 1.31
> retrieving revision 1.32
> diff -u -r1.31 -r1.32
> --- mod_file_cache.c 2000/11/08 19:07:34 1.31
> +++ mod_file_cache.c 2000/11/08 23:07:32 1.32
> @@ -401,6 +401,14 @@
> #if APR_HAS_SENDFILE
> apr_size_t nbytes;
> apr_status_t rv = APR_EINIT;
> + apr_off_t offset = 0;
> +
> + rv = apr_seek(file->file, APR_SET, &offset);
> + if (rv != APR_SUCCESS) {
> + ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
> + "seek failed");
> + return HTTP_INTERNAL_SERVER_ERROR;
> + }
>
> rv = ap_send_fd(file->file, r, 0, file->finfo.size, &nbytes);
> if (rv != APR_SUCCESS) {
>
>
>
--
Greg Stein, http://www.lyra.org/
Re: cvs commit: apache-2.0/src/modules/standard mod_file_cache.c
Posted by Jeff Trawick <tr...@bellsouth.net>.
Greg Stein <gs...@lyra.org> writes:
> Euh... that would indicate a problem with ap_send_fd(). We pass in an
> offset, so it should use it. We shouldn't have to see beforehand.
>
> Am I missing something about ap_send_fd's API?
What to do depends on how silly it is for main path (static page, not
cached via mod_file_cache) to waste a syscall seeking to where it
already is (relatively cheap but still with fixed syscall overhead).
FW[little]IW, Apache and included modules always pass zero for the
offset to ap_send_fd().
--
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
http://www.geocities.com/SiliconValley/Park/9289/
Born in Roswell... married an alien...