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.212 by root, Thu Sep 29 22:42:15 2011 UTC vs.
Revision 1.215 by root, Tue Oct 4 18:22:37 2011 UTC

233 aio_rmdir $pathname, $callback->($status) 233 aio_rmdir $pathname, $callback->($status)
234 aio_readdir $pathname, $callback->($entries) 234 aio_readdir $pathname, $callback->($entries)
235 aio_readdirx $pathname, $flags, $callback->($entries, $flags) 235 aio_readdirx $pathname, $flags, $callback->($entries, $flags)
236 IO::AIO::READDIR_DENTS IO::AIO::READDIR_DIRS_FIRST 236 IO::AIO::READDIR_DENTS IO::AIO::READDIR_DIRS_FIRST
237 IO::AIO::READDIR_STAT_ORDER IO::AIO::READDIR_FOUND_UNKNOWN 237 IO::AIO::READDIR_STAT_ORDER IO::AIO::READDIR_FOUND_UNKNOWN
238 aio_scandir $pathname, $maxreq, $callback->($dirs, $nondirs)
238 aio_load $pathname, $data, $callback->($status) 239 aio_load $pathname, $data, $callback->($status)
239 aio_copy $srcpath, $dstpath, $callback->($status) 240 aio_copy $srcpath, $dstpath, $callback->($status)
240 aio_move $srcpath, $dstpath, $callback->($status) 241 aio_move $srcpath, $dstpath, $callback->($status)
241 aio_scandir $pathname, $maxreq, $callback->($dirs, $nondirs)
242 aio_rmtree $pathname, $callback->($status) 242 aio_rmtree $pathname, $callback->($status)
243 aio_sync $callback->($status) 243 aio_sync $callback->($status)
244 aio_syncfs $fh, $callback->($status) 244 aio_syncfs $fh, $callback->($status)
245 aio_fsync $fh, $callback->($status) 245 aio_fsync $fh, $callback->($status)
246 aio_fdatasync $fh, $callback->($status) 246 aio_fdatasync $fh, $callback->($status)
1304object. This object stores the canonicalised, absolute version of the 1304object. This object stores the canonicalised, absolute version of the
1305path, and on systems that allow it, also a directory file descriptor. 1305path, and on systems that allow it, also a directory file descriptor.
1306 1306
1307Everywhere where a pathname is accepted by IO::AIO (e.g. in C<aio_stat> 1307Everywhere where a pathname is accepted by IO::AIO (e.g. in C<aio_stat>
1308or C<aio_unlink>), one can specify an array reference with an IO::AIO::WD 1308or C<aio_unlink>), one can specify an array reference with an IO::AIO::WD
1309object and a pathname instead. If the pathname is absolute, the 1309object and a pathname instead (or the IO::AIO::WD object alone, which
1310gets interpreted as C<[$wd, "."]>). If the pathname is absolute, the
1310IO::AIO::WD objetc is ignored, otherwise the pathname is resolved relative 1311IO::AIO::WD object is ignored, otherwise the pathname is resolved relative
1311to that IO::AIO::WD object. 1312to that IO::AIO::WD object.
1312 1313
1313For example, to get a wd object for F</etc> and then stat F<passwd> 1314For example, to get a wd object for F</etc> and then stat F<passwd>
1314inside, you would write: 1315inside, you would write:
1315 1316
1323 aio_stat [$etcdir, "passwd"], sub { 1324 aio_stat [$etcdir, "passwd"], sub {
1324 # yay 1325 # yay
1325 }; 1326 };
1326 }; 1327 };
1327 1328
1328This shows that creating an IO::AIO::WD object is itself a potentially 1329That C<aio_wd> is a request and not a normal function shows that creating
1329blocking operation, which is why it is done asynchronously. 1330an IO::AIO::WD object is itself a potentially blocking operation, which is
1331why it is done asynchronously.
1332
1333To stat the directory obtained with C<aio_wd> above, one could write
1334either of the following three request calls:
1335
1336 aio_lstat "/etc" , sub { ... # pathname as normal string
1337 aio_lstat [$wd, "."], sub { ... # "." relative to $wd (i.e. $wd itself)
1338 aio_lstat $wd , sub { ... # shorthand for the previous
1330 1339
1331As with normal pathnames, IO::AIO keeps a copy of the working directory 1340As with normal pathnames, IO::AIO keeps a copy of the working directory
1332object and the pathname string, so you could write the following without 1341object and the pathname string, so you could write the following without
1333causing any issues due to C<$path> getting reused: 1342causing any issues due to C<$path> getting reused:
1334 1343

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines