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.289 by root, Sun Aug 12 05:21:35 2018 UTC vs.
Revision 1.290 by root, Sun Aug 12 06:03:20 2018 UTC

171use common::sense; 171use common::sense;
172 172
173use base 'Exporter'; 173use base 'Exporter';
174 174
175BEGIN { 175BEGIN {
176 our $VERSION = 4.5; 176 our $VERSION = 4.51;
177 177
178 our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close 178 our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close
179 aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx 179 aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx
180 aio_scandir aio_symlink aio_readlink aio_realpath aio_fcntl aio_ioctl 180 aio_scandir aio_symlink aio_readlink aio_realpath aio_fcntl aio_ioctl
181 aio_sync aio_fsync aio_syncfs aio_fdatasync aio_sync_file_range 181 aio_sync aio_fsync aio_syncfs aio_fdatasync aio_sync_file_range
2037not supported or could not be detected, a fractional part of C<0> is 2037not supported or could not be detected, a fractional part of C<0> is
2038returned, so it is always safe to call these functions. 2038returned, so it is always safe to call these functions.
2039 2039
2040=over 4 2040=over 4
2041 2041
2042=item IO::AIO::stat_atime, IO::AIO::stat_mtime, IO::AIO::stat_ctime 2042=item $seconds = IO::AIO::st_atime, IO::AIO::st_mtime, IO::AIO::st_ctime
2043 2043
2044Return the access, modication or change time, respectively, including 2044Return the access, modication or change time, respectively, including
2045fractional part. Due to the limited precision of floating point, the 2045fractional part. Due to the limited precision of floating point, the
2046accuracy on most platforms is only a bit better than milliseconds for 2046accuracy on most platforms is only a bit better than milliseconds for
2047times around now - see the I<nsec> function family, below, for full 2047times around now - see the I<nsec> function family, below, for full
2048accuracy. 2048accuracy.
2049 2049
2050=item ($atime, $mtime, $ctime, ...) = IO::AIO::stat_xtime 2050=item ($atime, $mtime, $ctime, ...) = IO::AIO::st_xtime
2051 2051
2052Returns access, modification and change time all in one go, and maybe more 2052Returns access, modification and change time all in one go, and maybe more
2053times in the future version. 2053times in the future version.
2054 2054
2055=item IO::AIO::stat_atimensec, IO::AIO::stat_mtimensec, IO::AIO::stat_ctimensec 2055=item $nanoseconds = IO::AIO::st_atimensec, IO::AIO::st_mtimensec, IO::AIO::st_ctimensec
2056 2056
2057Return the fractional access, modifcation or change time, in nanoseconds, 2057Return the fractional access, modifcation or change time, in nanoseconds,
2058as an integer in the range C<0> to C<999999999>. 2058as an integer in the range C<0> to C<999999999>.
2059 2059
2060=item ($atime, $mtime, $ctime, ...) = IO::AIO::st_xtimensec
2061
2062Like the functions above, but returns all three times in one go (and maybe
2063more in future versions).
2064
2060=back 2065=back
2061 2066
2062Example: print the high resolution modification time of F</etc>, using 2067Example: print the high resolution modification time of F</etc>, using
2063C<stat>, and C<IO::AIO::aio_stat>. 2068C<stat>, and C<IO::AIO::aio_stat>.
2064 2069
2065 if (stat "/etc") { 2070 if (stat "/etc") {
2066 printf "stat(/etc) mtime: %f\n", IO::AIO::stat_mtime; 2071 printf "stat(/etc) mtime: %f\n", IO::AIO::st_mtime;
2067 } 2072 }
2068 2073
2069 IO::AIO::aio_stat "/etc", sub { 2074 IO::AIO::aio_stat "/etc", sub {
2070 $_[0] 2075 $_[0]
2071 and return; 2076 and return;
2072 2077
2073 printf "aio_stat(/etc) mtime: %d.%09d\n", (stat _)[9], IO::AIO::stat_mtimensec; 2078 printf "aio_stat(/etc) mtime: %d.%09d\n", (stat _)[9], IO::AIO::st_mtimensec;
2074 }; 2079 };
2075 2080
2076 IO::AIO::flush; 2081 IO::AIO::flush;
2077 2082
2078Output of the awbove on my system, showing reduced and full accuracy: 2083Output of the awbove on my system, showing reduced and full accuracy:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines