dev  

Re: sendfile in darwin

Jim Jagielski
Fri, 09 May 2008 07:29:44 -0700

FWIW, the current impl of sendfile() in Darwin (as coded in xnu-1228.3.13
at least) internally uses writev() (but with real error checking :) ) to
send headers and footers, so breaking them out in APR really isn't
that bad :)

However:

        if (uap->nbytes != USER_ADDR_NULL) {
/* XXX this appears bogus for some early failure conditions */
                copyout(&sbytes, uap->nbytes, sizeof (off_t));
        }

and the early failures seem mostly due to the writev() usage,
so it actually looks like NOT using sendfile() to send header/footer
makes some sense and doing it as we are now is best. It also
seems like the impl I "just" added to trunk seems to be something
to consider for 1.3 anyway, since we would have error handling/checking
on par with Linux and better (IMO) that what we have with the other
flavors. I'm really tempted to push r654788 for apr-1.3 as well
as a template for the other 'use-writev()' impls...