--- IO-AIO/README 2015/02/11 19:32:36 1.56 +++ IO-AIO/README 2016/01/18 11:53:09 1.57 @@ -92,7 +92,7 @@ print $contents; # exit event loop and program - EV::unloop; + EV::break; }; }; @@ -100,7 +100,7 @@ # check for sockets etc. etc. # process events as long as there are some: - EV::loop; + EV::run; REQUEST ANATOMY AND LIFETIME Every "aio_*" function creates a request. which is a C data structure @@ -332,7 +332,8 @@ "O_ASYNC", "O_DIRECT", "O_NOATIME", "O_CLOEXEC", "O_NOCTTY", "O_NOFOLLOW", "O_NONBLOCK", "O_EXEC", "O_SEARCH", "O_DIRECTORY", - "O_DSYNC", "O_RSYNC", "O_SYNC" and "O_TTY_INIT". + "O_DSYNC", "O_RSYNC", "O_SYNC", "O_PATH", "O_TMPFILE", and + "O_TTY_INIT". aio_close $fh, $callback->($status) Asynchronously close a file and call the callback with the result @@ -555,8 +556,9 @@ 0x0000f15f ecryptfs 0x00414a53 efs 0x0000137d ext - 0x0000ef53 ext2/ext3 + 0x0000ef53 ext2/ext3/ext4 0x0000ef51 ext2 + 0xf2f52010 f2fs 0x00004006 fat 0x65735546 fuseblk 0x65735543 fusectl @@ -565,6 +567,7 @@ 0x47504653 gpfs 0x00004244 hfs 0xf995e849 hpfs + 0x00c0ffee hostfs 0x958458f6 hugetlbfs 0x2bad1dea inotifyfs 0x00009660 isofs @@ -589,6 +592,7 @@ 0x00009fa0 proc 0x6165676c pstorefs 0x0000002f qnx4 + 0x68191122 qnx6 0x858458f6 ramfs 0x52654973 reiserfs 0x00007275 romfs @@ -648,10 +652,14 @@ Allocates or frees disk space according to the $mode argument. See the linux "fallocate" documentation for details. - $mode can currently be 0 or "IO::AIO::FALLOC_FL_KEEP_SIZE" to - allocate space, or "IO::AIO::FALLOC_FL_PUNCH_HOLE | + $mode is usually 0 or "IO::AIO::FALLOC_FL_KEEP_SIZE" to allocate + space, or "IO::AIO::FALLOC_FL_PUNCH_HOLE | IO::AIO::FALLOC_FL_KEEP_SIZE", to deallocate a file range. + IO::AIO also supports "FALLOC_FL_COLLAPSE_RANGE", to remove a range + (without leaving a hole) and "FALLOC_FL_ZERO_RANGE", to zero a range + (see your fallocate(2) manpage). + The file system block size used by "fallocate" is presumably the "f_bsize" returned by "statvfs". @@ -1630,11 +1638,13 @@ $flags can be a combination of "IO::AIO::MAP_SHARED" or "IO::AIO::MAP_PRIVATE", or a number of system-specific flags (when - not available, the are defined as 0): "IO::AIO::MAP_ANONYMOUS" - (which is set to "MAP_ANON" if your system only provides this - constant), "IO::AIO::MAP_HUGETLB", "IO::AIO::MAP_LOCKED", - "IO::AIO::MAP_NORESERVE", "IO::AIO::MAP_POPULATE" or - "IO::AIO::MAP_NONBLOCK" + not available, the are 0): "IO::AIO::MAP_ANONYMOUS" (which is set to + "MAP_ANON" if your system only provides this constant), + "IO::AIO::MAP_HUGETLB", "IO::AIO::MAP_LOCKED", + "IO::AIO::MAP_NORESERVE", "IO::AIO::MAP_POPULATE", + "IO::AIO::MAP_NONBLOCK", "IO::AIO::MAP_FIXED", + "IO::AIO::MAP_GROWSDOWN", "IO::AIO::MAP_32BIT", + "IO::AIO::MAP_HUGETLB" or "IO::AIO::MAP_STACK". If $fh is "undef", then a file descriptor of -1 is passed. @@ -1691,6 +1701,26 @@ fails with -1/"ENOSYS" everywhere else. If anybody knows how to influence pipe buffer size on other systems, drop me a note. + ($rfh, $wfh) = IO::AIO::pipe2 [$flags] + This is a direct interface to the Linux pipe2(2) system call. If + $flags is missing or 0, then this should be the same as a call to + perl's built-in "pipe" function and create a new pipe, and works on + systems that lack the pipe2 syscall. On win32, this case invokes + "_pipe (..., 4096, O_BINARY)". + + If $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 $flags is non-zero, fails with "ENOSYS". + + Please refer to pipe2(2) for more info on the $flags, but at the + time of this writing, "IO::AIO::O_CLOEXEC", "IO::AIO::O_NONBLOCK" + and "IO::AIO::O_DIRECT" (Linux 3.4, for packet-based pipes) were + supported. + EVENT LOOP INTEGRATION It is recommended to use AnyEvent::AIO to integrate IO::AIO automatically into many event loops: