… | |
… | |
221 | IO::AIO::idle_timeout $seconds |
221 | IO::AIO::idle_timeout $seconds |
222 | IO::AIO::max_outstanding $maxreqs |
222 | IO::AIO::max_outstanding $maxreqs |
223 | IO::AIO::nreqs |
223 | IO::AIO::nreqs |
224 | IO::AIO::nready |
224 | IO::AIO::nready |
225 | IO::AIO::npending |
225 | IO::AIO::npending |
|
|
226 | IO::AIO::reinit |
|
|
227 | |
226 | $nfd = IO::AIO::get_fdlimit [EXPERIMENTAL] |
228 | $nfd = IO::AIO::get_fdlimit [EXPERIMENTAL] |
227 | IO::AIO::min_fdlimit $nfd [EXPERIMENTAL] |
229 | IO::AIO::min_fdlimit $nfd [EXPERIMENTAL] |
228 | |
230 | |
229 | IO::AIO::sendfile $ofh, $ifh, $offset, $count |
231 | IO::AIO::sendfile $ofh, $ifh, $offset, $count |
230 | IO::AIO::fadvise $fh, $offset, $len, $advice |
232 | IO::AIO::fadvise $fh, $offset, $len, $advice |
|
|
233 | |
231 | IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]] |
234 | IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]] |
232 | IO::AIO::munmap $scalar |
235 | IO::AIO::munmap $scalar |
233 | IO::AIO::mremap $scalar, $new_length, $flags[, $new_address] |
236 | IO::AIO::mremap $scalar, $new_length, $flags[, $new_address] |
234 | IO::AIO::madvise $scalar, $offset, $length, $advice |
237 | IO::AIO::madvise $scalar, $offset, $length, $advice |
235 | IO::AIO::mprotect $scalar, $offset, $length, $protect |
238 | IO::AIO::mprotect $scalar, $offset, $length, $protect |
236 | IO::AIO::munlock $scalar, $offset = 0, $length = undef |
239 | IO::AIO::munlock $scalar, $offset = 0, $length = undef |
237 | IO::AIO::munlockall |
240 | IO::AIO::munlockall |
|
|
241 | |
|
|
242 | # stat extensions |
|
|
243 | $counter = IO::AIO::st_gen |
|
|
244 | $seconds = IO::AIO::st_atime, IO::AIO::st_mtime, IO::AIO::st_ctime, IO::AIO::st_btime |
|
|
245 | ($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtime |
|
|
246 | $nanoseconds = IO::AIO::st_atimensec, IO::AIO::st_mtimensec, IO::AIO::st_ctimensec, IO::AIO::st_btimensec |
|
|
247 | $seconds = IO::AIO::st_btimesec |
|
|
248 | ($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtimensec |
|
|
249 | |
|
|
250 | # very much unportable syscalls |
|
|
251 | IO::AIO::splice $r_fh, $r_off, $w_fh, $w_off, $length, $flags |
|
|
252 | IO::AIO::tee $r_fh, $w_fh, $length, $flags |
|
|
253 | $actual_size = IO::AIO::pipesize $r_fh[, $new_size] |
|
|
254 | ($rfh, $wfh) = IO::AIO::pipe2 [$flags] |
|
|
255 | $fh = IO::AIO::memfd_create $pathname[, $flags] |
|
|
256 | $fh = IO::AIO::eventfd [$initval, [$flags]] |
|
|
257 | $fh = IO::AIO::timerfd_create $clockid[, $flags] |
|
|
258 | ($cur_interval, $cur_value) = IO::AIO::timerfd_settime $fh, $flags, $new_interval, $nbw_value |
|
|
259 | ($cur_interval, $cur_value) = IO::AIO::timerfd_gettime $fh |
238 | |
260 | |
239 | API NOTES |
261 | API NOTES |
240 | All the "aio_*" calls are more or less thin wrappers around the syscall |
262 | All the "aio_*" calls are more or less thin wrappers around the syscall |
241 | with the same name (sans "aio_"). The arguments are similar or |
263 | with the same name (sans "aio_"). The arguments are similar or |
242 | identical, and they all accept an additional (and optional) $callback |
264 | identical, and they all accept an additional (and optional) $callback |
… | |
… | |
1016 | IO::AIO::mmap $data, -s $fh, IO::AIO::PROT_READ, IO::AIO::MAP_SHARED, $fh; |
1038 | IO::AIO::mmap $data, -s $fh, IO::AIO::PROT_READ, IO::AIO::MAP_SHARED, $fh; |
1017 | aio_mlock $data; # mlock in background |
1039 | aio_mlock $data; # mlock in background |
1018 | |
1040 | |
1019 | aio_mlockall $flags, $callback->($status) |
1041 | aio_mlockall $flags, $callback->($status) |
1020 | Calls the "mlockall" function with the given $flags (a combination |
1042 | Calls the "mlockall" function with the given $flags (a combination |
1021 | of "IO::AIO::MCL_CURRENT" and "IO::AIO::MCL_FUTURE"). |
1043 | of "IO::AIO::MCL_CURRENT", "IO::AIO::MCL_FUTURE" and |
|
|
1044 | "IO::AIO::MCL_ONFAULT"). |
1022 | |
1045 | |
1023 | On systems that do not implement "mlockall", this function returns |
1046 | On systems that do not implement "mlockall", this function returns |
1024 | -1 and sets errno to "ENOSYS". |
1047 | -1 and sets errno to "ENOSYS". Similarly, flag combinations not |
|
|
1048 | supported by the system result in a return value of -1 with errno |
|
|
1049 | being set to "EINVAL". |
1025 | |
1050 | |
1026 | Note that the corresponding "munlockall" is synchronous and is |
1051 | Note that the corresponding "munlockall" is synchronous and is |
1027 | documented under "MISCELLANEOUS FUNCTIONS". |
1052 | documented under "MISCELLANEOUS FUNCTIONS". |
1028 | |
1053 | |
1029 | Example: asynchronously lock all current and future pages into |
1054 | Example: asynchronously lock all current and future pages into |
… | |
… | |
1638 | below, for full accuracy. |
1663 | below, for full accuracy. |
1639 | |
1664 | |
1640 | File birth time is only available when the OS and perl support it |
1665 | File birth time is only available when the OS and perl support it |
1641 | (on FreeBSD and NetBSD at the time of this writing, although support |
1666 | (on FreeBSD and NetBSD at the time of this writing, although support |
1642 | is adaptive, so if your OS/perl gains support, IO::AIO can take |
1667 | is adaptive, so if your OS/perl gains support, IO::AIO can take |
1643 | avdantage of it). On systems where it isn't available, 0 is |
1668 | advantage of it). On systems where it isn't available, 0 is |
1644 | currently returned, but this might change to "undef" in a future |
1669 | currently returned, but this might change to "undef" in a future |
1645 | version. |
1670 | version. |
1646 | |
1671 | |
1647 | ($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtime |
1672 | ($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtime |
1648 | Returns access, modification, change and birth time all in one go, |
1673 | Returns access, modification, change and birth time all in one go, |
… | |
… | |
1664 | ($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtimensec |
1689 | ($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtimensec |
1665 | Like the functions above, but returns all four times in one go (and |
1690 | Like the functions above, but returns all four times in one go (and |
1666 | maybe more in future versions). |
1691 | maybe more in future versions). |
1667 | |
1692 | |
1668 | $counter = IO::AIO::st_gen |
1693 | $counter = IO::AIO::st_gen |
1669 | Returns the generation counter of the file. This is only available |
1694 | Returns the generation counter (in practice this is just a random |
1670 | on platforms which have this member in their "struct stat" (most |
1695 | number) of the file. This is only available on platforms which have |
1671 | BSDs at the time of this writing) and generally only to the root |
1696 | this member in their "struct stat" (most BSDs at the time of this |
1672 | usert. If unsupported, 0 is returned, but this might change to |
1697 | writing) and generally only to the root usert. If unsupported, 0 is |
1673 | "undef" in a future version. |
1698 | returned, but this might change to "undef" in a future version. |
1674 | |
1699 | |
1675 | Example: print the high resolution modification time of /etc, using |
1700 | Example: print the high resolution modification time of /etc, using |
1676 | "stat", and "IO::AIO::aio_stat". |
1701 | "stat", and "IO::AIO::aio_stat". |
1677 | |
1702 | |
1678 | if (stat "/etc") { |
1703 | if (stat "/etc") { |
… | |
… | |
1851 | version. |
1876 | version. |
1852 | |
1877 | |
1853 | On systems where this call is not supported or is not emulated, this |
1878 | On systems where this call is not supported or is not emulated, this |
1854 | call returns falls and sets $! to "ENOSYS". |
1879 | call returns falls and sets $! to "ENOSYS". |
1855 | |
1880 | |
|
|
1881 | IO::AIO::mlockall $flags |
|
|
1882 | Calls the "eio_mlockall_sync" function, which is like |
|
|
1883 | "aio_mlockall", but is blocking. |
|
|
1884 | |
1856 | IO::AIO::munlock $scalar, $offset = 0, $length = undef |
1885 | IO::AIO::munlock $scalar, $offset = 0, $length = undef |
1857 | Calls the "munlock" function, undoing the effects of a previous |
1886 | Calls the "munlock" function, undoing the effects of a previous |
1858 | "aio_mlock" call (see its description for details). |
1887 | "aio_mlock" call (see its description for details). |
1859 | |
1888 | |
1860 | IO::AIO::munlockall |
1889 | IO::AIO::munlockall |
… | |
… | |
1910 | Example: create a pipe race-free w.r.t. threads and fork: |
1939 | Example: create a pipe race-free w.r.t. threads and fork: |
1911 | |
1940 | |
1912 | my ($rfh, $wfh) = IO::AIO::pipe2 IO::AIO::O_CLOEXEC |
1941 | my ($rfh, $wfh) = IO::AIO::pipe2 IO::AIO::O_CLOEXEC |
1913 | or die "pipe2: $!\n"; |
1942 | or die "pipe2: $!\n"; |
1914 | |
1943 | |
|
|
1944 | $fh = IO::AIO::memfd_create $pathname[, $flags] |
|
|
1945 | This is a direct interface to the Linux memfd_create(2) system call. |
|
|
1946 | The (unhelpful) default for $flags is 0, but your default should be |
|
|
1947 | "IO::AIO::MFD_CLOEXEC". |
|
|
1948 | |
|
|
1949 | On success, the new memfd filehandle is returned, otherwise returns |
|
|
1950 | "undef". If the memfd_create syscall is missing, fails with |
|
|
1951 | "ENOSYS". |
|
|
1952 | |
|
|
1953 | Please refer to memfd_create(2) for more info on this call. |
|
|
1954 | |
|
|
1955 | The following $flags values are available: "IO::AIO::MFD_CLOEXEC", |
|
|
1956 | "IO::AIO::MFD_ALLOW_SEALING" and "IO::AIO::MFD_HUGETLB". |
|
|
1957 | |
|
|
1958 | Example: create a new memfd. |
|
|
1959 | |
|
|
1960 | my $fh = IO::AIO::memfd_create "somenameforprocfd", IO::AIO::MFD_CLOEXEC |
|
|
1961 | or die "m,emfd_create: $!\n"; |
1915 | $fh = IO::AIO::eventfd [$initval, [$flags]] |
1962 | =item $fh = IO::AIO::eventfd [$initval, [$flags]] |
|
|
1963 | |
1916 | This is a direct interface to the Linux eventfd(2) system call. The |
1964 | This is a direct interface to the Linux eventfd(2) system call. The |
1917 | (unhelpful) defaults for $initval and $flags are 0 for both. |
1965 | (unhelpful) defaults for $initval and $flags are 0 for both. |
1918 | |
1966 | |
1919 | On success, the new eventfd filehandle is returned, otherwise |
1967 | On success, the new eventfd filehandle is returned, otherwise |
1920 | returns "undef". If the eventfd syscall is missing, fails with |
1968 | returns "undef". If the eventfd syscall is missing, fails with |
… | |
… | |
1926 | "IO::AIO::EFD_CLOEXEC", "IO::AIO::EFD_NONBLOCK" and |
1974 | "IO::AIO::EFD_CLOEXEC", "IO::AIO::EFD_NONBLOCK" and |
1927 | "IO::AIO::EFD_SEMAPHORE" (Linux 2.6.30). |
1975 | "IO::AIO::EFD_SEMAPHORE" (Linux 2.6.30). |
1928 | |
1976 | |
1929 | Example: create a new eventfd filehandle: |
1977 | Example: create a new eventfd filehandle: |
1930 | |
1978 | |
1931 | $fh = IO::AIO::eventfd 0, IO::AIO::O_CLOEXEC |
1979 | $fh = IO::AIO::eventfd 0, IO::AIO::EFD_CLOEXEC |
1932 | or die "eventfd: $!\n"; |
1980 | or die "eventfd: $!\n"; |
1933 | |
1981 | |
1934 | $fh = IO::AIO::timerfd_create $clockid[, $flags] |
1982 | $fh = IO::AIO::timerfd_create $clockid[, $flags] |
1935 | This is a direct interface to the Linux timerfd_create(2) system |
1983 | This is a direct interface to the Linux timerfd_create(2) system |
1936 | call. The (unhelpful) default for $flags is 0. |
1984 | call. The (unhelpful) default for $flags is 0, but your default |
|
|
1985 | should be "IO::AIO::TFD_CLOEXEC". |
1937 | |
1986 | |
1938 | On success, the new timerfd filehandle is returned, otherwise |
1987 | On success, the new timerfd filehandle is returned, otherwise |
1939 | returns "undef". If the eventfd syscall is missing, fails with |
1988 | returns "undef". If the timerfd_create syscall is missing, fails |
1940 | "ENOSYS". |
1989 | with "ENOSYS". |
1941 | |
1990 | |
1942 | Please refer to timerfd_create(2) for more info on this call. |
1991 | Please refer to timerfd_create(2) for more info on this call. |
1943 | |
1992 | |
1944 | The following $clockid values are available: |
1993 | The following $clockid values are available: |
1945 | "IO::AIO::CLOCK_REALTIME", "IO::AIO::CLOCK_MONOTONIC" |
1994 | "IO::AIO::CLOCK_REALTIME", "IO::AIO::CLOCK_MONOTONIC" |