--- IO-AIO/README 2005/08/20 00:32:42 1.11 +++ IO-AIO/README 2005/08/23 00:05:00 1.12 @@ -132,6 +132,28 @@ print "read $_[0] bytes: <$buffer>\n"; }; + aio_sendfile $out_fh, $in_fh, $in_offset, $length, $callback + Tries to copy $length bytes from $in_fh to $out_fh. It starts + reading at byte offset $in_offset, and starts writing at the current + file offset of $out_fh. Because of that, it is not safe to issue + more than one "aio_sendfile" per $out_fh, as they will interfere + with each other. + + This call tries to make use of a native "sendfile" syscall to + provide zero-copy operation. For this to work, $out_fh should refer + to a socket, and $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 "aio_sendfile" on any type of filehandle + regardless of the limitations of the operating system. + + Please note, however, that "aio_sendfile" can read more bytes from + $in_fh than are written, and there is no way to find out how many + bytes have been read from "aio_sendfile" alone, as "aio_sendfile" + only provides the number of bytes written to $out_fh. Only if the + result value equals $length one can assume that $length bytes have + been read. + aio_readahead $fh,$offset,$length, $callback "aio_readahead" populates the page cache with data from a file so that subsequent reads from that file will not block on disk I/O. The