… | |
… | |
167 | use common::sense; |
167 | use common::sense; |
168 | |
168 | |
169 | use base 'Exporter'; |
169 | use base 'Exporter'; |
170 | |
170 | |
171 | BEGIN { |
171 | BEGIN { |
172 | our $VERSION = 4.2; |
172 | our $VERSION = 4.31; |
173 | |
173 | |
174 | our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close |
174 | our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close |
175 | aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx |
175 | aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx |
176 | aio_scandir aio_symlink aio_readlink aio_realpath aio_sync |
176 | aio_scandir aio_symlink aio_readlink aio_realpath aio_sync |
177 | aio_fsync aio_syncfs aio_fdatasync aio_sync_file_range aio_allocate |
177 | aio_fsync aio_syncfs aio_fdatasync aio_sync_file_range aio_allocate |
… | |
… | |
227 | aio_unlink $pathname, $callback->($status) |
227 | aio_unlink $pathname, $callback->($status) |
228 | aio_mknod $pathname, $mode, $dev, $callback->($status) |
228 | aio_mknod $pathname, $mode, $dev, $callback->($status) |
229 | aio_link $srcpath, $dstpath, $callback->($status) |
229 | aio_link $srcpath, $dstpath, $callback->($status) |
230 | aio_symlink $srcpath, $dstpath, $callback->($status) |
230 | aio_symlink $srcpath, $dstpath, $callback->($status) |
231 | aio_readlink $pathname, $callback->($link) |
231 | aio_readlink $pathname, $callback->($link) |
232 | aio_realpath $pathname, $callback->($link) |
232 | aio_realpath $pathname, $callback->($path) |
233 | aio_rename $srcpath, $dstpath, $callback->($status) |
233 | aio_rename $srcpath, $dstpath, $callback->($status) |
234 | aio_mkdir $pathname, $mode, $callback->($status) |
234 | aio_mkdir $pathname, $mode, $callback->($status) |
235 | aio_rmdir $pathname, $callback->($status) |
235 | aio_rmdir $pathname, $callback->($status) |
236 | aio_readdir $pathname, $callback->($entries) |
236 | aio_readdir $pathname, $callback->($entries) |
237 | aio_readdirx $pathname, $flags, $callback->($entries, $flags) |
237 | aio_readdirx $pathname, $flags, $callback->($entries, $flags) |
… | |
… | |
722 | Works like truncate(2) or ftruncate(2). |
722 | Works like truncate(2) or ftruncate(2). |
723 | |
723 | |
724 | |
724 | |
725 | =item aio_allocate $fh, $mode, $offset, $len, $callback->($status) |
725 | =item aio_allocate $fh, $mode, $offset, $len, $callback->($status) |
726 | |
726 | |
727 | Allocates or freed disk space according to the C<$mode> argument. See the |
727 | Allocates or frees disk space according to the C<$mode> argument. See the |
728 | linux C<fallocate> docuemntation for details. |
728 | linux C<fallocate> documentation for details. |
729 | |
729 | |
730 | C<$mode> can currently be C<0> or C<IO::AIO::FALLOC_FL_KEEP_SIZE> |
730 | C<$mode> can currently be C<0> or C<IO::AIO::FALLOC_FL_KEEP_SIZE> |
731 | to allocate space, or C<IO::AIO::FALLOC_FL_PUNCH_HOLE | |
731 | to allocate space, or C<IO::AIO::FALLOC_FL_PUNCH_HOLE | |
732 | IO::AIO::FALLOC_FL_KEEP_SIZE>, to deallocate a file range. |
732 | IO::AIO::FALLOC_FL_KEEP_SIZE>, to deallocate a file range. |
733 | |
733 | |
… | |
… | |
1931 | |
1931 | |
1932 | This is a very bad function to use in interactive programs because it |
1932 | This is a very bad function to use in interactive programs because it |
1933 | blocks, and a bad way to reduce concurrency because it is inexact: Better |
1933 | blocks, and a bad way to reduce concurrency because it is inexact: Better |
1934 | use an C<aio_group> together with a feed callback. |
1934 | use an C<aio_group> together with a feed callback. |
1935 | |
1935 | |
1936 | It's main use is in scripts without an event loop - when you want to stat |
1936 | Its main use is in scripts without an event loop - when you want to stat |
1937 | a lot of files, you can write somehting like this: |
1937 | a lot of files, you can write somehting like this: |
1938 | |
1938 | |
1939 | IO::AIO::max_outstanding 32; |
1939 | IO::AIO::max_outstanding 32; |
1940 | |
1940 | |
1941 | for my $path (...) { |
1941 | for my $path (...) { |
… | |
… | |
1981 | |
1981 | |
1982 | =back |
1982 | =back |
1983 | |
1983 | |
1984 | =head3 MISCELLANEOUS FUNCTIONS |
1984 | =head3 MISCELLANEOUS FUNCTIONS |
1985 | |
1985 | |
1986 | IO::AIO implements some functions that might be useful, but are not |
1986 | IO::AIO implements some functions that are useful when you want to use |
1987 | asynchronous. |
1987 | some "Advanced I/O" function not available to in Perl, without going the |
|
|
1988 | "Asynchronous I/O" route. Many of these have an asynchronous C<aio_*> |
|
|
1989 | counterpart. |
1988 | |
1990 | |
1989 | =over 4 |
1991 | =over 4 |
1990 | |
1992 | |
1991 | =item IO::AIO::sendfile $ofh, $ifh, $offset, $count |
1993 | =item IO::AIO::sendfile $ofh, $ifh, $offset, $count |
1992 | |
1994 | |
… | |
… | |
2110 | |
2112 | |
2111 | See the C<splice(2)> manpage for details. |
2113 | See the C<splice(2)> manpage for details. |
2112 | |
2114 | |
2113 | =item IO::AIO::tee $r_fh, $w_fh, $length, $flags |
2115 | =item IO::AIO::tee $r_fh, $w_fh, $length, $flags |
2114 | |
2116 | |
2115 | Calls the GNU/Linux C<tee(2)> syscall, see it's manpage and the |
2117 | Calls the GNU/Linux C<tee(2)> syscall, see its manpage and the |
2116 | description for C<IO::AIO::splice> above for details. |
2118 | description for C<IO::AIO::splice> above for details. |
2117 | |
2119 | |
2118 | =item $actual_size = IO::AIO::pipesize $r_fh[, $new_size] |
2120 | =item $actual_size = IO::AIO::pipesize $r_fh[, $new_size] |
2119 | |
2121 | |
2120 | Attempts to query or change the pipe buffer size. Obviously works only |
2122 | Attempts to query or change the pipe buffer size. Obviously works only |