You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Geoff Greer <an...@mipsisrisc.com> on 2008/04/24 21:44:27 UTC
Patch to fix sendfile on OS X
Instead of my last suggestion to disable sendfile on 10.5, I've fixed
apr_socket_sendfile. The patch is attached. You can apply it by checking
out trunk:
cd apr/network_io/unix
patch -p0 < sendrecv.c.patch
Now the sendfile test case passes on OS X. This is my first real patch, so
suggestions are welcome.
Geoff
Re: Patch to fix sendfile on OS X
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Davi Arnaut wrote:
>
> Also please take a look at the mail thread with subject "sendfile(2)
> misbehaves when header iovecs are specified" on this same mailing list.
Uhm - Davi - I think you aught to look at the code on trunk - this must
have flown right past you ;-)
Re: Patch to fix sendfile on OS X
Posted by Davi Arnaut <da...@apache.org>.
William A. Rowe, Jr. wrote:
> Geoff Greer wrote:
>> Ugh, I actually broke apr_socket_sendfile on OS X when I cleaned up my
>> code for submission. Here is a patch for my patch.
>
> Please look one more time. client nonblocking and client timeout appear
> to work; client blocking appears to fail.
>
Also please take a look at the mail thread with subject "sendfile(2)
misbehaves when header iovecs are specified" on this same mailing list.
Regards,
--
Davi Arnaut
Re: Patch to fix sendfile on OS X
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Geoff Greer wrote:
> Ugh, I actually broke apr_socket_sendfile on OS X when I cleaned up my
> code for submission. Here is a patch for my patch.
Please look one more time. client nonblocking and client timeout appear
to work; client blocking appears to fail.
Bill
Re: Patch to fix sendfile on OS X
Posted by Geoff Greer <an...@mipsisrisc.com>.
Ugh, I actually broke apr_socket_sendfile on OS X when I cleaned up my
code for submission. Here is a patch for my patch.
Fixes are:
1. nbytes is initialized properly so if we only send the header we
don't lie and say we sent header bytes + file length.
- apr_off_t nbytes = *len;
+ apr_off_t nbytes = 0;
2. Vestigial code removed.
- else {
- header_bytes_written = 0;
- }
3. Bytes sent in the header are now counted.
- (*len) = nbytes;
+ (*len) = nbytes + header_bytes_written;
Patch attached, hopefully in text/plain.
Geoff
Re: Patch to fix sendfile on OS X
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Geoff Greer wrote:
>
> Now the sendfile test case passes on OS X. This is my first real patch, so
> suggestions are welcome.
If you can convince your browser to attach as text/* (patch|plain|whatever)
this would be much easier for multiple people to review. base64 isn't
legible to most of us ;-)
Committed, thanks!