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

Comparing IO-AIO/README (file contents):
Revision 1.59 by root, Tue Feb 20 06:54:47 2018 UTC vs.
Revision 1.64 by root, Wed Apr 3 03:03:53 2019 UTC

221 IO::AIO::idle_timeout $seconds 221 IO::AIO::idle_timeout $seconds
222 IO::AIO::max_outstanding $maxreqs 222 IO::AIO::max_outstanding $maxreqs
223 IO::AIO::nreqs 223 IO::AIO::nreqs
224 IO::AIO::nready 224 IO::AIO::nready
225 IO::AIO::npending 225 IO::AIO::npending
226 IO::AIO::reinit
227
226 $nfd = IO::AIO::get_fdlimit [EXPERIMENTAL] 228 $nfd = IO::AIO::get_fdlimit [EXPERIMENTAL]
227 IO::AIO::min_fdlimit $nfd [EXPERIMENTAL] 229 IO::AIO::min_fdlimit $nfd [EXPERIMENTAL]
228 230
229 IO::AIO::sendfile $ofh, $ifh, $offset, $count 231 IO::AIO::sendfile $ofh, $ifh, $offset, $count
230 IO::AIO::fadvise $fh, $offset, $len, $advice 232 IO::AIO::fadvise $fh, $offset, $len, $advice
233
231 IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]] 234 IO::AIO::mmap $scalar, $length, $prot, $flags[, $fh[, $offset]]
232 IO::AIO::munmap $scalar 235 IO::AIO::munmap $scalar
236 IO::AIO::mremap $scalar, $new_length, $flags[, $new_address]
233 IO::AIO::madvise $scalar, $offset, $length, $advice 237 IO::AIO::madvise $scalar, $offset, $length, $advice
234 IO::AIO::mprotect $scalar, $offset, $length, $protect 238 IO::AIO::mprotect $scalar, $offset, $length, $protect
235 IO::AIO::munlock $scalar, $offset = 0, $length = undef 239 IO::AIO::munlock $scalar, $offset = 0, $length = undef
236 IO::AIO::munlockall 240 IO::AIO::munlockall
241
242 # stat extensions
243 $counter = IO::AIO::st_gen
244 $seconds = IO::AIO::st_atime, IO::AIO::st_mtime, IO::AIO::st_ctime, IO::AIO::st_btime
245 ($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtime
246 $nanoseconds = IO::AIO::st_atimensec, IO::AIO::st_mtimensec, IO::AIO::st_ctimensec, IO::AIO::st_btimensec
247 $seconds = IO::AIO::st_btimesec
248 ($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtimensec
249
250 # very much unportable syscalls
251 IO::AIO::splice $r_fh, $r_off, $w_fh, $w_off, $length, $flags
252 IO::AIO::tee $r_fh, $w_fh, $length, $flags
253 $actual_size = IO::AIO::pipesize $r_fh[, $new_size]
254 ($rfh, $wfh) = IO::AIO::pipe2 [$flags]
255 $fh = IO::AIO::memfd_create $pathname[, $flags]
256 $fh = IO::AIO::eventfd [$initval, [$flags]]
257 $fh = IO::AIO::timerfd_create $clockid[, $flags]
258 ($cur_interval, $cur_value) = IO::AIO::timerfd_settime $fh, $flags, $new_interval, $nbw_value
259 ($cur_interval, $cur_value) = IO::AIO::timerfd_gettime $fh
237 260
238 API NOTES 261 API NOTES
239 All the "aio_*" calls are more or less thin wrappers around the syscall 262 All the "aio_*" calls are more or less thin wrappers around the syscall
240 with the same name (sans "aio_"). The arguments are similar or 263 with the same name (sans "aio_"). The arguments are similar or
241 identical, and they all accept an additional (and optional) $callback 264 identical, and they all accept an additional (and optional) $callback
339 "O_APPEND"), the following POSIX and non-POSIX constants are 362 "O_APPEND"), the following POSIX and non-POSIX constants are
340 available (missing ones on your system are, as usual, 0): 363 available (missing ones on your system are, as usual, 0):
341 364
342 "O_ASYNC", "O_DIRECT", "O_NOATIME", "O_CLOEXEC", "O_NOCTTY", 365 "O_ASYNC", "O_DIRECT", "O_NOATIME", "O_CLOEXEC", "O_NOCTTY",
343 "O_NOFOLLOW", "O_NONBLOCK", "O_EXEC", "O_SEARCH", "O_DIRECTORY", 366 "O_NOFOLLOW", "O_NONBLOCK", "O_EXEC", "O_SEARCH", "O_DIRECTORY",
344 "O_DSYNC", "O_RSYNC", "O_SYNC", "O_PATH", "O_TMPFILE", and 367 "O_DSYNC", "O_RSYNC", "O_SYNC", "O_PATH", "O_TMPFILE", "O_TTY_INIT"
345 "O_TTY_INIT". 368 and "O_ACCMODE".
346 369
347 aio_close $fh, $callback->($status) 370 aio_close $fh, $callback->($status)
348 Asynchronously close a file and call the callback with the result 371 Asynchronously close a file and call the callback with the result
349 code. 372 code.
350 373
468 will be emulated by simply reading the data, which would have a 491 will be emulated by simply reading the data, which would have a
469 similar effect. 492 similar effect.
470 493
471 aio_stat $fh_or_path, $callback->($status) 494 aio_stat $fh_or_path, $callback->($status)
472 aio_lstat $fh, $callback->($status) 495 aio_lstat $fh, $callback->($status)
473 Works like perl's "stat" or "lstat" in void context. The callback 496 Works almost exactly like perl's "stat" or "lstat" in void context.
474 will be called after the stat and the results will be available 497 The callback will be called after the stat and the results will be
475 using "stat _" or "-s _" etc... 498 available using "stat _" or "-s _" and other tests (with the
499 exception of "-B" and "-T").
476 500
477 The pathname passed to "aio_stat" must be absolute. See API NOTES, 501 The pathname passed to "aio_stat" must be absolute. See API NOTES,
478 above, for an explanation. 502 above, for an explanation.
479 503
480 Currently, the stats are always 64-bit-stats, i.e. instead of 504 Currently, the stats are always 64-bit-stats, i.e. instead of
488 back on traditional behaviour). 512 back on traditional behaviour).
489 513
490 "S_IFMT", "S_IFIFO", "S_IFCHR", "S_IFBLK", "S_IFLNK", "S_IFREG", 514 "S_IFMT", "S_IFIFO", "S_IFCHR", "S_IFBLK", "S_IFLNK", "S_IFREG",
491 "S_IFDIR", "S_IFWHT", "S_IFSOCK", "IO::AIO::major $dev_t", 515 "S_IFDIR", "S_IFWHT", "S_IFSOCK", "IO::AIO::major $dev_t",
492 "IO::AIO::minor $dev_t", "IO::AIO::makedev $major, $minor". 516 "IO::AIO::minor $dev_t", "IO::AIO::makedev $major, $minor".
517
518 To access higher resolution stat timestamps, see "SUBSECOND STAT
519 TIME ACCESS".
493 520
494 Example: Print the length of /etc/passwd: 521 Example: Print the length of /etc/passwd:
495 522
496 aio_stat "/etc/passwd", sub { 523 aio_stat "/etc/passwd", sub {
497 $_[0] and die "stat failed: $!"; 524 $_[0] and die "stat failed: $!";
544 aio_utime $fh_or_path, $atime, $mtime, $callback->($status) 571 aio_utime $fh_or_path, $atime, $mtime, $callback->($status)
545 Works like perl's "utime" function (including the special case of 572 Works like perl's "utime" function (including the special case of
546 $atime and $mtime being undef). Fractional times are supported if 573 $atime and $mtime being undef). Fractional times are supported if
547 the underlying syscalls support them. 574 the underlying syscalls support them.
548 575
549 When called with a pathname, uses utimes(2) if available, otherwise 576 When called with a pathname, uses utimensat(2) or utimes(2) if
550 utime(2). If called on a file descriptor, uses futimes(2) if 577 available, otherwise utime(2). If called on a file descriptor, uses
551 available, otherwise returns ENOSYS, so this is not portable. 578 futimens(2) or futimes(2) if available, otherwise returns ENOSYS, so
579 this is not portable.
552 580
553 Examples: 581 Examples:
554 582
555 # set atime and mtime to current time (basically touch(1)): 583 # set atime and mtime to current time (basically touch(1)):
556 aio_utime "path", undef, undef; 584 aio_utime "path", undef, undef;
686 The flags are a combination of the following constants, ORed 714 The flags are a combination of the following constants, ORed
687 together (the flags will also be passed to the callback, possibly 715 together (the flags will also be passed to the callback, possibly
688 modified): 716 modified):
689 717
690 IO::AIO::READDIR_DENTS 718 IO::AIO::READDIR_DENTS
691 When this flag is off, then the callback gets an arrayref 719 Normally the callback gets an arrayref consisting of names only
692 consisting of names only (as with "aio_readdir"), otherwise it 720 (as with "aio_readdir"). If this flag is set, then the callback
693 gets an arrayref with "[$name, $type, $inode]" arrayrefs, each 721 gets an arrayref with "[$name, $type, $inode]" arrayrefs, each
694 describing a single directory entry in more detail. 722 describing a single directory entry in more detail:
695 723
696 $name is the name of the entry. 724 $name is the name of the entry.
697 725
698 $type is one of the "IO::AIO::DT_xxx" constants: 726 $type is one of the "IO::AIO::DT_xxx" constants:
699 727
700 "IO::AIO::DT_UNKNOWN", "IO::AIO::DT_FIFO", "IO::AIO::DT_CHR", 728 "IO::AIO::DT_UNKNOWN", "IO::AIO::DT_FIFO", "IO::AIO::DT_CHR",
701 "IO::AIO::DT_DIR", "IO::AIO::DT_BLK", "IO::AIO::DT_REG", 729 "IO::AIO::DT_DIR", "IO::AIO::DT_BLK", "IO::AIO::DT_REG",
702 "IO::AIO::DT_LNK", "IO::AIO::DT_SOCK", "IO::AIO::DT_WHT". 730 "IO::AIO::DT_LNK", "IO::AIO::DT_SOCK", "IO::AIO::DT_WHT".
703 731
704 "IO::AIO::DT_UNKNOWN" means just that: readdir does not know. If 732 "IO::AIO::DT_UNKNOWN" means just that: readdir does not know. If
705 you need to know, you have to run stat yourself. Also, for speed 733 you need to know, you have to run stat yourself. Also, for
706 reasons, the $type scalars are read-only: you can not modify 734 speed/memory reasons, the $type scalars are read-only: you must
707 them. 735 not modify them.
708 736
709 $inode is the inode number (which might not be exact on systems 737 $inode is the inode number (which might not be exact on systems
710 with 64 bit inode numbers and 32 bit perls). This field has 738 with 64 bit inode numbers and 32 bit perls). This field has
711 unspecified content on systems that do not deliver the inode 739 unspecified content on systems that do not deliver the inode
712 information. 740 information.
724 of which names with short names are tried first. 752 of which names with short names are tried first.
725 753
726 IO::AIO::READDIR_STAT_ORDER 754 IO::AIO::READDIR_STAT_ORDER
727 When this flag is set, then the names will be returned in an 755 When this flag is set, then the names will be returned in an
728 order suitable for stat()'ing each one. That is, when you plan 756 order suitable for stat()'ing each one. That is, when you plan
729 to stat() all files in the given directory, then the returned 757 to stat() most or all files in the given directory, then the
730 order will likely be fastest. 758 returned order will likely be faster.
731 759
732 If both this flag and "IO::AIO::READDIR_DIRS_FIRST" are 760 If both this flag and "IO::AIO::READDIR_DIRS_FIRST" are
733 specified, then the likely dirs come first, resulting in a less 761 specified, then the likely dirs come first, resulting in a less
734 optimal stat order. 762 optimal stat order for stat'ing all entries, but likely a more
763 optimal order for finding subdirectories.
735 764
736 IO::AIO::READDIR_FOUND_UNKNOWN 765 IO::AIO::READDIR_FOUND_UNKNOWN
737 This flag should not be set when calling "aio_readdirx". 766 This flag should not be set when calling "aio_readdirx".
738 Instead, it is being set by "aio_readdirx", when any of the 767 Instead, it is being set by "aio_readdirx", when any of the
739 $type's found were "IO::AIO::DT_UNKNOWN". The absence of this 768 $type's found were "IO::AIO::DT_UNKNOWN". The absence of this
1009 IO::AIO::mmap $data, -s $fh, IO::AIO::PROT_READ, IO::AIO::MAP_SHARED, $fh; 1038 IO::AIO::mmap $data, -s $fh, IO::AIO::PROT_READ, IO::AIO::MAP_SHARED, $fh;
1010 aio_mlock $data; # mlock in background 1039 aio_mlock $data; # mlock in background
1011 1040
1012 aio_mlockall $flags, $callback->($status) 1041 aio_mlockall $flags, $callback->($status)
1013 Calls the "mlockall" function with the given $flags (a combination 1042 Calls the "mlockall" function with the given $flags (a combination
1014 of "IO::AIO::MCL_CURRENT" and "IO::AIO::MCL_FUTURE"). 1043 of "IO::AIO::MCL_CURRENT", "IO::AIO::MCL_FUTURE" and
1044 "IO::AIO::MCL_ONFAULT").
1015 1045
1016 On systems that do not implement "mlockall", this function returns 1046 On systems that do not implement "mlockall", this function returns
1017 -1 and sets errno to "ENOSYS". 1047 -1 and sets errno to "ENOSYS". Similarly, flag combinations not
1048 supported by the system result in a return value of -1 with errno
1049 being set to "EINVAL".
1018 1050
1019 Note that the corresponding "munlockall" is synchronous and is 1051 Note that the corresponding "munlockall" is synchronous and is
1020 documented under "MISCELLANEOUS FUNCTIONS". 1052 documented under "MISCELLANEOUS FUNCTIONS".
1021 1053
1022 Example: asynchronously lock all current and future pages into 1054 Example: asynchronously lock all current and future pages into
1446 Strictly equivalent to: 1478 Strictly equivalent to:
1447 1479
1448 IO::AIO::poll_wait, IO::AIO::poll_cb 1480 IO::AIO::poll_wait, IO::AIO::poll_cb
1449 while IO::AIO::nreqs; 1481 while IO::AIO::nreqs;
1450 1482
1483 This function can be useful at program aborts, to make sure
1484 outstanding I/O has been done ("IO::AIO" uses an "END" block which
1485 already calls this function on normal exits), or when you are merely
1486 using "IO::AIO" for its more advanced functions, rather than for
1487 async I/O, e.g.:
1488
1489 my ($dirs, $nondirs);
1490 IO::AIO::aio_scandir "/tmp", 0, sub { ($dirs, $nondirs) = @_ };
1491 IO::AIO::flush;
1492 # $dirs, $nondirs are now set
1493
1451 IO::AIO::max_poll_reqs $nreqs 1494 IO::AIO::max_poll_reqs $nreqs
1452 IO::AIO::max_poll_time $seconds 1495 IO::AIO::max_poll_time $seconds
1453 These set the maximum number of requests (default 0, meaning 1496 These set the maximum number of requests (default 0, meaning
1454 infinity) that are being processed by "IO::AIO::poll_cb" in one 1497 infinity) that are being processed by "IO::AIO::poll_cb" in one
1455 call, respectively the maximum amount of time (default 0, meaning 1498 call, respectively the maximum amount of time (default 0, meaning
1587 executed). 1630 executed).
1588 1631
1589 IO::AIO::npending 1632 IO::AIO::npending
1590 Returns the number of requests currently in the pending state 1633 Returns the number of requests currently in the pending state
1591 (executed, but not yet processed by poll_cb). 1634 (executed, but not yet processed by poll_cb).
1635
1636 SUBSECOND STAT TIME ACCESS
1637 Both "aio_stat"/"aio_lstat" and perl's "stat"/"lstat" functions can
1638 generally find access/modification and change times with subsecond time
1639 accuracy of the system supports it, but perl's built-in functions only
1640 return the integer part.
1641
1642 The following functions return the timestamps of the most recent stat
1643 with subsecond precision on most systems and work both after
1644 "aio_stat"/"aio_lstat" and perl's "stat"/"lstat" calls. Their return
1645 value is only meaningful after a successful "stat"/"lstat" call, or
1646 during/after a successful "aio_stat"/"aio_lstat" callback.
1647
1648 This is similar to the Time::HiRes "stat" functions, but can return full
1649 resolution without rounding and work with standard perl "stat",
1650 alleviating the need to call the special "Time::HiRes" functions, which
1651 do not act like their perl counterparts.
1652
1653 On operating systems or file systems where subsecond time resolution is
1654 not supported or could not be detected, a fractional part of 0 is
1655 returned, so it is always safe to call these functions.
1656
1657 $seconds = IO::AIO::st_atime, IO::AIO::st_mtime, IO::AIO::st_ctime,
1658 IO::AIO::st_btime
1659 Return the access, modication, change or birth time, respectively,
1660 including fractional part. Due to the limited precision of floating
1661 point, the accuracy on most platforms is only a bit better than
1662 milliseconds for times around now - see the *nsec* function family,
1663 below, for full accuracy.
1664
1665 File birth time is only available when the OS and perl support it
1666 (on FreeBSD and NetBSD at the time of this writing, although support
1667 is adaptive, so if your OS/perl gains support, IO::AIO can take
1668 advantage of it). On systems where it isn't available, 0 is
1669 currently returned, but this might change to "undef" in a future
1670 version.
1671
1672 ($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtime
1673 Returns access, modification, change and birth time all in one go,
1674 and maybe more times in the future version.
1675
1676 $nanoseconds = IO::AIO::st_atimensec, IO::AIO::st_mtimensec,
1677 IO::AIO::st_ctimensec, IO::AIO::st_btimensec
1678 Return the fractional access, modifcation, change or birth time, in
1679 nanoseconds, as an integer in the range 0 to 999999999.
1680
1681 Note that no accessors are provided for access, modification and
1682 change times - you need to get those from "stat _" if required ("int
1683 IO::AIO::st_atime" and so on will *not* generally give you the
1684 correct value).
1685
1686 $seconds = IO::AIO::st_btimesec
1687 The (integral) seconds part of the file birth time, if available.
1688
1689 ($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtimensec
1690 Like the functions above, but returns all four times in one go (and
1691 maybe more in future versions).
1692
1693 $counter = IO::AIO::st_gen
1694 Returns the generation counter (in practice this is just a random
1695 number) of the file. This is only available on platforms which have
1696 this member in their "struct stat" (most BSDs at the time of this
1697 writing) and generally only to the root usert. If unsupported, 0 is
1698 returned, but this might change to "undef" in a future version.
1699
1700 Example: print the high resolution modification time of /etc, using
1701 "stat", and "IO::AIO::aio_stat".
1702
1703 if (stat "/etc") {
1704 printf "stat(/etc) mtime: %f\n", IO::AIO::st_mtime;
1705 }
1706
1707 IO::AIO::aio_stat "/etc", sub {
1708 $_[0]
1709 and return;
1710
1711 printf "aio_stat(/etc) mtime: %d.%09d\n", (stat _)[9], IO::AIO::st_mtimensec;
1712 };
1713
1714 IO::AIO::flush;
1715
1716 Output of the awbove on my system, showing reduced and full accuracy:
1717
1718 stat(/etc) mtime: 1534043702.020808
1719 aio_stat(/etc) mtime: 1534043702.020807792
1592 1720
1593 MISCELLANEOUS FUNCTIONS 1721 MISCELLANEOUS FUNCTIONS
1594 IO::AIO implements some functions that are useful when you want to use 1722 IO::AIO implements some functions that are useful when you want to use
1595 some "Advanced I/O" function not available to in Perl, without going the 1723 some "Advanced I/O" function not available to in Perl, without going the
1596 "Asynchronous I/O" route. Many of these have an asynchronous "aio_*" 1724 "Asynchronous I/O" route. Many of these have an asynchronous "aio_*"
1724 my $fast_md5 = md5 $data; 1852 my $fast_md5 = md5 $data;
1725 1853
1726 IO::AIO::munmap $scalar 1854 IO::AIO::munmap $scalar
1727 Removes a previous mmap and undefines the $scalar. 1855 Removes a previous mmap and undefines the $scalar.
1728 1856
1857 IO::AIO::mremap $scalar, $new_length, $flags = MREMAP_MAYMOVE[,
1858 $new_address = 0]
1859 Calls the Linux-specific mremap(2) system call. The $scalar must
1860 have been mapped by "IO::AIO::mmap", and $flags must currently
1861 either be 0 or "IO::AIO::MREMAP_MAYMOVE".
1862
1863 Returns true if successful, and false otherwise. If the underlying
1864 mmapped region has changed address, then the true value has the
1865 numerical value 1, otherwise it has the numerical value 0:
1866
1867 my $success = IO::AIO::mremap $mmapped, 8192, IO::AIO::MREMAP_MAYMOVE
1868 or die "mremap: $!";
1869
1870 if ($success*1) {
1871 warn "scalar has chanegd address in memory\n";
1872 }
1873
1874 "IO::AIO::MREMAP_FIXED" and the $new_address argument are currently
1875 implemented, but not supported and might go away in a future
1876 version.
1877
1878 On systems where this call is not supported or is not emulated, this
1879 call returns falls and sets $! to "ENOSYS".
1880
1881 IO::AIO::mlockall $flags
1882 Calls the "eio_mlockall_sync" function, which is like
1883 "aio_mlockall", but is blocking.
1884
1729 IO::AIO::munlock $scalar, $offset = 0, $length = undef 1885 IO::AIO::munlock $scalar, $offset = 0, $length = undef
1730 Calls the "munlock" function, undoing the effects of a previous 1886 Calls the "munlock" function, undoing the effects of a previous
1731 "aio_mlock" call (see its description for details). 1887 "aio_mlock" call (see its description for details).
1732 1888
1733 IO::AIO::munlockall 1889 IO::AIO::munlockall
1783 Example: create a pipe race-free w.r.t. threads and fork: 1939 Example: create a pipe race-free w.r.t. threads and fork:
1784 1940
1785 my ($rfh, $wfh) = IO::AIO::pipe2 IO::AIO::O_CLOEXEC 1941 my ($rfh, $wfh) = IO::AIO::pipe2 IO::AIO::O_CLOEXEC
1786 or die "pipe2: $!\n"; 1942 or die "pipe2: $!\n";
1787 1943
1944 $fh = IO::AIO::memfd_create $pathname[, $flags]
1945 This is a direct interface to the Linux memfd_create(2) system call.
1946 The (unhelpful) default for $flags is 0, but your default should be
1947 "IO::AIO::MFD_CLOEXEC".
1948
1949 On success, the new memfd filehandle is returned, otherwise returns
1950 "undef". If the memfd_create syscall is missing, fails with
1951 "ENOSYS".
1952
1953 Please refer to memfd_create(2) for more info on this call.
1954
1955 The following $flags values are available: "IO::AIO::MFD_CLOEXEC",
1956 "IO::AIO::MFD_ALLOW_SEALING" and "IO::AIO::MFD_HUGETLB".
1957
1958 Example: create a new memfd.
1959
1960 my $fh = IO::AIO::memfd_create "somenameforprocfd", IO::AIO::MFD_CLOEXEC
1961 or die "m,emfd_create: $!\n";
1788 $fh = IO::AIO::eventfd [$initval, [$flags]] 1962 =item $fh = IO::AIO::eventfd [$initval, [$flags]]
1963
1789 This is a direct interface to the Linux eventfd(2) system call. The 1964 This is a direct interface to the Linux eventfd(2) system call. The
1790 (unhelpful) defaults for $initval and $flags are 0 for both. 1965 (unhelpful) defaults for $initval and $flags are 0 for both.
1791 1966
1792 On success, the new eventfd filehandle is returned, otherwise 1967 On success, the new eventfd filehandle is returned, otherwise
1793 returns "undef". If the eventfd syscall is missing, fails with 1968 returns "undef". If the eventfd syscall is missing, fails with
1799 "IO::AIO::EFD_CLOEXEC", "IO::AIO::EFD_NONBLOCK" and 1974 "IO::AIO::EFD_CLOEXEC", "IO::AIO::EFD_NONBLOCK" and
1800 "IO::AIO::EFD_SEMAPHORE" (Linux 2.6.30). 1975 "IO::AIO::EFD_SEMAPHORE" (Linux 2.6.30).
1801 1976
1802 Example: create a new eventfd filehandle: 1977 Example: create a new eventfd filehandle:
1803 1978
1804 $fh = IO::AIO::eventfd 0, IO::AIO::O_CLOEXEC 1979 $fh = IO::AIO::eventfd 0, IO::AIO::EFD_CLOEXEC
1805 or die "eventfd: $!\n"; 1980 or die "eventfd: $!\n";
1806 1981
1807 $fh = IO::AIO::timerfd_create $clockid[, $flags] 1982 $fh = IO::AIO::timerfd_create $clockid[, $flags]
1808 This is a direct interface to the Linux timerfd_create(2) system 1983 This is a direct interface to the Linux timerfd_create(2) system
1809 call. The (unhelpful) default for $flags is 0. 1984 call. The (unhelpful) default for $flags is 0, but your default
1985 should be "IO::AIO::TFD_CLOEXEC".
1810 1986
1811 On success, the new timerfd filehandle is returned, otherwise 1987 On success, the new timerfd filehandle is returned, otherwise
1812 returns "undef". If the eventfd syscall is missing, fails with 1988 returns "undef". If the timerfd_create syscall is missing, fails
1813 "ENOSYS". 1989 with "ENOSYS".
1814 1990
1815 Please refer to timerfd_create(2) for more info on this call. 1991 Please refer to timerfd_create(2) for more info on this call.
1816 1992
1817 The following $clockid values are available: 1993 The following $clockid values are available:
1818 "IO::AIO::CLOCK_REALTIME", "IO::AIO::CLOCK_MONOTONIC" 1994 "IO::AIO::CLOCK_REALTIME", "IO::AIO::CLOCK_MONOTONIC"

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines