… | |
… | |
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. |
345 | |
360 | |
346 | aio_read $fh,$offset,$length, $data,$dataoffset, $callback->($retval) |
361 | aio_read $fh,$offset,$length, $data,$dataoffset, $callback->($retval) |
347 | aio_write $fh,$offset,$length, $data,$dataoffset, $callback->($retval) |
362 | aio_write $fh,$offset,$length, $data,$dataoffset, $callback->($retval) |
348 | Reads or writes $length bytes from or to the specified $fh and |
363 | Reads or writes $length bytes from or to the specified $fh and |
349 | $offset into the scalar given by $data and offset $dataoffset and |
364 | $offset into the scalar given by $data and offset $dataoffset and |
… | |
… | |
863 | Example: asynchronously lock all current and future pages into |
878 | Example: asynchronously lock all current and future pages into |
864 | memory. |
879 | memory. |
865 | |
880 | |
866 | aio_mlockall IO::AIO::MCL_FUTURE; |
881 | aio_mlockall IO::AIO::MCL_FUTURE; |
867 | |
882 | |
|
|
883 | aio_fiemap $fh, $start, $length, $flags, $count, $cb->(\@extents) |
|
|
884 | Queries the extents of the given file (by calling the Linux FIEMAP |
|
|
885 | ioctl, see <http://cvs.schmorp.de/IO-AIO/doc/fiemap.txt> for |
|
|
886 | details). If the "ioctl" is not available on your OS, then this |
|
|
887 | rquiest will fail with "ENOSYS". |
|
|
888 | |
|
|
889 | $start is the starting offset to query extents for, $length is the |
|
|
890 | size of the range to query - if it is "undef", then the whole file |
|
|
891 | will be queried. |
|
|
892 | |
|
|
893 | $flags is a combination of flags ("IO::AIO::FIEMAP_FLAG_SYNC" or |
|
|
894 | "IO::AIO::FIEMAP_FLAG_XATTR" - "IO::AIO::FIEMAP_FLAGS_COMPAT" is |
|
|
895 | also exported), and is normally 0 or "IO::AIO::FIEMAP_FLAG_SYNC" to |
|
|
896 | query the data portion. |
|
|
897 | |
|
|
898 | $count is the maximum number of extent records to return. If it is |
|
|
899 | "undef", then IO::AIO queries all extents of the file. As a very |
|
|
900 | special case, if it is 0, then the callback receives the number of |
|
|
901 | extents instead of the extents themselves. |
|
|
902 | |
|
|
903 | If an error occurs, the callback receives no arguments. The special |
|
|
904 | "errno" value "IO::AIO::EBADR" is available to test for flag errors. |
|
|
905 | |
|
|
906 | Otherwise, the callback receives an array reference with extent |
|
|
907 | structures. Each extent structure is an array reference itself, with |
|
|
908 | the following members: |
|
|
909 | |
|
|
910 | [$logical, $physical, $length, $flags] |
|
|
911 | |
|
|
912 | Flags is any combination of the following flag values (typically |
|
|
913 | either 0 or "IO::AIO::FIEMAP_EXTENT_LAST"): |
|
|
914 | |
|
|
915 | "IO::AIO::FIEMAP_EXTENT_LAST", "IO::AIO::FIEMAP_EXTENT_UNKNOWN", |
|
|
916 | "IO::AIO::FIEMAP_EXTENT_DELALLOC", "IO::AIO::FIEMAP_EXTENT_ENCODED", |
|
|
917 | "IO::AIO::FIEMAP_EXTENT_DATA_ENCRYPTED", |
|
|
918 | "IO::AIO::FIEMAP_EXTENT_NOT_ALIGNED", |
|
|
919 | "IO::AIO::FIEMAP_EXTENT_DATA_INLINE", |
|
|
920 | "IO::AIO::FIEMAP_EXTENT_DATA_TAIL", |
|
|
921 | "IO::AIO::FIEMAP_EXTENT_UNWRITTEN", "IO::AIO::FIEMAP_EXTENT_MERGED" |
|
|
922 | or "IO::AIO::FIEMAP_EXTENT_SHARED". |
|
|
923 | |
868 | aio_group $callback->(...) |
924 | aio_group $callback->(...) |
869 | This is a very special aio request: Instead of doing something, it |
925 | 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 |
926 | 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 |
927 | to bundle many requests into a single, composite, request with a |
872 | definite callback and the ability to cancel the whole request with |
928 | definite callback and the ability to cancel the whole request with |