On Wed, Nov 02, 2005 at 11:21:18AM +0000, Joe Orton wrote:
> On Wed, Nov 02, 2005 at 10:44:02AM +0000, Colm MacCarthaigh wrote:
> > On Wed, Nov 02, 2005 at 10:33:50AM +0000, Joe Orton wrote:
> > > This sounds very confused. On 64-bit platforms there are never any
> > > magic CFLAGS needed, no sendfile64() needed, and should be no problems
> > > handling >2Gb files in the first place.
> >
> > Doesn't seem to be that way on IA64, my sys/sendfile.h has:
>
> off_t is 64-bit on IA64, the LFS stuff is probably just there for -m32
> builds or compatibility. I just tested a 3Gb download with 2.1.9 on my
> x86_64 box and it worked fine. (as it should with 2.0.x also; nothing
> really has changed on this front in 2.1.x for 64-bit builds)
I think you're right, and I think I've found the source of the problem:
apr's network_io/unix/sendrecv.c has:
#if APR_HAS_LARGE_FILES && defined(HAVE_SENDFILE64)
apr_off_t off = *offset;
#define sendfile sendfile64
#elif APR_HAS_LARGE_FILES && SIZEOF_OFF_T == 4
/* 64-bit apr_off_t but no sendfile64(): fail if trying to send
* past the 2Gb limit. */
off_t off;
if ((apr_int64_t)*offset + *len > INT_MAX) {
return EINVAL;
}
and it's the latter branch that gets trigged on IA64, because
APR_HAS_LARGE_FILES is defined but HAVE_SENDFILE64 isn't. The trouble is
that INT_MAX is;
# define INT_MAX 2147483647
so, apr_socket_sendfile is returning EINVAL when it shouldn't be.
--
Colm MacCárthaigh Public Key: [EMAIL PROTECTED]