Commit 8f9de614 authored by gregor herrmann's avatar gregor herrmann

Update upstream source from tag 'upstream/4.60'

Update to upstream version '4.60'
with Debian dir 3d169e38a16933bd8c5916b1edc5bebb3bb2ff43
parents 626447c0 b7267b79
......@@ -173,7 +173,7 @@ use common::sense;
use base 'Exporter';
BEGIN {
our $VERSION = 4.5;
our $VERSION = 4.6;
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
......@@ -543,9 +543,10 @@ be emulated by simply reading the data, which would have a similar effect.
=item aio_lstat $fh, $callback->($status)
Works like perl's C<stat> or C<lstat> in void context. The callback will
be called after the stat and the results will be available using C<stat _>
or C<-s _> etc...
Works almost exactly like perl's C<stat> or C<lstat> in void context. The
callback will be called after the stat and the results will be available
using C<stat _> or C<-s _> and other tests (with the exception of C<-B>
and C<-T>).
The pathname passed to C<aio_stat> must be absolute. See API NOTES, above,
for an explanation.
......@@ -563,6 +564,9 @@ C<S_IFMT>, C<S_IFIFO>, C<S_IFCHR>, C<S_IFBLK>, C<S_IFLNK>, C<S_IFREG>,
C<S_IFDIR>, C<S_IFWHT>, C<S_IFSOCK>, C<IO::AIO::major $dev_t>,
C<IO::AIO::minor $dev_t>, C<IO::AIO::makedev $major, $minor>.
To access higher resolution stat timestamps, see L<SUBSECOND STAT TIME
ACCESS>.
Example: Print the length of F</etc/passwd>:
aio_stat "/etc/passwd", sub {
......@@ -621,9 +625,10 @@ Works like perl's C<utime> function (including the special case of $atime
and $mtime being undef). Fractional times are supported if the underlying
syscalls support them.
When called with a pathname, uses utimes(2) if available, otherwise
utime(2). If called on a file descriptor, uses futimes(2) if available,
otherwise returns ENOSYS, so this is not portable.
When called with a pathname, uses utimensat(2) or utimes(2) if available,
otherwise utime(2). If called on a file descriptor, uses futimens(2)
or futimes(2) if available, otherwise returns ENOSYS, so this is not
portable.
Examples:
......@@ -1781,6 +1786,7 @@ automatically bumps it up to C<2>.
=back
=head2 SUPPORT FUNCTIONS
=head3 EVENT PROCESSING AND EVENT LOOP INTEGRATION
......@@ -1855,6 +1861,16 @@ Strictly equivalent to:
IO::AIO::poll_wait, IO::AIO::poll_cb
while IO::AIO::nreqs;
This function can be useful at program aborts, to make sure outstanding
I/O has been done (C<IO::AIO> uses an C<END> block which already calls
this function on normal exits), or when you are merely using C<IO::AIO>
for its more advanced functions, rather than for async I/O, e.g.:
my ($dirs, $nondirs);
IO::AIO::aio_scandir "/tmp", 0, sub { ($dirs, $nondirs) = @_ };
IO::AIO::flush;
# $dirs, $nondirs are now set
=item IO::AIO::max_poll_reqs $nreqs
=item IO::AIO::max_poll_time $seconds
......@@ -1890,6 +1906,7 @@ program get the CPU sometimes even under high AIO load.
=back
=head3 CONTROLLING THE NUMBER OF THREADS
=over
......@@ -1986,6 +2003,7 @@ practical limit on the number of outstanding requests.
=back
=head3 STATISTICAL INFORMATION
=over
......@@ -2012,6 +2030,101 @@ but not yet processed by poll_cb).
=back
=head3 SUBSECOND STAT TIME ACCESS
Both C<aio_stat>/C<aio_lstat> and perl's C<stat>/C<lstat> functions can
generally find access/modification and change times with subsecond time
accuracy of the system supports it, but perl's built-in functions only
return the integer part.
The following functions return the timestamps of the most recent
stat with subsecond precision on most systems and work both after
C<aio_stat>/C<aio_lstat> and perl's C<stat>/C<lstat> calls. Their return
value is only meaningful after a successful C<stat>/C<lstat> call, or
during/after a successful C<aio_stat>/C<aio_lstat> callback.
This is similar to the L<Time::HiRes> C<stat> functions, but can return
full resolution without rounding and work with standard perl C<stat>,
alleviating the need to call the special C<Time::HiRes> functions, which
do not act like their perl counterparts.
On operating systems or file systems where subsecond time resolution is
not supported or could not be detected, a fractional part of C<0> is
returned, so it is always safe to call these functions.
=over 4
=item $seconds = IO::AIO::st_atime, IO::AIO::st_mtime, IO::AIO::st_ctime, IO::AIO::st_btime
Return the access, modication, change or birth time, respectively,
including fractional part. Due to the limited precision of floating point,
the accuracy on most platforms is only a bit better than milliseconds
for times around now - see the I<nsec> function family, below, for full
accuracy.
File birth time is only available when the OS and perl support it (on
FreeBSD and NetBSD at the time of this writing, although support is
adaptive, so if your OS/perl gains support, IO::AIO can take avdantage of
it). On systems where it isn't available, C<0> is currently returned, but
this might change to C<undef> in a future version.
=item ($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtime
Returns access, modification, change and birth time all in one go, and
maybe more times in the future version.
=item $nanoseconds = IO::AIO::st_atimensec, IO::AIO::st_mtimensec, IO::AIO::st_ctimensec, IO::AIO::st_btimensec
Return the fractional access, modifcation, change or birth time, in nanoseconds,
as an integer in the range C<0> to C<999999999>.
Note that no accessors are provided for access, modification and
change times - you need to get those from C<stat _> if required (C<int
IO::AIO::st_atime> and so on will I<not> generally give you the correct
value).
=item $seconds = IO::AIO::st_btimesec
The (integral) seconds part of the file birth time, if available.
=item ($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtimensec
Like the functions above, but returns all four times in one go (and maybe
more in future versions).
=item $counter = IO::AIO::st_gen
Returns the generation counter of the file. This is only available on
platforms which have this member in their C<struct stat> (most BSDs
at the time of this writing) and generally only to the root usert. If
unsupported, C<0> is returned, but this might change to C<undef> in a
future version.
=back
Example: print the high resolution modification time of F</etc>, using
C<stat>, and C<IO::AIO::aio_stat>.
if (stat "/etc") {
printf "stat(/etc) mtime: %f\n", IO::AIO::st_mtime;
}
IO::AIO::aio_stat "/etc", sub {
$_[0]
and return;
printf "aio_stat(/etc) mtime: %d.%09d\n", (stat _)[9], IO::AIO::st_mtimensec;
};
IO::AIO::flush;
Output of the awbove on my system, showing reduced and full accuracy:
stat(/etc) mtime: 1534043702.020808
aio_stat(/etc) mtime: 1534043702.020807792
=head3 MISCELLANEOUS FUNCTIONS
IO::AIO implements some functions that are useful when you want to use
......
......@@ -20,6 +20,12 @@
#include <fcntl.h>
#include <sched.h>
#if HAVE_SYS_MKDEV_H
# include <sys/mkdev.h>
#elif HAVE_SYS_SYSMACROS_H
# include <sys/sysmacros.h>
#endif
#if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES
# include <sys/mman.h>
#endif
......@@ -80,6 +86,7 @@
#undef dup2
#undef abort
#undef pipe
#undef utime
#define EIO_STRUCT_STAT struct _stati64
#define EIO_STRUCT_STATI64
......@@ -109,7 +116,38 @@
/*****************************************************************************/
#include "libeio/config.h"
#include "config.h"
#if HAVE_ST_XTIMENSEC
# define ATIMENSEC PL_statcache.st_atimensec
# define MTIMENSEC PL_statcache.st_mtimensec
# define CTIMENSEC PL_statcache.st_ctimensec
#elif HAVE_ST_XTIMESPEC
# define ATIMENSEC PL_statcache.st_atim.tv_nsec
# define MTIMENSEC PL_statcache.st_mtim.tv_nsec
# define CTIMENSEC PL_statcache.st_ctim.tv_nsec
#else
# define ATIMENSEC 0
# define MTIMENSEC 0
# define CTIMENSEC 0
#endif
#if HAVE_ST_BIRTHTIMENSEC
# define BTIMESEC PL_statcache.st_birthtime
# define BTIMENSEC PL_statcache.st_birthtimensec
#elif HAVE_ST_BIRTHTIMESPEC
# define BTIMESEC PL_statcache.st_birthtim.tv_sec
# define BTIMENSEC PL_statcache.st_birthtim.tv_nsec
#else
# define BTIMESEC 0
# define BTIMENSEC 0
#endif
#if HAVE_ST_GEN
# define ST_GEN PL_statcache.st_gen
#else
# define ST_GEN 0
#endif
#include "schmorp.h"
......@@ -176,6 +214,11 @@ static void req_destroy (eio_req *grp);
# define minor(dev) ((dev) & 0xff)
#endif
/* solaris has a non-posix/unix compliant PAGESIZE that breaks compilation */
#ifdef __sun
# undef PAGESIZE
#endif
#if PAGESIZE <= 0
# define PAGESIZE sysconf (_SC_PAGESIZE)
#endif
......@@ -381,6 +424,8 @@ done:
/*****************************************************************************/
static int close_fd; /* dummy fd to close fds via dup2 */
enum {
FLAG_SV2_RO_OFF = 0x40, /* data was set readonly */
};
......@@ -1278,6 +1323,24 @@ BOOT:
newCONSTSUB (aio_stash, "PAGESIZE", newSViv (PAGESIZE));
/* allocate dummy pipe fd for aio_close */
{
int pipefd [2];
if (
#ifdef _WIN32
_pipe (pipefd, 1, _O_BINARY) < 0
#else
pipe (pipefd) < 0
|| fcntl (pipefd [0], F_SETFD, FD_CLOEXEC) < 0
#endif
|| close (pipefd [1]) < 0
)
croak ("IO::AIO: unable to create dummy pipe for aio_close");
close_fd = pipefd [0];
}
reinit ();
}
......@@ -1409,28 +1472,9 @@ void
aio_close (SV *fh, SV *callback = &PL_sv_undef)
PPCODE:
{
static int close_fd = -1; /* dummy fd to close fds via dup2 */
int fd = s_fileno_croak (fh, 0);
dREQ;
if (expect_false (close_fd < 0))
{
int pipefd [2];
if (
#ifdef _WIN32
_pipe (pipefd, 1, _O_BINARY) < 0
#else
pipe (pipefd) < 0
|| fcntl (pipefd [0], F_SETFD, FD_CLOEXEC) < 0
#endif
|| close (pipefd [1]) < 0
)
abort (); /*D*/
close_fd = pipefd [0];
}
req->type = EIO_DUP2;
req->int1 = close_fd;
req->sv2 = newSVsv (fh);
......@@ -1615,6 +1659,40 @@ aio_stat (SV8 *fh_or_path, SV *callback = &PL_sv_undef)
REQ_SEND;
}
void
st_xtime ()
ALIAS:
st_atime = 0x01
st_mtime = 0x02
st_ctime = 0x04
st_btime = 0x08
st_xtime = 0x0f
PPCODE:
EXTEND (SP, 4);
if (ix & 0x01) PUSHs (newSVnv (PL_statcache.st_atime + 1e-9 * ATIMENSEC));
if (ix & 0x02) PUSHs (newSVnv (PL_statcache.st_mtime + 1e-9 * MTIMENSEC));
if (ix & 0x04) PUSHs (newSVnv (PL_statcache.st_ctime + 1e-9 * CTIMENSEC));
if (ix & 0x08) PUSHs (newSVnv (BTIMESEC + 1e-9 * BTIMENSEC));
void
st_xtimensec ()
ALIAS:
st_atimensec = 0x01
st_mtimensec = 0x02
st_ctimensec = 0x04
st_btimensec = 0x08
st_xtimensec = 0x0f
st_btimesec = 0x10
st_gen = 0x20
PPCODE:
EXTEND (SP, 4);
if (ix & 0x01) PUSHs (newSViv (ATIMENSEC));
if (ix & 0x02) PUSHs (newSViv (MTIMENSEC));
if (ix & 0x04) PUSHs (newSViv (CTIMENSEC));
if (ix & 0x08) PUSHs (newSViv (BTIMENSEC));
if (ix & 0x10) PUSHs (newSVuv (BTIMESEC));
if (ix & 0x20) PUSHs (newSVuv (ST_GEN));
UV
major (UV dev)
ALIAS:
......@@ -2109,7 +2187,7 @@ mremap (SV *scalar, STRLEN new_length, int flags = MREMAP_MAYMOVE, IV new_addres
RETVAL
int
madvise (SV *scalar, STRLEN offset = 0, SV *length = &PL_sv_undef, IV advice_or_prot)
madvise (SV *scalar, IV offset = 0, SV *length = &PL_sv_undef, IV advice_or_prot)
ALIAS:
mprotect = 1
CODE:
......@@ -2140,7 +2218,7 @@ madvise (SV *scalar, STRLEN offset = 0, SV *length = &PL_sv_undef, IV advice_or_
RETVAL
int
munlock (SV *scalar, STRLEN offset = 0, SV *length = &PL_sv_undef)
munlock (SV *scalar, IV offset = 0, SV *length = &PL_sv_undef)
CODE:
{
STRLEN svlen;
......
......@@ -30,12 +30,50 @@ TODO: copy_file_range, copy_file_range
TODO: FIDEDUPERANGE, file_ioctl.c
TODO: mincore
TODO: SOCK_CLOEXEc etc.
TODO: unlinkat flags, linkat flags, statat flags
TODO: unlinkat flags, linkat flags, statat, renameat2 flags
TODO: https://kernelnewbies.org/Linux_4.11
TODO: define useful rules for [[$wd, $path], $path] &c and implement them
TODO: https://github.com/coreutils/coreutils/blob/master/src/stat.c maybe IO::AIO::FSID
TODO: mlock2, MLOCK_ONFAULT
TODO: dup3, pipe2, accept4
TODO: dump config.log when automated testign and configure fails
4.6 Sat Aug 25 21:58:36 CEST 2018
- add st_btime, st_btimesec, st_btimensec and st_gen accessors,
mostly for bsds which expose birthtime and st_gen members (netbsd, freebsd
but only st_gen on openbsd because they compiled their perl without support
for birthtimes).
- fix madvise and munlock to properly support negative offsets.
- allocate fd for the aio_close at boot time, to guarantee it working
later, rather than calling abort when it fails. also avoids
close-on-exec race issues after module load.
- #undef utime on win32, maybe this helps some reports of utime hangs.
- minor doc improvements.
- minor configure cleanups.
- use $Config{perllibs} instead of libs for configure. might help people
who didn'T install all perl dependencies (might break things as well).
4.54 Tue Aug 14 13:54:48 CEST 2018
- include sys/mkdev.h or sys/sysmacros.h if available.
- further tweaks to configure invocation for systems requiring --rpath.
- no longer rely on custom paths on win32 platforms.
- try to work around buggy PAGESIZE macro on solaris.
4.53 Tue Aug 14 11:27:50 CEST 2018
- add $Config{libs} to LIBS for configure, to work around systems
with broken library dependencies (... openbsd).
4.52 Sun Aug 12 08:09:45 CEST 2018
- config.h.in was missing in distribution.
4.51 Sun Aug 12 07:24:14 CEST 2018
- complete rework of the autoconf framework: IO::AIO now uses its own
config.h, separate from libeio, and tries to test the actual perl
environment, not the standard system environment.
- provide nanosecond-accracy stat time accessors for both perl and IO::AIO
stat functions.
- removed non-portable C++ syntax from eio.c.
- try to fix readdir tests on cygwin spuriously failing.
4.5 Wed Aug 1 00:23:55 CEST 2018
- aio_mtouch touch all pages as requested, not just the first page in most cases.
......
......@@ -25,10 +25,10 @@ libeio/eio.h
libeio/eio.c
libeio/etp.c
libeio/libeio.m4
libeio/config.h.in
configure.ac
configure
config.h.in
autogen.sh
typemap
......
......@@ -38,6 +38,6 @@
}
},
"release_status" : "stable",
"version" : 4.5,
"version" : 4.6,
"x_serialization_backend" : "JSON::PP version 2.27300"
}
......@@ -20,5 +20,5 @@ no_index:
- inc
requires:
common::sense: '0'
version: 4.5
version: 4.6
x_serialization_backend: 'CPAN::Meta::YAML version 0.012'
......@@ -11,28 +11,23 @@ if ($^O eq "MSWin32") {
***
*** Your platform is not standards compliant. To get this module working, you need to
*** download and install win32 pthread (http://sourceware.org/pthreads-win32/)
*** in /gtk/{lib,include}
*** also, the windows SDK is expected to be installed in /sdk
*** and visual C is expected to be installed in /vc98
***
*** Alternatively, set the INC and LIBS environment variables
*** accordingly before running Makefile.PL, or you can
*** pass INC and LIBS arguments to Makefile.PL itself.
*** download and install win32 pthread (http://sourceware.org/pthreads-win32/).
***
EOF
if ($Config{cc} =~ /(?:^|\\|\/)gcc(?:|.*\.exe)$/) {
$INC = "$ENV{INC} -I/gtk/include";
$LIBS = ["$ENV{LIBS} -L/gtk/lib -lpthreadGC2"];
} else {
$INC = "$ENV{INC} -I/sdk/include -I/vc98/include -I/gtk/include";
$LIBS = ["$ENV{LIBS} -L/gtk/lib -lpthreadVC2"];
if(0){
if ($Config{cc} =~ /(?:^|\\|\/)gcc(?:|.*\.exe)$/) {
$INC = "$ENV{INC} -I/gtk/include";
$LIBS = ["$ENV{LIBS} -L/gtk/lib -lpthreadGC2"];
} else {
$INC = "$ENV{INC} -I/sdk/include -I/vc98/include -I/gtk/include";
$LIBS = ["$ENV{LIBS} -L/gtk/lib -lpthreadVC2"];
}
}
open my $fh, ">libeio/config.h"
or die "libeio/config.h: $!";
open my $fh, ">config.h"
or die "config.h: $!";
print $fh <<EOF;
EOF
......@@ -63,10 +58,11 @@ EOF
$ENV{MAKE} = $Config{make};
$ENV{SHELL} = $Config{sh};
$ENV{CC} = $Config{cc};
$ENV{CPPFLAGS} = $Config{cppflags};
$ENV{CPPFLAGS} = "$Config{cppflags} -I$Config{archlibexp}/CORE";
$ENV{CFLAGS} = $Config{ccflags};
$ENV{LDFLAGS} = $Config{ldflags};
$ENV{LDFLAGS} = "$Config{ldflags} $Config{ccdlflags}";
$ENV{LINKER} = $Config{ld}; # nonstandard
$ENV{LIBS} = "-L$Config{archlibexp}/CORE -L$Config{privlibexp} -lperl $Config{perllibs}";
system $ENV{SHELL}, -c => "./configure --prefix \Q$Config{prefixexp}\E"
and exit $? >> 8;
......@@ -100,7 +96,7 @@ my $mm = MM->new({
SUFFIX => '.gz',
},
depend => {
"AIO.c" => "schmorp.h libeio/eio.h libeio/xthread.h libeio/etp.c libeio/eio.c libeio/config.h",
"AIO.c" => "schmorp.h libeio/eio.h libeio/xthread.h libeio/etp.c libeio/eio.c config.h",
},
NAME => "IO::AIO",
VERSION_FROM => "AIO.pm",
......@@ -114,7 +110,7 @@ my $mm = MM->new({
PREREQ_PM => {
"common::sense" => 0,
},
clean => { FILES => "libeio/config.h libeio/config.log libeio/config.status" },
clean => { FILES => "config.h libeio/config.h libeio/config.log libeio/config.status" },
});
$mm->flush;
......
......@@ -471,9 +471,10 @@ FUNCTIONS
aio_stat $fh_or_path, $callback->($status)
aio_lstat $fh, $callback->($status)
Works like perl's "stat" or "lstat" in void context. The callback
will be called after the stat and the results will be available
using "stat _" or "-s _" etc...
Works almost exactly like perl's "stat" or "lstat" in void context.
The callback will be called after the stat and the results will be
available using "stat _" or "-s _" and other tests (with the
exception of "-B" and "-T").
The pathname passed to "aio_stat" must be absolute. See API NOTES,
above, for an explanation.
......@@ -492,6 +493,9 @@ FUNCTIONS
"S_IFDIR", "S_IFWHT", "S_IFSOCK", "IO::AIO::major $dev_t",
"IO::AIO::minor $dev_t", "IO::AIO::makedev $major, $minor".
To access higher resolution stat timestamps, see "SUBSECOND STAT
TIME ACCESS".
Example: Print the length of /etc/passwd:
aio_stat "/etc/passwd", sub {
......@@ -547,9 +551,10 @@ FUNCTIONS
$atime and $mtime being undef). Fractional times are supported if
the underlying syscalls support them.
When called with a pathname, uses utimes(2) if available, otherwise
utime(2). If called on a file descriptor, uses futimes(2) if
available, otherwise returns ENOSYS, so this is not portable.
When called with a pathname, uses utimensat(2) or utimes(2) if
available, otherwise utime(2). If called on a file descriptor, uses
futimens(2) or futimes(2) if available, otherwise returns ENOSYS, so
this is not portable.
Examples:
......@@ -1450,6 +1455,17 @@ FUNCTIONS
IO::AIO::poll_wait, IO::AIO::poll_cb
while IO::AIO::nreqs;
This function can be useful at program aborts, to make sure
outstanding I/O has been done ("IO::AIO" uses an "END" block which
already calls this function on normal exits), or when you are merely
using "IO::AIO" for its more advanced functions, rather than for
async I/O, e.g.:
my ($dirs, $nondirs);
IO::AIO::aio_scandir "/tmp", 0, sub { ($dirs, $nondirs) = @_ };
IO::AIO::flush;
# $dirs, $nondirs are now set
IO::AIO::max_poll_reqs $nreqs
IO::AIO::max_poll_time $seconds
These set the maximum number of requests (default 0, meaning
......@@ -1592,6 +1608,91 @@ FUNCTIONS
Returns the number of requests currently in the pending state
(executed, but not yet processed by poll_cb).
SUBSECOND STAT TIME ACCESS
Both "aio_stat"/"aio_lstat" and perl's "stat"/"lstat" functions can
generally find access/modification and change times with subsecond time
accuracy of the system supports it, but perl's built-in functions only
return the integer part.
The following functions return the timestamps of the most recent stat
with subsecond precision on most systems and work both after
"aio_stat"/"aio_lstat" and perl's "stat"/"lstat" calls. Their return
value is only meaningful after a successful "stat"/"lstat" call, or
during/after a successful "aio_stat"/"aio_lstat" callback.
This is similar to the Time::HiRes "stat" functions, but can return full
resolution without rounding and work with standard perl "stat",
alleviating the need to call the special "Time::HiRes" functions, which
do not act like their perl counterparts.
On operating systems or file systems where subsecond time resolution is
not supported or could not be detected, a fractional part of 0 is
returned, so it is always safe to call these functions.
$seconds = IO::AIO::st_atime, IO::AIO::st_mtime, IO::AIO::st_ctime,
IO::AIO::st_btime
Return the access, modication, change or birth time, respectively,
including fractional part. Due to the limited precision of floating
point, the accuracy on most platforms is only a bit better than
milliseconds for times around now - see the *nsec* function family,
below, for full accuracy.
File birth time is only available when the OS and perl support it
(on FreeBSD and NetBSD at the time of this writing, although support
is adaptive, so if your OS/perl gains support, IO::AIO can take
avdantage of it). On systems where it isn't available, 0 is
currently returned, but this might change to "undef" in a future
version.
($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtime
Returns access, modification, change and birth time all in one go,
and maybe more times in the future version.
$nanoseconds = IO::AIO::st_atimensec, IO::AIO::st_mtimensec,
IO::AIO::st_ctimensec, IO::AIO::st_btimensec
Return the fractional access, modifcation, change or birth time, in
nanoseconds, as an integer in the range 0 to 999999999.
Note that no accessors are provided for access, modification and
change times - you need to get those from "stat _" if required ("int
IO::AIO::st_atime" and so on will *not* generally give you the
correct value).
$seconds = IO::AIO::st_btimesec
The (integral) seconds part of the file birth time, if available.
($atime, $mtime, $ctime, $btime, ...) = IO::AIO::st_xtimensec
Like the functions above, but returns all four times in one go (and
maybe more in future versions).
$counter = IO::AIO::st_gen
Returns the generation counter of the file. This is only available
on platforms which have this member in their "struct stat" (most
BSDs at the time of this writing) and generally only to the root
usert. If unsupported, 0 is returned, but this might change to
"undef" in a future version.
Example: print the high resolution modification time of /etc, using
"stat", and "IO::AIO::aio_stat".
if (stat "/etc") {
printf "stat(/etc) mtime: %f\n", IO::AIO::st_mtime;
}
IO::AIO::aio_stat "/etc", sub {
$_[0]
and return;
printf "aio_stat(/etc) mtime: %d.%09d\n", (stat _)[9], IO::AIO::st_mtimensec;
};
IO::AIO::flush;
Output of the awbove on my system, showing reduced and full accuracy:
stat(/etc) mtime: 1534043702.020808
aio_stat(/etc) mtime: 1534043702.020807792
MISCELLANEOUS FUNCTIONS
IO::AIO implements some functions that are useful when you want to use
some "Advanced I/O" function not available to in Perl, without going the
......
/* libeio/config.h.in. Generated from configure.ac by autoheader. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* copy_file_range(2) is available */
#undef HAVE_COPY_FILE_RANGE
......@@ -69,9 +69,27 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* birthtime nanosecond access by st_birthtimensec */
#undef HAVE_ST_BIRTHTIMENSEC
/* birthtime nanosecond access by st_birthtimespec */
#undef HAVE_ST_BIRTHTIMESPEC
/* stat st_gen member */
#undef HAVE_ST_GEN
/* stat nanosecond access by st_xtimensec */
#undef HAVE_ST_XTIMENSEC
/* stat nanosecond access by st_xtimespec */
#undef HAVE_ST_XTIMESPEC
/* sync_file_range(2) is available */
#undef HAVE_SYNC_FILE_RANGE
/* Define to 1 if you have the <sys/mkdev.h> header file. */
#undef HAVE_SYS_MKDEV_H
/* Define to 1 if you have the <sys/prctl.h> header file. */
#undef HAVE_SYS_PRCTL_H
......@@ -84,6 +102,9 @@
/* Define to 1 if you have the <sys/syscall.h> header file. */
#undef HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/sysmacros.h> header file. */
#undef HAVE_SYS_SYSMACROS_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
......
This diff is collapsed.
AC_INIT
AC_CONFIG_SRCDIR([libeio/eio.h])
AC_CONFIG_HEADERS([libeio/config.h])
AC_CONFIG_HEADERS([config.h])
AC_PREREQ(2.60)
AC_USE_SYSTEM_EXTENSIONS
......@@ -9,4 +9,193 @@ AC_PROG_CC
m4_include([libeio/libeio.m4])
# for these to work, you need to run autoheader in IO::AIO, not libeio :(
AC_CACHE_CHECK(for set/getrlimit, ac_cv_rlimits, [AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <sys/time.h>
#include <sys/resource.h>
int res;
int main (void)
{
struct rlimit srl;
srl.rlim_cur = srl.rlim_max = RLIM_INFINITY;
res = getrlimit (RLIMIT_NOFILE, &srl);
res = setrlimit (RLIMIT_NOFILE, &srl);
return 0;
}
]])],ac_cv_rlimits=yes,ac_cv_rlimits=no)])
test $ac_cv_rlimits = yes && AC_DEFINE(HAVE_RLIMITS, 1, setrlimit/getrlimit is available)
dnl at least uclibc defines _POSIX_ADVISORY_INFO without *any* of the required
dnl functionality actually being present. ugh.
AC_CACHE_CHECK(for posix_madvise, ac_cv_posix_madvise, [AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <sys/mman.h>
int main (void)
{
int res = posix_madvise ((void *)0, (size_t)0, POSIX_MADV_NORMAL);
int a = POSIX_MADV_SEQUENTIAL;
int b = POSIX_MADV_RANDOM;
int c = POSIX_MADV_WILLNEED;
int d = POSIX_MADV_DONTNEED;
return 0;
}
])],ac_cv_posix_madvise=yes,ac_cv_posix_madvise=no)])
test $ac_cv_posix_madvise = yes && AC_DEFINE(HAVE_POSIX_MADVISE, 1, posix_madvise(2) is available)
AC_CACHE_CHECK(for posix_fadvise, ac_cv_posix_fadvise, [AC_LINK_IFELSE([AC_LANG_SOURCE([
#define _XOPEN_SOURCE 600
#include <fcntl.h>
int main (void)
{
int res = posix_fadvise ((int)0, (off_t)0, (off_t)0, POSIX_FADV_NORMAL);
int a = POSIX_FADV_SEQUENTIAL;
int b = POSIX_FADV_NOREUSE;
int c = POSIX_FADV_RANDOM;
int d = POSIX_FADV_WILLNEED;
int e = POSIX_FADV_DONTNEED;
return 0;
}
])],ac_cv_posix_fadvise=yes,ac_cv_posix_fadvise=no)])
test $ac_cv_posix_fadvise = yes && AC_DEFINE(HAVE_POSIX_FADVISE, 1, posix_fadvise(2) is available)
dnl lots of linux specifics
AC_CHECK_HEADERS([linux/fs.h linux/fiemap.h])
dnl glibc major/minor macros
AC_CHECK_HEADERS([sys/sysmacros.h])
dnl solaris major/minor
AC_CHECK_HEADERS([sys/mkdev.h])
AC_CACHE_CHECK([for splice, vmsplice and tee], ac_cv_linux_splice, [AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <fcntl.h>
int main (void)
{