> The problem was I was never able to get any consensus (mainly because
> no one cared) on what to do with Linux. Linux doesn't allow for
> largefiles to be sendfile'd. (I believe Solaris does.) Even turning
> on largefile support (via defining _FILE_OFFSET_BITS) causes the
> compilation to fail (sys/sendfile.h has a #error in this case, IIRC).
Looks like your information are a bit stale :-)
glibc-2.3 includes sendfile64 supported by default. It has
been available since Oct 2002. Distributors are already
shipping the new glibc, so it can be considered mainstream by
now.
Furthermore, even prior to glibc-2.3, according to David S.
Miller in [1].
"[sendfile64] is [an] old hat, and appears in every
current vendor kernel I am aware of and is in 2.5.x as
well."
Additionally, you can use sendfile even in older systems for
sending the first 2GB of a file. That should be sufficient
for the majority of cases. If sendfile fails (e.g. the fs
does not support it or you hit the 2GB barrier), you need to
fall back to alternative methods anyway (such as read/write).
[1] http://www.uwsg.iu.edu/hypermail/linux/kernel/0210.3/0062.html
- Sascha