--- IO-AIO/AIO.pm 2019/10/16 09:11:35 1.306 +++ IO-AIO/AIO.pm 2020/12/30 07:45:32 1.310 @@ -173,7 +173,7 @@ use base 'Exporter'; BEGIN { - our $VERSION = 4.73; + our $VERSION = 4.75; 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 @@ -282,8 +282,8 @@ IO::AIO::npending IO::AIO::reinit - $nfd = IO::AIO::get_fdlimit [EXPERIMENTAL] - IO::AIO::min_fdlimit $nfd [EXPERIMENTAL] + $nfd = IO::AIO::get_fdlimit + IO::AIO::min_fdlimit $nfd IO::AIO::sendfile $ofh, $ifh, $offset, $count IO::AIO::fadvise $fh, $offset, $len, $advice @@ -2222,16 +2222,12 @@ =item $numfd = IO::AIO::get_fdlimit -This function is I and subject to change. - Tries to find the current file descriptor limit and returns it, or C and sets C<$!> in case of an error. The limit is one larger than the highest valid file descriptor number. =item IO::AIO::min_fdlimit [$numfd] -This function is I and subject to change. - Try to increase the current file descriptor limit(s) to at least C<$numfd> by changing the soft or hard file descriptor resource limit. If C<$numfd> is missing, it will try to set a very high limit, although this is not @@ -2415,7 +2411,7 @@ To accept name-less sockets, use C for C<$sockaddr> and C<0> for C<$sockaddr_maxlen>. -The main reasons to use this syscall rather than portable C«accept(2)> +The main reasons to use this syscall rather than portable C are that you can specify C and/or C flags and you can accept name-less sockets by specifying C<0> for C<$sockaddr_maxlen>, which is sadly not possible with perl's interface to @@ -2490,7 +2486,72 @@ Example: create a new memfd. my $fh = IO::AIO::memfd_create "somenameforprocfd", IO::AIO::MFD_CLOEXEC - or die "m,emfd_create: $!\n"; + or die "memfd_create: $!\n"; + +=item $fh = IO::AIO::pidfd_open $pid[, $flags] + +This is an interface to the Linux L system call. The +default for C<$flags> is C<0>. + +On success, a new pidfd filehandle is returned (that is already set to +close-on-exec), otherwise returns C. If the syscall is missing, +fails with C. + +Example: open pid 6341 as pidfd. + + my $fh = IO::AIO::pidfd_open 6341 + or die "pidfd_open: $!\n"; + +=item $status = IO::AIO::pidfd_send_signal $pidfh, $signal[, $siginfo[, $flags]] + +This is an interface to the Linux L system call. The +default for C<$siginfo> is C and the default for C<$flags> is C<0>. + +Returns the system call status. If the syscall is missing, fails with +C. + +When specified, C<$siginfo> must be a reference to a hash with one or more +of the following members: + +=over + +=item code - the C member + +=item pid - the C member + +=item uid - the C member + +=item value_int - the C member + +=item value_ptr - the C member, specified as an integer + +=back + +Example: send a SIGKILL to the specified process. + + my $status = IO::AIO::pidfd_send_signal $pidfh, 9, undef + and die "pidfd_send_signal: $!\n"; + +Example: send a SIGKILL to the specified process with extra data. + + my $status = IO::AIO::pidfd_send_signal $pidfh, 9, { code => -1, value_int => 7 } + and die "pidfd_send_signal: $!\n"; + +=item $fh = IO::AIO::pidfd_getfd $pidfh, $targetfd[, $flags] + +This is an interface to the Linux L system call. The default +for C<$flags> is C<0>. + +On success, returns a dup'ed copy of the target file descriptor (specified +as an integer) returned (that is already set to close-on-exec), otherwise +returns C. If the syscall is missing, fails with C. + +Example: get a copy of standard error of another process and print soemthing to it. + + my $errfh = IO::AIO::pidfd_getfd $pidfh, 2 + or die "pidfd_getfd: $!\n"; + print $errfh "stderr\n"; + =item $fh = IO::AIO::eventfd [$initval, [$flags]] This is a direct interface to the Linux L system call. The