--- IO-AIO/AIO.pm 2021/02/07 13:13:44 1.311 +++ IO-AIO/AIO.pm 2022/09/25 16:30:50 1.317 @@ -173,7 +173,7 @@ use base 'Exporter'; BEGIN { - our $VERSION = 4.75; + our $VERSION = 4.79; our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx @@ -194,7 +194,12 @@ nreqs nready npending nthreads max_poll_time max_poll_reqs sendfile fadvise madvise - mmap munmap mremap munlock munlockall); + mmap munmap mremap munlock munlockall + + accept4 tee splice pipe2 pipesize + fexecve mount umount memfd_create eventfd + timerfd_create timerfd_settime timerfd_gettime + pidfd_open pidfd_send_signal pidfd_getfd); push @AIO_REQ, qw(aio_busy); # not exported @@ -287,6 +292,7 @@ IO::AIO::sendfile $ofh, $ifh, $offset, $count IO::AIO::fadvise $fh, $offset, $len, $advice + IO::AIO::fexecve $fh, $argv, $envp IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]] IO::AIO::munmap $scalar @@ -308,14 +314,24 @@ IO::AIO::accept4 $r_fh, $sockaddr, $sockaddr_len, $flags IO::AIO::splice $r_fh, $r_off, $w_fh, $w_off, $length, $flags IO::AIO::tee $r_fh, $w_fh, $length, $flags + $actual_size = IO::AIO::pipesize $r_fh[, $new_size] ($rfh, $wfh) = IO::AIO::pipe2 [$flags] - $fh = IO::AIO::memfd_create $pathname[, $flags] + $fh = IO::AIO::eventfd [$initval, [$flags]] + $fh = IO::AIO::memfd_create $pathname[, $flags] + $fh = IO::AIO::timerfd_create $clockid[, $flags] ($cur_interval, $cur_value) = IO::AIO::timerfd_settime $fh, $flags, $new_interval, $nbw_value ($cur_interval, $cur_value) = IO::AIO::timerfd_gettime $fh + $fh = IO::AIO::pidfd_open $pid[, $flags] + $status = IO::AIO::pidfd_send_signal $pidfh, $signal[, $siginfo[, $flags]] + $fh = IO::AIO::pidfd_getfd $pidfh, $targetfd[, $flags] + + $retval = IO::AIO::mount $special, $path, $fstype, $flags = 0, $data = undef + $retval = IO::AIO::umount $path, $flags = 0 + =head2 API NOTES All the C calls are more or less thin wrappers around the syscall @@ -1340,6 +1356,11 @@ C, C, C, C, C, C, C, C, +C, C, C, C, C, C, +C, C, C, C, C, C, +C, C, C, + + =item aio_sync $callback->($status) Asynchronously call sync and call the callback when finished. @@ -2063,12 +2084,13 @@ In other words, this setting does not enforce a queue limit, but can be used to make poll functions block if the limit is exceeded. -This is a very bad function to use in interactive programs because it -blocks, and a bad way to reduce concurrency because it is inexact: Better -use an C together with a feed callback. +This is a bad function to use in interactive programs because it blocks, +and a bad way to reduce concurrency because it is inexact. If you need to +issue many requests without being able to call a poll function on demand, +it is better to use an C together with a feed callback. -Its main use is in scripts without an event loop - when you want to stat -a lot of files, you can write something like this: +Its main use is in scripts without an event loop - when you want to stat a +lot of files, you can write something like this: IO::AIO::max_outstanding 32; @@ -2079,10 +2101,11 @@ IO::AIO::flush; -The call to C inside the loop will normally return instantly, but -as soon as more thna C<32> reqeusts are in-flight, it will block until -some requests have been handled. This keeps the loop from pushing a large -number of C requests onto the queue. +The call to C inside the loop will normally return instantly, +allowing the loop to progress, but as soon as more than C<32> requests +are in-flight, it will block until some requests have been handled. This +keeps the loop from pushing a large number of C requests onto +the queue (which, with many paths to stat, can use up a lot of memory). The default value for C is very large, so there is no practical limit on the number of outstanding requests. @@ -2220,6 +2243,38 @@ =over 4 +=item $retval = IO::AIO::fexecve $fh, $argv, $envp + +A more-or-less direct equivalent to the POSIX C functions, which +allows you to specify the program to be executed via a file descriptor (or +handle). Returns C<-1> and sets errno to C if not available. + +=item $retval = IO::AIO::mount $special, $path, $fstype, $flags = 0, $data = undef + +Calls the GNU/Linux mount syscall with the given arguments. All except +C<$flags> are strings, and if C<$data> is C, a C will be +passed. + +The following values for C<$flags> are available: + +C, C, C, C, C, +C, C, C, C, +C, C, C, C, C, +C, C, C, C, C, +C, C, C, C, +C, C, C, C, C and +C. + +=item $retval = IO::AIO::umount $path, $flags = 0 + +Invokes the GNU/Linux C or C syscalls. Always calls +C if C<$flags> is C<0>, otherwqise always tries to call +C. + +The following C<$flags> are available: + +C, C, C and C. + =item $numfd = IO::AIO::get_fdlimit Tries to find the current file descriptor limit and returns it, or @@ -2485,7 +2540,8 @@ Please refer to L for more info on this call. The following C<$flags> values are available: C, -C and C. +C, C, +C and C. Example: create a new memfd.