ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/AIO.pm
(Generate patch)

Comparing IO-AIO/AIO.pm (file contents):
Revision 1.274 by root, Thu Sep 21 23:43:46 2017 UTC vs.
Revision 1.278 by root, Sun Oct 1 07:24:34 2017 UTC

277 IO::AIO::idle_timeout $seconds 277 IO::AIO::idle_timeout $seconds
278 IO::AIO::max_outstanding $maxreqs 278 IO::AIO::max_outstanding $maxreqs
279 IO::AIO::nreqs 279 IO::AIO::nreqs
280 IO::AIO::nready 280 IO::AIO::nready
281 IO::AIO::npending 281 IO::AIO::npending
282 $nfd = IO::AIO::get_fdlimit [EXPERIMENTAL]
283 IO::AIO::min_fdlimit $nfd [EXPERIMENTAL]
282 284
283 IO::AIO::sendfile $ofh, $ifh, $offset, $count 285 IO::AIO::sendfile $ofh, $ifh, $offset, $count
284 IO::AIO::fadvise $fh, $offset, $len, $advice 286 IO::AIO::fadvise $fh, $offset, $len, $advice
285 IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]] 287 IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]]
286 IO::AIO::munmap $scalar 288 IO::AIO::munmap $scalar
958 960
959Try to copy the I<file> (directories not supported as either source or 961Try to copy the I<file> (directories not supported as either source or
960destination) from C<$srcpath> to C<$dstpath> and call the callback with 962destination) from C<$srcpath> to C<$dstpath> and call the callback with
961a status of C<0> (ok) or C<-1> (error, see C<$!>). 963a status of C<0> (ok) or C<-1> (error, see C<$!>).
962 964
965Existing destination files will be truncated.
966
963This is a composite request that creates the destination file with 967This is a composite request that creates the destination file with
964mode 0200 and copies the contents of the source file into it using 968mode 0200 and copies the contents of the source file into it using
965C<aio_sendfile>, followed by restoring atime, mtime, access mode and 969C<aio_sendfile>, followed by restoring atime, mtime, access mode and
966uid/gid, in that order. 970uid/gid, in that order.
967 971
1076Scans a directory (similar to C<aio_readdir>) but additionally tries to 1080Scans a directory (similar to C<aio_readdir>) but additionally tries to
1077efficiently separate the entries of directory C<$path> into two sets of 1081efficiently separate the entries of directory C<$path> into two sets of
1078names, directories you can recurse into (directories), and ones you cannot 1082names, directories you can recurse into (directories), and ones you cannot
1079recurse into (everything else, including symlinks to directories). 1083recurse into (everything else, including symlinks to directories).
1080 1084
1081C<aio_scandir> is a composite request that creates of many sub requests_ 1085C<aio_scandir> is a composite request that generates many sub requests.
1082C<$maxreq> specifies the maximum number of outstanding aio requests that 1086C<$maxreq> specifies the maximum number of outstanding aio requests that
1083this function generates. If it is C<< <= 0 >>, then a suitable default 1087this function generates. If it is C<< <= 0 >>, then a suitable default
1084will be chosen (currently 4). 1088will be chosen (currently 4).
1085 1089
1086On error, the callback is called without arguments, otherwise it receives 1090On error, the callback is called without arguments, otherwise it receives
1479C<IO::AIO::FIEMAP_EXTENT_DATA_ENCRYPTED>, C<IO::AIO::FIEMAP_EXTENT_NOT_ALIGNED>, 1483C<IO::AIO::FIEMAP_EXTENT_DATA_ENCRYPTED>, C<IO::AIO::FIEMAP_EXTENT_NOT_ALIGNED>,
1480C<IO::AIO::FIEMAP_EXTENT_DATA_INLINE>, C<IO::AIO::FIEMAP_EXTENT_DATA_TAIL>, 1484C<IO::AIO::FIEMAP_EXTENT_DATA_INLINE>, C<IO::AIO::FIEMAP_EXTENT_DATA_TAIL>,
1481C<IO::AIO::FIEMAP_EXTENT_UNWRITTEN>, C<IO::AIO::FIEMAP_EXTENT_MERGED> or 1485C<IO::AIO::FIEMAP_EXTENT_UNWRITTEN>, C<IO::AIO::FIEMAP_EXTENT_MERGED> or
1482C<IO::AIO::FIEMAP_EXTENT_SHARED>. 1486C<IO::AIO::FIEMAP_EXTENT_SHARED>.
1483 1487
1484At the time of this writing (Linux 3.2), this requets is unreliable unless 1488At the time of this writing (Linux 3.2), this request is unreliable unless
1485C<$count> is C<undef>, as the kernel has all sorts of bugs preventing 1489C<$count> is C<undef>, as the kernel has all sorts of bugs preventing
1486it to return all extents of a range for files with large number of 1490it to return all extents of a range for files with a large number of
1487extents. The code works around all these issues if C<$count> is undef. 1491extents. The code (only) works around all these issues if C<$count> is
1492C<undef>.
1488 1493
1489=item aio_group $callback->(...) 1494=item aio_group $callback->(...)
1490 1495
1491This is a very special aio request: Instead of doing something, it is a 1496This is a very special aio request: Instead of doing something, it is a
1492container for other aio requests, which is useful if you want to bundle 1497container for other aio requests, which is useful if you want to bundle
1605There are some caveats: when directories get renamed (or deleted), the 1610There are some caveats: when directories get renamed (or deleted), the
1606pathname string doesn't change, so will point to the new directory (or 1611pathname string doesn't change, so will point to the new directory (or
1607nowhere at all), while the directory fd, if available on the system, 1612nowhere at all), while the directory fd, if available on the system,
1608will still point to the original directory. Most functions accepting a 1613will still point to the original directory. Most functions accepting a
1609pathname will use the directory fd on newer systems, and the string on 1614pathname will use the directory fd on newer systems, and the string on
1610older systems. Some functions (such as realpath) will always rely on the 1615older systems. Some functions (such as C<aio_realpath>) will always rely on
1611string form of the pathname. 1616the string form of the pathname.
1612 1617
1613So this functionality is mainly useful to get some protection against 1618So this functionality is mainly useful to get some protection against
1614C<chdir>, to easily get an absolute path out of a relative path for future 1619C<chdir>, to easily get an absolute path out of a relative path for future
1615reference, and to speed up doing many operations in the same directory 1620reference, and to speed up doing many operations in the same directory
1616(e.g. when stat'ing all files in a directory). 1621(e.g. when stat'ing all files in a directory).
2063some "Advanced I/O" function not available to in Perl, without going the 2068some "Advanced I/O" function not available to in Perl, without going the
2064"Asynchronous I/O" route. Many of these have an asynchronous C<aio_*> 2069"Asynchronous I/O" route. Many of these have an asynchronous C<aio_*>
2065counterpart. 2070counterpart.
2066 2071
2067=over 4 2072=over 4
2073
2074=item $numfd = IO::AIO::get_fdlimit
2075
2076This function is I<EXPERIMENTAL> and subject to change.
2077
2078Tries to find the current file descriptor limit and returns it, or
2079C<undef> and sets C<$!> in case of an error. The limit is one larger than
2080the highest valid file descriptor number.
2081
2082=item IO::AIO::min_fdlimit [$numfd]
2083
2084This function is I<EXPERIMENTAL> and subject to change.
2085
2086Try to increase the current file descriptor limit(s) to at least C<$numfd>
2087by changing the soft or hard file descriptor resource limit. If C<$numfd>
2088is missing, it will try to set a very high limit, although this is not
2089recommended when you know the actual minimum that you require.
2090
2091If the limit cannot be raised enough, the function makes a best-effort
2092attempt to increase the limit as much as possible, using various
2093tricks, while still failing. You can query the resulting limit using
2094C<IO::AIO::get_fdlimit>.
2095
2096If an error occurs, returns C<undef> and sets C<$!>, otherwise returns
2097true.
2068 2098
2069=item IO::AIO::sendfile $ofh, $ifh, $offset, $count 2099=item IO::AIO::sendfile $ofh, $ifh, $offset, $count
2070 2100
2071Calls the C<eio_sendfile_sync> function, which is like C<aio_sendfile>, 2101Calls the C<eio_sendfile_sync> function, which is like C<aio_sendfile>,
2072but is blocking (this makes most sense if you know the input data is 2102but is blocking (this makes most sense if you know the input data is

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines