--- IO-AIO/AIO.pm 2005/08/18 16:32:10 1.34 +++ IO-AIO/AIO.pm 2005/08/22 23:20:37 1.35 @@ -164,6 +164,29 @@ print "read $_[0] bytes: <$buffer>\n"; }; +=item aio_sendfile $out_fh, $in_fh, $in_offset, $length, $callback + +Tries to copy C<$length> bytes from C<$in_fh> to C<$out_fh>. It starts +reading at byte offset C<$in_offset>, and starts writing at the current +file offset of C<$out_fh>. Because of that, it is not safe to issue more +than one C per C<$out_fh>, as they will interfere with each +other. + +This call tries to make use of a native C syscall to provide +zero-copy operation. For this to work, C<$out_fh> should refer to a +socket, and C<$in_fh> should refer to mmap'able file. + +If the native sendfile call fails or is not implemented, it will be +emulated, so you can call C on any filehandles regardless of +the limitations of the OS. + +Please note, however, that C can read more bytes from +C<$in_fh> than are written, and there is no way to find out how many +bytes have been read form C alone, as C only +provides the number of bytes written to C<$out_fh>. Only if the return +value (the value provided to the callback) equals C<$length> one can +assume that C<$length> bytes have been read. + =item aio_readahead $fh,$offset,$length, $callback C populates the page cache with data from a file so that