… | |
… | |
63 | use base 'Exporter'; |
63 | use base 'Exporter'; |
64 | |
64 | |
65 | use Fcntl (); |
65 | use Fcntl (); |
66 | |
66 | |
67 | BEGIN { |
67 | BEGIN { |
68 | $VERSION = 1.5; |
68 | $VERSION = 1.6; |
69 | |
69 | |
70 | @EXPORT = qw(aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink |
70 | @EXPORT = qw(aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink |
71 | aio_rmdir aio_symlink aio_fsync aio_fdatasync aio_readahead); |
71 | aio_rmdir aio_symlink aio_fsync aio_fdatasync aio_readahead); |
72 | @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel max_outstanding nreqs); |
72 | @EXPORT_OK = qw(poll_fileno poll_cb min_parallel max_parallel max_outstanding nreqs); |
73 | |
73 | |
… | |
… | |
175 | This call tries to make use of a native C<sendfile> syscall to provide |
175 | This call tries to make use of a native C<sendfile> syscall to provide |
176 | zero-copy operation. For this to work, C<$out_fh> should refer to a |
176 | zero-copy operation. For this to work, C<$out_fh> should refer to a |
177 | socket, and C<$in_fh> should refer to mmap'able file. |
177 | socket, and C<$in_fh> should refer to mmap'able file. |
178 | |
178 | |
179 | If the native sendfile call fails or is not implemented, it will be |
179 | If the native sendfile call fails or is not implemented, it will be |
180 | emulated, so you can call C<aio_sendfile> on any filehandles regardless of |
180 | emulated, so you can call C<aio_sendfile> on any type of filehandle |
181 | the limitations of the OS. |
181 | regardless of the limitations of the operating system. |
182 | |
182 | |
183 | Please note, however, that C<aio_sendfile> can read more bytes from |
183 | Please note, however, that C<aio_sendfile> can read more bytes from |
184 | C<$in_fh> than are written, and there is no way to find out how many |
184 | C<$in_fh> than are written, and there is no way to find out how many |
185 | bytes have been read form C<aio_sendfile> alone, as C<aio_sendfile> only |
185 | bytes have been read from C<aio_sendfile> alone, as C<aio_sendfile> only |
186 | provides the number of bytes written to C<$out_fh>. Only if the return |
186 | provides the number of bytes written to C<$out_fh>. Only if the result |
187 | value (the value provided to the callback) equals C<$length> one can |
187 | value equals C<$length> one can assume that C<$length> bytes have been |
188 | assume that C<$length> bytes have been read. |
188 | read. |
189 | |
189 | |
190 | =item aio_readahead $fh,$offset,$length, $callback |
190 | =item aio_readahead $fh,$offset,$length, $callback |
191 | |
191 | |
192 | C<aio_readahead> populates the page cache with data from a file so that |
192 | C<aio_readahead> populates the page cache with data from a file so that |
193 | subsequent reads from that file will not block on disk I/O. The C<$offset> |
193 | subsequent reads from that file will not block on disk I/O. The C<$offset> |