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

Comparing IO-AIO/README (file contents):
Revision 1.67 by root, Tue Jul 27 07:58:38 2021 UTC vs.
Revision 1.68 by root, Mon Sep 5 00:04:07 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]
261 269
262 API NOTES 270 API NOTES
263 All the "aio_*" calls are more or less thin wrappers around the syscall 271 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 272 with the same name (sans "aio_"). The arguments are similar or
265 identical, and they all accept an additional (and optional) $callback 273 identical, and they all accept an additional (and optional) $callback
1591 no longer exceeded. 1599 no longer exceeded.
1592 1600
1593 In other words, this setting does not enforce a queue limit, but can 1601 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. 1602 be used to make poll functions block if the limit is exceeded.
1595 1603
1596 This is a very bad function to use in interactive programs because 1604 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 1605 blocks, and a bad way to reduce concurrency because it is inexact.
1598 inexact: Better use an "aio_group" together with a feed callback. 1606 If you need to issue many requests without being able to call a poll
1607 function on demand, it is better to use an "aio_group" together with
1608 a feed callback.
1599 1609
1600 Its main use is in scripts without an event loop - when you want to 1610 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: 1611 stat a lot of files, you can write something like this:
1602 1612
1603 IO::AIO::max_outstanding 32; 1613 IO::AIO::max_outstanding 32;
1608 } 1618 }
1609 1619
1610 IO::AIO::flush; 1620 IO::AIO::flush;
1611 1621
1612 The call to "poll_cb" inside the loop will normally return 1622 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 1623 instantly, allowing the loop to progress, but as soon as more than
1614 will block until some requests have been handled. This keeps the 1624 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 1625 been handled. This keeps the loop from pushing a large number of
1616 queue. 1626 "aio_stat" requests onto the queue (which, with many paths to stat,
1627 can use up a lot of memory).
1617 1628
1618 The default value for "max_outstanding" is very large, so there is 1629 The default value for "max_outstanding" is very large, so there is
1619 no practical limit on the number of outstanding requests. 1630 no practical limit on the number of outstanding requests.
1620 1631
1621 STATISTICAL INFORMATION 1632 STATISTICAL INFORMATION
1725 MISCELLANEOUS FUNCTIONS 1736 MISCELLANEOUS FUNCTIONS
1726 IO::AIO implements some functions that are useful when you want to use 1737 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 1738 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_*" 1739 "Asynchronous I/O" route. Many of these have an asynchronous "aio_*"
1729 counterpart. 1740 counterpart.
1741
1742 $retval = IO::AIO::fexecve $fh, $argv, $envp
1743 A more-or-less direct equivalent to the POSIX "fexecve" functions,
1744 which allows you to specify the program to be executed via a file
1745 descriptor (or handle). Returns -1 and sets errno to "ENOSYS" if not
1746 available.
1730 1747
1731 $numfd = IO::AIO::get_fdlimit 1748 $numfd = IO::AIO::get_fdlimit
1732 Tries to find the current file descriptor limit and returns it, or 1749 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 1750 "undef" and sets $! in case of an error. The limit is one larger
1734 than the highest valid file descriptor number. 1751 than the highest valid file descriptor number.
1972 "ENOSYS". 1989 "ENOSYS".
1973 1990
1974 Please refer to memfd_create(2) for more info on this call. 1991 Please refer to memfd_create(2) for more info on this call.
1975 1992
1976 The following $flags values are available: "IO::AIO::MFD_CLOEXEC", 1993 The following $flags values are available: "IO::AIO::MFD_CLOEXEC",
1977 "IO::AIO::MFD_ALLOW_SEALING" and "IO::AIO::MFD_HUGETLB". 1994 "IO::AIO::MFD_ALLOW_SEALING", "IO::AIO::MFD_HUGETLB",
1995 "IO::AIO::MFD_HUGETLB_2MB" and "IO::AIO::MFD_HUGETLB_1GB".
1978 1996
1979 Example: create a new memfd. 1997 Example: create a new memfd.
1980 1998
1981 my $fh = IO::AIO::memfd_create "somenameforprocfd", IO::AIO::MFD_CLOEXEC 1999 my $fh = IO::AIO::memfd_create "somenameforprocfd", IO::AIO::MFD_CLOEXEC
1982 or die "memfd_create: $!\n"; 2000 or die "memfd_create: $!\n";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines