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

Comparing IO-AIO/README (file contents):
Revision 1.50 by root, Sun Oct 9 08:24:49 2011 UTC vs.
Revision 1.52 by root, Tue Apr 10 05:01:33 2012 UTC

153 documentation. 153 documentation.
154 154
155 aio_wd $pathname, $callback->($wd) 155 aio_wd $pathname, $callback->($wd)
156 aio_open $pathname, $flags, $mode, $callback->($fh) 156 aio_open $pathname, $flags, $mode, $callback->($fh)
157 aio_close $fh, $callback->($status) 157 aio_close $fh, $callback->($status)
158 aio_seek $fh,$offset,$whence, $callback->($offs)
158 aio_read $fh,$offset,$length, $data,$dataoffset, $callback->($retval) 159 aio_read $fh,$offset,$length, $data,$dataoffset, $callback->($retval)
159 aio_write $fh,$offset,$length, $data,$dataoffset, $callback->($retval) 160 aio_write $fh,$offset,$length, $data,$dataoffset, $callback->($retval)
160 aio_sendfile $out_fh, $in_fh, $in_offset, $length, $callback->($retval) 161 aio_sendfile $out_fh, $in_fh, $in_offset, $length, $callback->($retval)
161 aio_readahead $fh,$offset,$length, $callback->($retval) 162 aio_readahead $fh,$offset,$length, $callback->($retval)
162 aio_stat $fh_or_path, $callback->($status) 163 aio_stat $fh_or_path, $callback->($status)
163 aio_lstat $fh, $callback->($status) 164 aio_lstat $fh, $callback->($status)
164 aio_statvfs $fh_or_path, $callback->($statvfs) 165 aio_statvfs $fh_or_path, $callback->($statvfs)
165 aio_utime $fh_or_path, $atime, $mtime, $callback->($status) 166 aio_utime $fh_or_path, $atime, $mtime, $callback->($status)
166 aio_chown $fh_or_path, $uid, $gid, $callback->($status) 167 aio_chown $fh_or_path, $uid, $gid, $callback->($status)
168 aio_chmod $fh_or_path, $mode, $callback->($status)
167 aio_truncate $fh_or_path, $offset, $callback->($status) 169 aio_truncate $fh_or_path, $offset, $callback->($status)
168 aio_chmod $fh_or_path, $mode, $callback->($status)
169 aio_unlink $pathname, $callback->($status) 170 aio_unlink $pathname, $callback->($status)
170 aio_mknod $pathname, $mode, $dev, $callback->($status) 171 aio_mknod $pathname, $mode, $dev, $callback->($status)
171 aio_link $srcpath, $dstpath, $callback->($status) 172 aio_link $srcpath, $dstpath, $callback->($status)
172 aio_symlink $srcpath, $dstpath, $callback->($status) 173 aio_symlink $srcpath, $dstpath, $callback->($status)
173 aio_readlink $pathname, $callback->($link) 174 aio_readlink $pathname, $callback->($link)
220 IO::AIO::madvise $scalar, $offset, $length, $advice 221 IO::AIO::madvise $scalar, $offset, $length, $advice
221 IO::AIO::mprotect $scalar, $offset, $length, $protect 222 IO::AIO::mprotect $scalar, $offset, $length, $protect
222 IO::AIO::munlock $scalar, $offset = 0, $length = undef 223 IO::AIO::munlock $scalar, $offset = 0, $length = undef
223 IO::AIO::munlockall 224 IO::AIO::munlockall
224 225
225 AIO REQUEST FUNCTIONS 226 API NOTES
226 All the "aio_*" calls are more or less thin wrappers around the syscall 227 All the "aio_*" calls are more or less thin wrappers around the syscall
227 with the same name (sans "aio_"). The arguments are similar or 228 with the same name (sans "aio_"). The arguments are similar or
228 identical, and they all accept an additional (and optional) $callback 229 identical, and they all accept an additional (and optional) $callback
229 argument which must be a code reference. This code reference will be 230 argument which must be a code reference. This code reference will be
230 called after the syscall has been executed in an asynchronous fashion. 231 called after the syscall has been executed in an asynchronous fashion.
260 else to ensure your scalar has the correct contents. 261 else to ensure your scalar has the correct contents.
261 262
262 This works, btw. independent of the internal UTF-8 bit, which IO::AIO 263 This works, btw. independent of the internal UTF-8 bit, which IO::AIO
263 handles correctly whether it is set or not. 264 handles correctly whether it is set or not.
264 265
266 AIO REQUEST FUNCTIONS
265 $prev_pri = aioreq_pri [$pri] 267 $prev_pri = aioreq_pri [$pri]
266 Returns the priority value that would be used for the next request 268 Returns the priority value that would be used for the next request
267 and, if $pri is given, sets the priority for the next aio request. 269 and, if $pri is given, sets the priority for the next aio request.
268 270
269 The default priority is 0, the minimum and maximum priorities are -4 271 The default priority is 0, the minimum and maximum priorities are -4
340 will use dup2 to overwrite the file descriptor with the write-end of 342 will use dup2 to overwrite the file descriptor with the write-end of
341 a pipe (the pipe fd will be created on demand and will be cached). 343 a pipe (the pipe fd will be created on demand and will be cached).
342 344
343 Or in other words: the file descriptor will be closed, but it will 345 Or in other words: the file descriptor will be closed, but it will
344 not be free for reuse until the perl filehandle is closed. 346 not be free for reuse until the perl filehandle is closed.
347
348 aio_seek $fh, $offset, $whence, $callback->($offs)
349 Seeks the filehandle to the new $offset, similarly to perl's
350 "sysseek". The $whence can use the traditional values (0 for
351 "IO::AIO::SEEK_SET", 1 for "IO::AIO::SEEK_CUR" or 2 for
352 "IO::AIO::SEEK_END").
353
354 The resulting absolute offset will be passed to the callback, or -1
355 in case of an error.
356
357 In theory, the $whence constants could be different than the
358 corresponding values from Fcntl, but perl guarantees they are the
359 same, so don't panic.
360
361 As a GNU/Linux (and maybe Solaris) extension, also the constants
362 "IO::AIO::SEEK_DATA" and "IO::AIO::SEEK_HOLE" are available, if they
363 could be found. No guarantees about suitability for use in
364 "aio_seek" or Perl's "sysseek" can be made though, although I would
365 naively assume they "just work".
345 366
346 aio_read $fh,$offset,$length, $data,$dataoffset, $callback->($retval) 367 aio_read $fh,$offset,$length, $data,$dataoffset, $callback->($retval)
347 aio_write $fh,$offset,$length, $data,$dataoffset, $callback->($retval) 368 aio_write $fh,$offset,$length, $data,$dataoffset, $callback->($retval)
348 Reads or writes $length bytes from or to the specified $fh and 369 Reads or writes $length bytes from or to the specified $fh and
349 $offset into the scalar given by $data and offset $dataoffset and 370 $offset into the scalar given by $data and offset $dataoffset and
863 Example: asynchronously lock all current and future pages into 884 Example: asynchronously lock all current and future pages into
864 memory. 885 memory.
865 886
866 aio_mlockall IO::AIO::MCL_FUTURE; 887 aio_mlockall IO::AIO::MCL_FUTURE;
867 888
889 aio_fiemap $fh, $start, $length, $flags, $count, $cb->(\@extents)
890 Queries the extents of the given file (by calling the Linux FIEMAP
891 ioctl, see <http://cvs.schmorp.de/IO-AIO/doc/fiemap.txt> for
892 details). If the "ioctl" is not available on your OS, then this
893 rquiest will fail with "ENOSYS".
894
895 $start is the starting offset to query extents for, $length is the
896 size of the range to query - if it is "undef", then the whole file
897 will be queried.
898
899 $flags is a combination of flags ("IO::AIO::FIEMAP_FLAG_SYNC" or
900 "IO::AIO::FIEMAP_FLAG_XATTR" - "IO::AIO::FIEMAP_FLAGS_COMPAT" is
901 also exported), and is normally 0 or "IO::AIO::FIEMAP_FLAG_SYNC" to
902 query the data portion.
903
904 $count is the maximum number of extent records to return. If it is
905 "undef", then IO::AIO queries all extents of the file. As a very
906 special case, if it is 0, then the callback receives the number of
907 extents instead of the extents themselves.
908
909 If an error occurs, the callback receives no arguments. The special
910 "errno" value "IO::AIO::EBADR" is available to test for flag errors.
911
912 Otherwise, the callback receives an array reference with extent
913 structures. Each extent structure is an array reference itself, with
914 the following members:
915
916 [$logical, $physical, $length, $flags]
917
918 Flags is any combination of the following flag values (typically
919 either 0 or "IO::AIO::FIEMAP_EXTENT_LAST"):
920
921 "IO::AIO::FIEMAP_EXTENT_LAST", "IO::AIO::FIEMAP_EXTENT_UNKNOWN",
922 "IO::AIO::FIEMAP_EXTENT_DELALLOC", "IO::AIO::FIEMAP_EXTENT_ENCODED",
923 "IO::AIO::FIEMAP_EXTENT_DATA_ENCRYPTED",
924 "IO::AIO::FIEMAP_EXTENT_NOT_ALIGNED",
925 "IO::AIO::FIEMAP_EXTENT_DATA_INLINE",
926 "IO::AIO::FIEMAP_EXTENT_DATA_TAIL",
927 "IO::AIO::FIEMAP_EXTENT_UNWRITTEN", "IO::AIO::FIEMAP_EXTENT_MERGED"
928 or "IO::AIO::FIEMAP_EXTENT_SHARED".
929
868 aio_group $callback->(...) 930 aio_group $callback->(...)
869 This is a very special aio request: Instead of doing something, it 931 This is a very special aio request: Instead of doing something, it
870 is a container for other aio requests, which is useful if you want 932 is a container for other aio requests, which is useful if you want
871 to bundle many requests into a single, composite, request with a 933 to bundle many requests into a single, composite, request with a
872 definite callback and the ability to cancel the whole request with 934 definite callback and the ability to cancel the whole request with
1473 Calls the "munlockall" function. 1535 Calls the "munlockall" function.
1474 1536
1475 On systems that do not implement "munlockall", this function returns 1537 On systems that do not implement "munlockall", this function returns
1476 ENOSYS, otherwise the return value of "munlockall". 1538 ENOSYS, otherwise the return value of "munlockall".
1477 1539
1540 IO::AIO::splice $r_fh, $r_off, $w_fh, $w_off, $length, $flags
1541 Calls the GNU/Linux splice(2) syscall, if available. If $r_off or
1542 $w_off are "undef", then "NULL" is passed for these, otherwise they
1543 should be the file offset.
1544
1545 The following symbol flag values are available:
1546 "IO::AIO::SPLICE_F_MOVE", "IO::AIO::SPLICE_F_NONBLOCK",
1547 "IO::AIO::SPLICE_F_MORE" and "IO::AIO::SPLICE_F_GIFT".
1548
1549 See the splice(2) manpage for details.
1550
1551 IO::AIO::tee $r_fh, $w_fh, $length, $flags
1552 Calls the GNU/Linux tee(2) syscall, see it's manpage and the
1553 description for "IO::AIO::splice" above for details.
1554
1478EVENT LOOP INTEGRATION 1555EVENT LOOP INTEGRATION
1479 It is recommended to use AnyEvent::AIO to integrate IO::AIO 1556 It is recommended to use AnyEvent::AIO to integrate IO::AIO
1480 automatically into many event loops: 1557 automatically into many event loops:
1481 1558
1482 # AnyEvent integration (EV, Event, Glib, Tk, POE, urxvt, pureperl...) 1559 # AnyEvent integration (EV, Event, Glib, Tk, POE, urxvt, pureperl...)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines