That's fine.  Pay attention to what I suggested.  Default to
non-native sendfile, until we have know that it works.  If you have an
OS that you know for a fact does sendfile correctly, then that would
be a case where we know that it works.

Instead of

#ifndef LINUX|WIN32|AIX|HPUX
    sendfile(....)
#else
    fake_sendfile(....)
#endif

do:

#ifdef SomeOSThatWorks
    sendfile(.....)
#else
    fake_sendfile(....)
#endif

Since the beginning of APR, we thought that we knew how to get
sendfile working on most of our supported OS'.  That's why we included
sendfile support.  It turns out though, that for many of those
platforms, sendfile just doesn't work in some situations.  When we
have a platform without the bugs, then yes we should use sendfile, but
for all other cases I care infinately more about correctness than
speed.

Ryan


On Fri, 18 Mar 2005 08:23:18 -0800, Justin Erenkrantz
<[EMAIL PROTECTED]> wrote:
> --On Friday, March 18, 2005 11:12 AM -0500 Ryan Bloom <[EMAIL PROTECTED]> 
> wrote:
> 
> > funny, I took the list of exceptions to be so large and hard to
> > maintain that it made more sense to go with Jeff's original idea of
> > just disabling sendfile by default unless a user specifically decided
> > to enable it.  I just had to debug a problem for a friend with
> > sendfile on Linux.  I don't know what caused the problem, but
> > disabling sendfile solved it immediately.  Seems to me that until our
> > sendfile support is better, we should err on the side of always
> > sending the data correctly instead of absolutely as fast as possible.
> 
> I absolutely refuse to punish users who are using good OSes because some OSes
> are brain-dead.  This is exactly the role that APR is meant to fill: if we
> know of conditions where it is unsafe to use sendfile, we won't use it unless
> explicitly told so by the user.
> 
> The minimal check can be:
> 
> if (flags & APR_SENDFILE_CHECK) {
> #ifdef LINUX || WIN32 || AIX || HPUX
>     return APR_ENOTIMPL;
> #endif
> }
> 
> As people determine what conditions sendfile is safe (or causes problems),
> then we can add those.
> 
> Feel free to advocate Linux always returning APR_ENOTIMPL for sendfile - I
> don't care.  However, blocking sendfile on non-buggy OSes is not a solution
> that I am willing to sign off on.  -- justin
> 


-- 
Ryan Bloom
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

Reply via email to