--- IO-AIO/AIO.pm 2014/01/24 23:46:16 1.244 +++ IO-AIO/AIO.pm 2015/06/25 13:34:28 1.253 @@ -169,7 +169,7 @@ use base 'Exporter'; BEGIN { - our $VERSION = '4.19'; + our $VERSION = 4.32; our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx @@ -229,7 +229,7 @@ aio_link $srcpath, $dstpath, $callback->($status) aio_symlink $srcpath, $dstpath, $callback->($status) aio_readlink $pathname, $callback->($link) - aio_realpath $pathname, $callback->($link) + aio_realpath $pathname, $callback->($path) aio_rename $srcpath, $dstpath, $callback->($status) aio_mkdir $pathname, $mode, $callback->($status) aio_rmdir $pathname, $callback->($status) @@ -724,12 +724,16 @@ =item aio_allocate $fh, $mode, $offset, $len, $callback->($status) -Allocates or freed disk space according to the C<$mode> argument. See the -linux C docuemntation for details. +Allocates or frees disk space according to the C<$mode> argument. See the +linux C documentation for details. -C<$mode> can currently be C<0> or C -to allocate space, or C, to deallocate a file range. +C<$mode> is usually C<0> or C to allocate +space, or C, +to deallocate a file range. + +IO::AIO also supports C, to remove a range +(without leaving a hole) and C, to zero a range (see +your L manpage). The file system block size used by C is presumably the C returned by C. @@ -1502,9 +1506,9 @@ }; }; -That C is a request and not a normal function shows that creating -an IO::AIO::WD object is itself a potentially blocking operation, which is -why it is done asynchronously. +The fact that C is a request and not a normal function shows that +creating an IO::AIO::WD object is itself a potentially blocking operation, +which is why it is done asynchronously. To stat the directory obtained with C above, one could write either of the following three request calls: @@ -1557,9 +1561,6 @@ C callback, as future requests using the value will fail in the expected way. -If this call isn't available because your OS lacks it or it couldn't be -detected, it will be emulated by calling C instead. - =item IO::AIO::CWD This is a compiletime constant (object) that represents the process @@ -1936,7 +1937,7 @@ blocks, and a bad way to reduce concurrency because it is inexact: Better use an C together with a feed callback. -It's main use is in scripts without an event loop - when you want to stat +Its main use is in scripts without an event loop - when you want to stat a lot of files, you can write somehting like this: IO::AIO::max_outstanding 32; @@ -1986,8 +1987,10 @@ =head3 MISCELLANEOUS FUNCTIONS -IO::AIO implements some functions that might be useful, but are not -asynchronous. +IO::AIO implements some functions that are useful when you want to use +some "Advanced I/O" function not available to in Perl, without going the +"Asynchronous I/O" route. Many of these have an asynchronous C +counterpart. =over 4 @@ -2115,7 +2118,7 @@ =item IO::AIO::tee $r_fh, $w_fh, $length, $flags -Calls the GNU/Linux C syscall, see it's manpage and the +Calls the GNU/Linux C syscall, see its manpage and the description for C above for details. =item $actual_size = IO::AIO::pipesize $r_fh[, $new_size] @@ -2125,6 +2128,25 @@ C<-1>/C everywhere else. If anybody knows how to influence pipe buffer size on other systems, drop me a note. +=item ($rfh, $wfh) = IO::AIO::pipe2 [$flags] + +This is a direct interface to the Linux L system call. If +C<$flags> is missing or C<0>, then this should be the same as a call to +perl's built-in C function and create a new pipe, and should work +everywhere. + +If C<$flags> is non-zero, it tries to invoke the pipe2 system call with +the given flags (Linux 2.6.27, glibc 2.9). + +On success, the read and write file handles are returned. + +On error, nothing will be returned. If the pipe2 syscall is missing and +C<$flags> is non-zero, fails with C. + +Please refer to L for more info on the C<$flags>, but at the +time of this writing, C, C and +C (Linux 3.4, for packet-based pipes) were supported. + =back =cut