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

Comparing IO-AIO/AIO.pm (file contents):
Revision 1.306 by root, Wed Oct 16 09:11:35 2019 UTC vs.
Revision 1.308 by root, Tue Dec 29 15:16:27 2020 UTC

280 IO::AIO::nreqs 280 IO::AIO::nreqs
281 IO::AIO::nready 281 IO::AIO::nready
282 IO::AIO::npending 282 IO::AIO::npending
283 IO::AIO::reinit 283 IO::AIO::reinit
284 284
285 $nfd = IO::AIO::get_fdlimit [EXPERIMENTAL] 285 $nfd = IO::AIO::get_fdlimit
286 IO::AIO::min_fdlimit $nfd [EXPERIMENTAL] 286 IO::AIO::min_fdlimit $nfd
287 287
288 IO::AIO::sendfile $ofh, $ifh, $offset, $count 288 IO::AIO::sendfile $ofh, $ifh, $offset, $count
289 IO::AIO::fadvise $fh, $offset, $len, $advice 289 IO::AIO::fadvise $fh, $offset, $len, $advice
290 290
291 IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]] 291 IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]]
2220 2220
2221=over 4 2221=over 4
2222 2222
2223=item $numfd = IO::AIO::get_fdlimit 2223=item $numfd = IO::AIO::get_fdlimit
2224 2224
2225This function is I<EXPERIMENTAL> and subject to change.
2226
2227Tries to find the current file descriptor limit and returns it, or 2225Tries to find the current file descriptor limit and returns it, or
2228C<undef> and sets C<$!> in case of an error. The limit is one larger than 2226C<undef> and sets C<$!> in case of an error. The limit is one larger than
2229the highest valid file descriptor number. 2227the highest valid file descriptor number.
2230 2228
2231=item IO::AIO::min_fdlimit [$numfd] 2229=item IO::AIO::min_fdlimit [$numfd]
2232
2233This function is I<EXPERIMENTAL> and subject to change.
2234 2230
2235Try to increase the current file descriptor limit(s) to at least C<$numfd> 2231Try to increase the current file descriptor limit(s) to at least C<$numfd>
2236by changing the soft or hard file descriptor resource limit. If C<$numfd> 2232by changing the soft or hard file descriptor resource limit. If C<$numfd>
2237is missing, it will try to set a very high limit, although this is not 2233is missing, it will try to set a very high limit, although this is not
2238recommended when you know the actual minimum that you require. 2234recommended when you know the actual minimum that you require.
2413truncated. 2409truncated.
2414 2410
2415To accept name-less sockets, use C<undef> for C<$sockaddr> and C<0> for 2411To accept name-less sockets, use C<undef> for C<$sockaddr> and C<0> for
2416C<$sockaddr_maxlen>. 2412C<$sockaddr_maxlen>.
2417 2413
2418The main reasons to use this syscall rather than portable C«accept(2)> 2414The main reasons to use this syscall rather than portable C<accept(2)>
2419are that you can specify C<SOCK_NONBLOCK> and/or C<SOCK_CLOEXEC> 2415are that you can specify C<SOCK_NONBLOCK> and/or C<SOCK_CLOEXEC>
2420flags and you can accept name-less sockets by specifying C<0> for 2416flags and you can accept name-less sockets by specifying C<0> for
2421C<$sockaddr_maxlen>, which is sadly not possible with perl's interface to 2417C<$sockaddr_maxlen>, which is sadly not possible with perl's interface to
2422C<accept>. 2418C<accept>.
2423 2419
2488C<IO::AIO::MFD_ALLOW_SEALING> and C<IO::AIO::MFD_HUGETLB>. 2484C<IO::AIO::MFD_ALLOW_SEALING> and C<IO::AIO::MFD_HUGETLB>.
2489 2485
2490Example: create a new memfd. 2486Example: create a new memfd.
2491 2487
2492 my $fh = IO::AIO::memfd_create "somenameforprocfd", IO::AIO::MFD_CLOEXEC 2488 my $fh = IO::AIO::memfd_create "somenameforprocfd", IO::AIO::MFD_CLOEXEC
2493 or die "m,emfd_create: $!\n"; 2489 or die "memfd_create: $!\n";
2490
2491=item $fh = IO::AIO::pidfd_open $pid[, $flags]
2492
2493This is an interface to the Linux L<pidfd_open(2)> system call. The
2494default for C<$flags> is C<0>.
2495
2496On success, a new pidfd filehandle is returned (that is already set to
2497close-on-exec), otherwise returns C<undef>. If the syscall is missing,
2498fails with C<ENOSYS>.
2499
2500Example: open pid 6341 as pidfd.
2501
2502 my $fh = IO::AIO::pidfd_open 6341
2503 or die "pidfd_open: $!\n";
2504
2505=item $status = IO::AIO::pidfd_send_signal $pidfh, $signal[, $siginfo[, $flags]]
2506
2507This is an interface to the Linux L<pidfd_send_signal> system call. The
2508default for C<$siginfo> is C<undef> and the default for C<$flags> is C<0>.
2509
2510Returns the system call status. If the syscall is missing, fails with
2511C<ENOSYS>.
2512
2513When specified, C<$siginfo> must be a reference to a hash with one or more
2514of the following members:
2515
2516=over
2517
2518=item code - the C<si_code> member
2519
2520=item pid - the C<si_pid> member
2521
2522=item uid - the C<si_uid> member
2523
2524=item value_int - the C<si_value.sival_int> member
2525
2526=item value_ptr - the C<si_value.sival_ptr> member, specified as an integer
2527
2528=back
2529
2530Example: send a SIGKILL to the specified process.
2531
2532 my $status = IO::AIO::pidfd_send_signal $pidfh, 9, undef
2533 and die "pidfd_send_signal: $!\n";
2534
2535Example: send a SIGKILL to the specified process with extra data.
2536
2537 my $status = IO::AIO::pidfd_send_signal $pidfh, 9, { code => -1, value_int => 7 }
2538 and die "pidfd_send_signal: $!\n";
2539
2540=item $fh = IO::AIO::pidfd_getfd $pidfh, $targetfd[, $flags]
2541
2542This is an interface to the Linux L<pidfd_getfd> system call. The default
2543for C<$flags> is C<0>.
2544
2545On success, returns a dup'ed copy of the target file descriptor (specified
2546as an integer) returned (that is already set to close-on-exec), otherwise
2547returns C<undef>. If the syscall is missing, fails with C<ENOSYS>.
2548
2549Example: get a copy of standard error of another process and print soemthing to it.
2550
2551 my $errfh = IO::AIO::pidfd_getfd $pidfh, 2
2552 or die "pidfd_getfd: $!\n";
2553 print $errfh "stderr\n";
2554
2494=item $fh = IO::AIO::eventfd [$initval, [$flags]] 2555=item $fh = IO::AIO::eventfd [$initval, [$flags]]
2495 2556
2496This is a direct interface to the Linux L<eventfd(2)> system call. The 2557This is a direct interface to the Linux L<eventfd(2)> system call. The
2497(unhelpful) defaults for C<$initval> and C<$flags> are C<0> for both. 2558(unhelpful) defaults for C<$initval> and C<$flags> are C<0> for both.
2498 2559

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines