… | |
… | |
64 | |
64 | |
65 | EXAMPLE |
65 | EXAMPLE |
66 | This is a simple example that uses the EV module and loads /etc/passwd |
66 | This is a simple example that uses the EV module and loads /etc/passwd |
67 | asynchronously: |
67 | asynchronously: |
68 | |
68 | |
69 | use Fcntl; |
|
|
70 | use EV; |
69 | use EV; |
71 | use IO::AIO; |
70 | use IO::AIO; |
72 | |
71 | |
73 | # register the IO::AIO callback with EV |
72 | # register the IO::AIO callback with EV |
74 | my $aio_w = EV::io IO::AIO::poll_fileno, EV::READ, \&IO::AIO::poll_cb; |
73 | my $aio_w = EV::io IO::AIO::poll_fileno, EV::READ, \&IO::AIO::poll_cb; |
… | |
… | |
530 | namemax => 255, |
529 | namemax => 255, |
531 | frsize => 1024, |
530 | frsize => 1024, |
532 | fsid => 1810 |
531 | fsid => 1810 |
533 | } |
532 | } |
534 | |
533 | |
535 | Here is a (likely partial) list of fsid values used by Linux - it is |
534 | Here is a (likely partial - send me updates!) list of fsid values |
536 | safe to hardcode these when the $^O is "linux": |
535 | used by Linux - it is safe to hardcode these when $^O is "linux": |
537 | |
536 | |
538 | 0x0000adf5 adfs |
537 | 0x0000adf5 adfs |
539 | 0x0000adff affs |
538 | 0x0000adff affs |
540 | 0x5346414f afs |
539 | 0x5346414f afs |
541 | 0x09041934 anon-inode filesystem |
540 | 0x09041934 anon-inode filesystem |
… | |
… | |
1181 | Since passing "undef" as working directory component of a pathname |
1180 | Since passing "undef" as working directory component of a pathname |
1182 | fails the request with "ENOENT", there is often no need for error |
1181 | fails the request with "ENOENT", there is often no need for error |
1183 | checking in the "aio_wd" callback, as future requests using the |
1182 | checking in the "aio_wd" callback, as future requests using the |
1184 | value will fail in the expected way. |
1183 | value will fail in the expected way. |
1185 | |
1184 | |
1186 | If this call isn't available because your OS lacks it or it couldn't |
|
|
1187 | be detected, it will be emulated by calling "fsync" instead. |
|
|
1188 | |
|
|
1189 | IO::AIO::CWD |
1185 | IO::AIO::CWD |
1190 | This is a compiletime constant (object) that represents the process |
1186 | This is a compiletime constant (object) that represents the process |
1191 | current working directory. |
1187 | current working directory. |
1192 | |
1188 | |
1193 | Specifying this object as working directory object for a pathname is |
1189 | Specifying this object as working directory object for a pathname is |
… | |
… | |
1685 | |
1681 | |
1686 | IO::AIO::tee $r_fh, $w_fh, $length, $flags |
1682 | IO::AIO::tee $r_fh, $w_fh, $length, $flags |
1687 | Calls the GNU/Linux tee(2) syscall, see it's manpage and the |
1683 | Calls the GNU/Linux tee(2) syscall, see it's manpage and the |
1688 | description for "IO::AIO::splice" above for details. |
1684 | description for "IO::AIO::splice" above for details. |
1689 | |
1685 | |
|
|
1686 | $actual_size = IO::AIO::pipesize $r_fh[, $new_size] |
|
|
1687 | Attempts to query or change the pipe buffer size. Obviously works |
|
|
1688 | only on pipes, and currently works only on GNU/Linux systems, and |
|
|
1689 | fails with -1/"ENOSYS" everywhere else. If anybody knows how to |
|
|
1690 | influence pipe buffer size on other systems, drop me a note. |
|
|
1691 | |
1690 | EVENT LOOP INTEGRATION |
1692 | EVENT LOOP INTEGRATION |
1691 | It is recommended to use AnyEvent::AIO to integrate IO::AIO |
1693 | It is recommended to use AnyEvent::AIO to integrate IO::AIO |
1692 | automatically into many event loops: |
1694 | automatically into many event loops: |
1693 | |
1695 | |
1694 | # AnyEvent integration (EV, Event, Glib, Tk, POE, urxvt, pureperl...) |
1696 | # AnyEvent integration (EV, Event, Glib, Tk, POE, urxvt, pureperl...) |