ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/README
(Generate patch)

Comparing IO-AIO/README (file contents):
Revision 1.66 by root, Tue Dec 29 15:20:12 2020 UTC vs.
Revision 1.69 by root, Tue Sep 6 10:56:12 2022 UTC

228 $nfd = IO::AIO::get_fdlimit 228 $nfd = IO::AIO::get_fdlimit
229 IO::AIO::min_fdlimit $nfd 229 IO::AIO::min_fdlimit $nfd
230 230
231 IO::AIO::sendfile $ofh, $ifh, $offset, $count 231 IO::AIO::sendfile $ofh, $ifh, $offset, $count
232 IO::AIO::fadvise $fh, $offset, $len, $advice 232 IO::AIO::fadvise $fh, $offset, $len, $advice
233 IO::AIO::fexecve $fh, $argv, $envp
233 234
234 IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]] 235 IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]]
235 IO::AIO::munmap $scalar 236 IO::AIO::munmap $scalar
236 IO::AIO::mremap $scalar, $new_length, $flags[, $new_address] 237 IO::AIO::mremap $scalar, $new_length, $flags[, $new_address]
237 IO::AIO::madvise $scalar, $offset, $length, $advice 238 IO::AIO::madvise $scalar, $offset, $length, $advice
249 250
250 # very much unportable syscalls 251 # very much unportable syscalls
251 IO::AIO::accept4 $r_fh, $sockaddr, $sockaddr_len, $flags 252 IO::AIO::accept4 $r_fh, $sockaddr, $sockaddr_len, $flags
252 IO::AIO::splice $r_fh, $r_off, $w_fh, $w_off, $length, $flags 253 IO::AIO::splice $r_fh, $r_off, $w_fh, $w_off, $length, $flags
253 IO::AIO::tee $r_fh, $w_fh, $length, $flags 254 IO::AIO::tee $r_fh, $w_fh, $length, $flags
255
254 $actual_size = IO::AIO::pipesize $r_fh[, $new_size] 256 $actual_size = IO::AIO::pipesize $r_fh[, $new_size]
255 ($rfh, $wfh) = IO::AIO::pipe2 [$flags] 257 ($rfh, $wfh) = IO::AIO::pipe2 [$flags]
258
259 $fh = IO::AIO::eventfd [$initval, [$flags]]
256 $fh = IO::AIO::memfd_create $pathname[, $flags] 260 $fh = IO::AIO::memfd_create $pathname[, $flags]
257 $fh = IO::AIO::eventfd [$initval, [$flags]] 261
258 $fh = IO::AIO::timerfd_create $clockid[, $flags] 262 $fh = IO::AIO::timerfd_create $clockid[, $flags]
259 ($cur_interval, $cur_value) = IO::AIO::timerfd_settime $fh, $flags, $new_interval, $nbw_value 263 ($cur_interval, $cur_value) = IO::AIO::timerfd_settime $fh, $flags, $new_interval, $nbw_value
260 ($cur_interval, $cur_value) = IO::AIO::timerfd_gettime $fh 264 ($cur_interval, $cur_value) = IO::AIO::timerfd_gettime $fh
265
266 $fh = IO::AIO::pidfd_open $pid[, $flags]
267 $status = IO::AIO::pidfd_send_signal $pidfh, $signal[, $siginfo[, $flags]]
268 $fh = IO::AIO::pidfd_getfd $pidfh, $targetfd[, $flags]
269
270 $retval = IO::AIO::mount $special, $path, $fstype, $flags = 0, $data = undef
271 $retval = IO::AIO::umount $path, $flags = 0
261 272
262 API NOTES 273 API NOTES
263 All the "aio_*" calls are more or less thin wrappers around the syscall 274 All the "aio_*" calls are more or less thin wrappers around the syscall
264 with the same name (sans "aio_"). The arguments are similar or 275 with the same name (sans "aio_"). The arguments are similar or
265 identical, and they all accept an additional (and optional) $callback 276 identical, and they all accept an additional (and optional) $callback
943 "FS_XFLAG_NODUMP", "FS_XFLAG_RTINHERIT", "FS_XFLAG_PROJINHERIT", 954 "FS_XFLAG_NODUMP", "FS_XFLAG_RTINHERIT", "FS_XFLAG_PROJINHERIT",
944 "FS_XFLAG_NOSYMLINKS", "FS_XFLAG_EXTSIZE", "FS_XFLAG_EXTSZINHERIT", 955 "FS_XFLAG_NOSYMLINKS", "FS_XFLAG_EXTSIZE", "FS_XFLAG_EXTSZINHERIT",
945 "FS_XFLAG_NODEFRAG", "FS_XFLAG_FILESTREAM", "FS_XFLAG_DAX", 956 "FS_XFLAG_NODEFRAG", "FS_XFLAG_FILESTREAM", "FS_XFLAG_DAX",
946 "FS_XFLAG_HASATTR", 957 "FS_XFLAG_HASATTR",
947 958
959 "BLKROSET", "BLKROGET", "BLKRRPART", "BLKGETSIZE", "BLKFLSBUF",
960 "BLKRASET", "BLKRAGET", "BLKFRASET", "BLKFRAGET", "BLKSECTSET",
961 "BLKSECTGET", "BLKSSZGET", "BLKBSZGET", "BLKBSZSET", "BLKGETSIZE64",
962
948 aio_sync $callback->($status) 963 aio_sync $callback->($status)
949 Asynchronously call sync and call the callback when finished. 964 Asynchronously call sync and call the callback when finished.
950 965
951 aio_fsync $fh, $callback->($status) 966 aio_fsync $fh, $callback->($status)
952 Asynchronously call fsync on the given filehandle and call the 967 Asynchronously call fsync on the given filehandle and call the
1591 no longer exceeded. 1606 no longer exceeded.
1592 1607
1593 In other words, this setting does not enforce a queue limit, but can 1608 In other words, this setting does not enforce a queue limit, but can
1594 be used to make poll functions block if the limit is exceeded. 1609 be used to make poll functions block if the limit is exceeded.
1595 1610
1596 This is a very bad function to use in interactive programs because 1611 This is a bad function to use in interactive programs because it
1597 it blocks, and a bad way to reduce concurrency because it is 1612 blocks, and a bad way to reduce concurrency because it is inexact.
1598 inexact: Better use an "aio_group" together with a feed callback. 1613 If you need to issue many requests without being able to call a poll
1614 function on demand, it is better to use an "aio_group" together with
1615 a feed callback.
1599 1616
1600 Its main use is in scripts without an event loop - when you want to 1617 Its main use is in scripts without an event loop - when you want to
1601 stat a lot of files, you can write something like this: 1618 stat a lot of files, you can write something like this:
1602 1619
1603 IO::AIO::max_outstanding 32; 1620 IO::AIO::max_outstanding 32;
1608 } 1625 }
1609 1626
1610 IO::AIO::flush; 1627 IO::AIO::flush;
1611 1628
1612 The call to "poll_cb" inside the loop will normally return 1629 The call to "poll_cb" inside the loop will normally return
1613 instantly, but as soon as more thna 32 reqeusts are in-flight, it 1630 instantly, allowing the loop to progress, but as soon as more than
1614 will block until some requests have been handled. This keeps the 1631 32 requests are in-flight, it will block until some requests have
1615 loop from pushing a large number of "aio_stat" requests onto the 1632 been handled. This keeps the loop from pushing a large number of
1616 queue. 1633 "aio_stat" requests onto the queue (which, with many paths to stat,
1634 can use up a lot of memory).
1617 1635
1618 The default value for "max_outstanding" is very large, so there is 1636 The default value for "max_outstanding" is very large, so there is
1619 no practical limit on the number of outstanding requests. 1637 no practical limit on the number of outstanding requests.
1620 1638
1621 STATISTICAL INFORMATION 1639 STATISTICAL INFORMATION
1726 IO::AIO implements some functions that are useful when you want to use 1744 IO::AIO implements some functions that are useful when you want to use
1727 some "Advanced I/O" function not available to in Perl, without going the 1745 some "Advanced I/O" function not available to in Perl, without going the
1728 "Asynchronous I/O" route. Many of these have an asynchronous "aio_*" 1746 "Asynchronous I/O" route. Many of these have an asynchronous "aio_*"
1729 counterpart. 1747 counterpart.
1730 1748
1749 $retval = IO::AIO::fexecve $fh, $argv, $envp
1750 A more-or-less direct equivalent to the POSIX "fexecve" functions,
1751 which allows you to specify the program to be executed via a file
1752 descriptor (or handle). Returns -1 and sets errno to "ENOSYS" if not
1753 available.
1754
1755 $retval = IO::AIO::mount $special, $path, $fstype, $flags = 0, $data =
1756 undef
1757 Calls the GNU/Linux mount syscall with the given arguments. All
1758 except $flags are strings, and if $data is "undef", a "NULL" will be
1759 passed.
1760
1761 The following values for $flags are available:
1762
1763 "IO::AIO::MS_RDONLY", "IO::AIO::MS_NOSUID", "IO::AIO::MS_NODEV",
1764 "IO::AIO::MS_NOEXEC", "IO::AIO::MS_SYNCHRONOUS",
1765 "IO::AIO::MS_REMOUNT", "IO::AIO::MS_MANDLOCK",
1766 "IO::AIO::MS_DIRSYNC", "IO::AIO::MS_NOATIME",
1767 "IO::AIO::MS_NODIRATIME", "IO::AIO::MS_BIND", "IO::AIO::MS_MOVE",
1768 "IO::AIO::MS_REC", "IO::AIO::MS_SILENT", "IO::AIO::MS_POSIXACL",
1769 "IO::AIO::MS_UNBINDABLE", "IO::AIO::MS_PRIVATE",
1770 "IO::AIO::MS_SLAVE", "IO::AIO::MS_SHARED", "IO::AIO::MS_RELATIME",
1771 "IO::AIO::MS_KERNMOUNT", "IO::AIO::MS_I_VERSION",
1772 "IO::AIO::MS_STRICTATIME", "IO::AIO::MS_LAZYTIME",
1773 "IO::AIO::MS_ACTIVE", "IO::AIO::MS_NOUSER", "IO::AIO::MS_RMT_MASK",
1774 "IO::AIO::MS_MGC_VAL" and "IO::AIO::MS_MGC_MSK".
1775
1776 $retval = IO::AIO::umount $path, $flags = 0
1777 Invokes the GNU/Linux "umount" or "umount2" syscalls. Always calls
1778 "umount" if $flags is 0, otherwqise always tries to call "umount2".
1779
1780 The following $flags are available:
1781
1782 "IO::AIO::MNT_FORCE", "IO::AIO::MNT_DETACH", "IO::AIO::MNT_EXPIRE"
1783 and "IO::AIO::UMOUNT_NOFOLLOW".
1784
1731 $numfd = IO::AIO::get_fdlimit 1785 $numfd = IO::AIO::get_fdlimit
1732 Tries to find the current file descriptor limit and returns it, or 1786 Tries to find the current file descriptor limit and returns it, or
1733 "undef" and sets $! in case of an error. The limit is one larger 1787 "undef" and sets $! in case of an error. The limit is one larger
1734 than the highest valid file descriptor number. 1788 than the highest valid file descriptor number.
1735 1789
1828 not available, the are 0): "IO::AIO::MAP_ANONYMOUS" (which is set to 1882 not available, the are 0): "IO::AIO::MAP_ANONYMOUS" (which is set to
1829 "MAP_ANON" if your system only provides this constant), 1883 "MAP_ANON" if your system only provides this constant),
1830 "IO::AIO::MAP_LOCKED", "IO::AIO::MAP_NORESERVE", 1884 "IO::AIO::MAP_LOCKED", "IO::AIO::MAP_NORESERVE",
1831 "IO::AIO::MAP_POPULATE", "IO::AIO::MAP_NONBLOCK", 1885 "IO::AIO::MAP_POPULATE", "IO::AIO::MAP_NONBLOCK",
1832 "IO::AIO::MAP_FIXED", "IO::AIO::MAP_GROWSDOWN", 1886 "IO::AIO::MAP_FIXED", "IO::AIO::MAP_GROWSDOWN",
1833 "IO::AIO::MAP_32BIT", "IO::AIO::MAP_HUGETLB" or 1887 "IO::AIO::MAP_32BIT", "IO::AIO::MAP_HUGETLB", "IO::AIO::MAP_STACK",
1834 "IO::AIO::MAP_STACK". 1888 "IO::AIO::MAP_FIXED_NOREPLACE", "IO::AIO::MAP_SHARED_VALIDATE",
1889 "IO::AIO::MAP_SYNC" or "IO::AIO::MAP_UNINITIALIZED".
1835 1890
1836 If $fh is "undef", then a file descriptor of -1 is passed. 1891 If $fh is "undef", then a file descriptor of -1 is passed.
1837 1892
1838 $offset is the offset from the start of the file - it generally must 1893 $offset is the offset from the start of the file - it generally must
1839 be a multiple of "IO::AIO::PAGESIZE" and defaults to 0. 1894 be a multiple of "IO::AIO::PAGESIZE" and defaults to 0.
1971 "ENOSYS". 2026 "ENOSYS".
1972 2027
1973 Please refer to memfd_create(2) for more info on this call. 2028 Please refer to memfd_create(2) for more info on this call.
1974 2029
1975 The following $flags values are available: "IO::AIO::MFD_CLOEXEC", 2030 The following $flags values are available: "IO::AIO::MFD_CLOEXEC",
1976 "IO::AIO::MFD_ALLOW_SEALING" and "IO::AIO::MFD_HUGETLB". 2031 "IO::AIO::MFD_ALLOW_SEALING", "IO::AIO::MFD_HUGETLB",
2032 "IO::AIO::MFD_HUGETLB_2MB" and "IO::AIO::MFD_HUGETLB_1GB".
1977 2033
1978 Example: create a new memfd. 2034 Example: create a new memfd.
1979 2035
1980 my $fh = IO::AIO::memfd_create "somenameforprocfd", IO::AIO::MFD_CLOEXEC 2036 my $fh = IO::AIO::memfd_create "somenameforprocfd", IO::AIO::MFD_CLOEXEC
1981 or die "memfd_create: $!\n"; 2037 or die "memfd_create: $!\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines