[erlang-patches] [PATCH] erts: fix error logic in efile_sendfile

Michael Santos michael.santos@REDACTED
Wed Dec 7 14:54:45 CET 2011


On Wed, Dec 07, 2011 at 10:45:56AM +0800, Jovi Zhang wrote:

> I'm not sure, I don't familiar with DARWIN and freebsd system, it's
> possible that len will be assign
> to 0 when sendfile return other error code(like bad file EBDF), so
> driver will not go into a loop.

You're right! I did not read the man page closely enough. The man page is
not clear if sent bytes will be 0 on error but a small test program
shows that is the behaviour.

> I don't know what's meaning about sendfile EAGAIN/EINTR in DARWIN and
> freebsd system, by
> mostly I agree with you comments, it's not reasonable move to next
> trunk if sendfile return EAGAIN.

EAGAIN/EINTR has a special meaning for sendfile on FreeBSD/Mac OS X. A
return value of 0 can mean EOF, EINTR (sendfile() may not return -1 in
this case) [Mac OS X] or requested offset is beyond EOF. EAGAIN can mean
either socket not ready or the requested number of bytes was not sent.

tl;dr the code is correct

> But it seems that non-blocking io and header/tailer work is just preliminary,
> so there might have more work and patch on that part.
> 
> See below new patch, Thanks for you comments!

Looks fine, thanks!



More information about the erlang-patches mailing list