… | |
… | |
94 | |
94 | |
95 | # file contents now in $contents |
95 | # file contents now in $contents |
96 | print $contents; |
96 | print $contents; |
97 | |
97 | |
98 | # exit event loop and program |
98 | # exit event loop and program |
99 | EV::unloop; |
99 | EV::break; |
100 | }; |
100 | }; |
101 | }; |
101 | }; |
102 | |
102 | |
103 | # possibly queue up other requests, or open GUI windows, |
103 | # possibly queue up other requests, or open GUI windows, |
104 | # check for sockets etc. etc. |
104 | # check for sockets etc. etc. |
105 | |
105 | |
106 | # process events as long as there are some: |
106 | # process events as long as there are some: |
107 | EV::loop; |
107 | EV::run; |
108 | |
108 | |
109 | =head1 REQUEST ANATOMY AND LIFETIME |
109 | =head1 REQUEST ANATOMY AND LIFETIME |
110 | |
110 | |
111 | Every C<aio_*> function creates a request. which is a C data structure not |
111 | Every C<aio_*> function creates a request. which is a C data structure not |
112 | directly visible to Perl. |
112 | directly visible to Perl. |
… | |
… | |
167 | use common::sense; |
167 | use common::sense; |
168 | |
168 | |
169 | use base 'Exporter'; |
169 | use base 'Exporter'; |
170 | |
170 | |
171 | BEGIN { |
171 | BEGIN { |
172 | our $VERSION = 4.32; |
172 | our $VERSION = 4.33; |
173 | |
173 | |
174 | our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close |
174 | our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close |
175 | aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx |
175 | aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx |
176 | aio_scandir aio_symlink aio_readlink aio_realpath aio_sync |
176 | aio_scandir aio_symlink aio_readlink aio_realpath aio_sync |
177 | aio_fsync aio_syncfs aio_fdatasync aio_sync_file_range aio_allocate |
177 | aio_fsync aio_syncfs aio_fdatasync aio_sync_file_range aio_allocate |
… | |
… | |
626 | 0x00001373 devfs |
626 | 0x00001373 devfs |
627 | 0x00001cd1 devpts |
627 | 0x00001cd1 devpts |
628 | 0x0000f15f ecryptfs |
628 | 0x0000f15f ecryptfs |
629 | 0x00414a53 efs |
629 | 0x00414a53 efs |
630 | 0x0000137d ext |
630 | 0x0000137d ext |
631 | 0x0000ef53 ext2/ext3 |
631 | 0x0000ef53 ext2/ext3/ext4 |
632 | 0x0000ef51 ext2 |
632 | 0x0000ef51 ext2 |
|
|
633 | 0xf2f52010 f2fs |
633 | 0x00004006 fat |
634 | 0x00004006 fat |
634 | 0x65735546 fuseblk |
635 | 0x65735546 fuseblk |
635 | 0x65735543 fusectl |
636 | 0x65735543 fusectl |
636 | 0x0bad1dea futexfs |
637 | 0x0bad1dea futexfs |
637 | 0x01161970 gfs2 |
638 | 0x01161970 gfs2 |
638 | 0x47504653 gpfs |
639 | 0x47504653 gpfs |
639 | 0x00004244 hfs |
640 | 0x00004244 hfs |
640 | 0xf995e849 hpfs |
641 | 0xf995e849 hpfs |
|
|
642 | 0x00c0ffee hostfs |
641 | 0x958458f6 hugetlbfs |
643 | 0x958458f6 hugetlbfs |
642 | 0x2bad1dea inotifyfs |
644 | 0x2bad1dea inotifyfs |
643 | 0x00009660 isofs |
645 | 0x00009660 isofs |
644 | 0x000072b6 jffs2 |
646 | 0x000072b6 jffs2 |
645 | 0x3153464a jfs |
647 | 0x3153464a jfs |
… | |
… | |
660 | 0x00009fa1 openprom |
662 | 0x00009fa1 openprom |
661 | 0x7461636F ocfs2 |
663 | 0x7461636F ocfs2 |
662 | 0x00009fa0 proc |
664 | 0x00009fa0 proc |
663 | 0x6165676c pstorefs |
665 | 0x6165676c pstorefs |
664 | 0x0000002f qnx4 |
666 | 0x0000002f qnx4 |
|
|
667 | 0x68191122 qnx6 |
665 | 0x858458f6 ramfs |
668 | 0x858458f6 ramfs |
666 | 0x52654973 reiserfs |
669 | 0x52654973 reiserfs |
667 | 0x00007275 romfs |
670 | 0x00007275 romfs |
668 | 0x67596969 rpc_pipefs |
671 | 0x67596969 rpc_pipefs |
669 | 0x73636673 securityfs |
672 | 0x73636673 securityfs |
… | |
… | |
2057 | filesize. |
2060 | filesize. |
2058 | |
2061 | |
2059 | C<$prot> is a combination of C<IO::AIO::PROT_NONE>, C<IO::AIO::PROT_EXEC>, |
2062 | C<$prot> is a combination of C<IO::AIO::PROT_NONE>, C<IO::AIO::PROT_EXEC>, |
2060 | C<IO::AIO::PROT_READ> and/or C<IO::AIO::PROT_WRITE>, |
2063 | C<IO::AIO::PROT_READ> and/or C<IO::AIO::PROT_WRITE>, |
2061 | |
2064 | |
2062 | C<$flags> can be a combination of C<IO::AIO::MAP_SHARED> or |
2065 | C<$flags> can be a combination of |
2063 | C<IO::AIO::MAP_PRIVATE>, or a number of system-specific flags (when |
2066 | C<IO::AIO::MAP_SHARED> or |
2064 | not available, the are defined as 0): C<IO::AIO::MAP_ANONYMOUS> |
2067 | C<IO::AIO::MAP_PRIVATE>, |
|
|
2068 | or a number of system-specific flags (when not available, the are C<0>): |
2065 | (which is set to C<MAP_ANON> if your system only provides this |
2069 | C<IO::AIO::MAP_ANONYMOUS> (which is set to C<MAP_ANON> if your system only provides this constant), |
2066 | constant), C<IO::AIO::MAP_HUGETLB>, C<IO::AIO::MAP_LOCKED>, |
2070 | C<IO::AIO::MAP_LOCKED>, |
2067 | C<IO::AIO::MAP_NORESERVE>, C<IO::AIO::MAP_POPULATE> or |
2071 | C<IO::AIO::MAP_NORESERVE>, |
|
|
2072 | C<IO::AIO::MAP_POPULATE>, |
2068 | C<IO::AIO::MAP_NONBLOCK> |
2073 | C<IO::AIO::MAP_NONBLOCK>, |
|
|
2074 | C<IO::AIO::MAP_FIXED>, |
|
|
2075 | C<IO::AIO::MAP_GROWSDOWN>, |
|
|
2076 | C<IO::AIO::MAP_32BIT>, |
|
|
2077 | C<IO::AIO::MAP_HUGETLB> or |
|
|
2078 | C<IO::AIO::MAP_STACK>. |
2069 | |
2079 | |
2070 | If C<$fh> is C<undef>, then a file descriptor of C<-1> is passed. |
2080 | If C<$fh> is C<undef>, then a file descriptor of C<-1> is passed. |
2071 | |
2081 | |
2072 | C<$offset> is the offset from the start of the file - it generally must be |
2082 | C<$offset> is the offset from the start of the file - it generally must be |
2073 | a multiple of C<IO::AIO::PAGESIZE> and defaults to C<0>. |
2083 | a multiple of C<IO::AIO::PAGESIZE> and defaults to C<0>. |