Commit 6eceba75 authored by Nicholas Bamber's avatar Nicholas Bamber

[svn-upgrade] new version libio-aio-perl (4.00)

parent f37d137a
......@@ -170,12 +170,13 @@ use common::sense;
use base 'Exporter';
BEGIN {
our $VERSION = '3.93';
our $VERSION = '4.0';
our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close
aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx
aio_scandir aio_symlink aio_readlink aio_sync aio_fsync
aio_fdatasync aio_sync_file_range aio_pathsync aio_readahead
aio_scandir aio_symlink aio_readlink aio_realpath aio_sync aio_fsync
aio_fdatasync aio_sync_file_range aio_fallocate
aio_pathsync aio_readahead
aio_rename aio_link aio_move aio_copy aio_group
aio_nop aio_mknod aio_load aio_rmtree aio_mkdir aio_chown
aio_chmod aio_utime aio_truncate
......@@ -224,6 +225,7 @@ documentation.
aio_link $srcpath, $dstpath, $callback->($status)
aio_symlink $srcpath, $dstpath, $callback->($status)
aio_readlink $path, $callback->($link)
aio_realpath $path, $callback->($link)
aio_rename $srcpath, $dstpath, $callback->($status)
aio_mkdir $pathname, $mode, $callback->($status)
aio_rmdir $pathname, $callback->($status)
......@@ -645,6 +647,16 @@ the callback. If an error occurs, nothing or undef gets passed to the
callback.
=item aio_realpath $path, $callback->($path)
Asynchronously make the path absolute and resolve any symlinks in
C<$path>. The resulting path only consists of directories (Same as
L<Cwd::realpath>).
This request can be used to get the absolute path of the current working
directory by passing it a path of F<.> (a single dot).
=item aio_rename $srcpath, $dstpath, $callback->($status)
Asynchronously rename the object at C<$srcpath> to C<$dstpath>, just as
......@@ -1794,14 +1806,33 @@ some examples of how to do this:
Usage of pthreads in a program changes the semantics of fork
considerably. Specifically, only async-safe functions can be called after
fork. Perl doesn't know about this, so in general, you cannot call fork
with defined behaviour in perl. IO::AIO uses pthreads, so this applies,
but many other extensions and (for inexplicable reasons) perl itself often
is linked against pthreads, so this limitation applies.
Some operating systems have extensions that allow safe use of fork, and
this module should do "the right thing" on those, and tries on others. At
the time of this writing (2011) only GNU/Linux supports these extensions
to POSIX.
with defined behaviour in perl if pthreads are involved. IO::AIO uses
pthreads, so this applies, but many other extensions and (for inexplicable
reasons) perl itself often is linked against pthreads, so this limitation
applies to quite a lot of perls.
This module no longer tries to fight your OS, or POSIX. That means IO::AIO
only works in the process that loaded it. Forking is fully supported, but
using IO::AIO in the child is not.
You might get around by not I<using> IO::AIO before (or after)
forking. You could also try to call the L<IO::AIO::reinit> function in the
child:
=over 4
=item IO::AIO::reinit
Abondons all current requests and I/O threads and simply reinitialises all
data structures. This is not an operation suppported by any standards, but
happens to work on GNU/Linux and some newer BSD systems.
The only reasonable use for this function is to call it after forking, if
C<IO::AIO> was used in the parent. Calling it while IO::AIO is active in
the process will result in undefined behaviour. Calling it at any time
will also result in any undefined (by POSIX) behaviour.
=back
=head2 MEMORY USAGE
......
......@@ -13,7 +13,6 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <limits.h>
#include <fcntl.h>
#include <sched.h>
......@@ -25,61 +24,56 @@
/* perl namespace pollution */
#undef VERSION
/* perl stupidly overrides readdir and maybe others */
/* with thread-unsafe versions, imagine that :( */
#undef readdir
#undef opendir
#undef closedir
#ifdef _WIN32
# define EIO_STRUCT_DIRENT Direntry_t
# undef malloc
# undef free
// perl overrides all those nice win32 functions
# undef open
# undef read
# undef write
# undef send
# undef recv
# undef stat
# undef fstat
# define lstat stat
# undef truncate
# undef ftruncate
# undef open
# undef close
# undef unlink
# undef rmdir
# undef rename
# undef lseek
# define chown(a,b,c) (errno = ENOSYS, -1)
# define fchown(a,b,c) (errno = ENOSYS, -1)
# define fchmod(a,b) (errno = ENOSYS, -1)
# define symlink(a,b) (errno = ENOSYS, -1)
# define readlink(a,b,c) (errno = ENOSYS, -1)
# define mknod(a,b,c) (errno = ENOSYS, -1)
# define truncate(a,b) (errno = ENOSYS, -1)
# define ftruncate(fd,o) chsize ((fd), (o))
# define fsync(fd) _commit (fd)
# define opendir(fd) (errno = ENOSYS, 0)
# define readdir(fd) (errno = ENOSYS, -1)
# define closedir(fd) (errno = ENOSYS, -1)
# define mkdir(a,b) mkdir (a)
// perl overrides all those nice libc functions
#undef malloc
#undef free
#undef open
#undef read
#undef write
#undef send
#undef recv
#undef stat
#undef lstat
#undef fstat
#undef truncate
#undef ftruncate
#undef open
#undef link
#undef close
#undef unlink
#undef mkdir
#undef rmdir
#undef rename
#undef lseek
#undef opendir
#undef readdir
#undef closedir
#undef chmod
#undef fchmod
#undef dup
#undef dup2
#undef abort
#undef pipe
#else
# include <sys/time.h>
# include <sys/select.h>
# include <unistd.h>
# include <utime.h>
# include <signal.h>
# define EIO_STRUCT_DIRENT struct dirent
#include <sys/time.h>
#include <sys/select.h>
#include <unistd.h>
#include <utime.h>
#include <signal.h>
#endif
/* perl stupidly overrides readdir and maybe others */
/* with thread-unsafe versions, imagine that :( */
#undef readdir
#undef opendir
#undef closedir
#define EIO_STRUCT_STAT Stat_t
/* use NV for 32 bit perls as it allows larger offsets */
......@@ -123,6 +117,13 @@ static HV *aio_stash, *aio_req_stash, *aio_grp_stash;
#include "libeio/config.h"
#include "libeio/eio.h"
static int req_invoke (eio_req *req);
#define EIO_FINISH(req) req_invoke (req)
static void req_destroy (eio_req *grp);
#define EIO_DESTROY(req) req_destroy (req)
#include "libeio/eio.c"
/* Linux/others */
#ifndef O_ASYNC
# define O_ASYNC 0
......@@ -225,6 +226,12 @@ static HV *aio_stash, *aio_req_stash, *aio_grp_stash;
# define PROT_EXEC 0
#endif
#ifndef ST_RDONLY
# define ST_RDONLY 0
#endif
#ifndef ST_NOSUID
# define ST_NOSUID 0
#endif
#ifndef ST_NODEV
# define ST_NODEV 0
#endif
......@@ -318,17 +325,10 @@ static HV *aio_stash, *aio_req_stash, *aio_grp_stash;
# define PAGESIZE sysconf (_SC_PAGESIZE)
#endif
static int req_invoke (eio_req *req);
#define EIO_FINISH(req) req_invoke (req)
static void req_destroy (eio_req *grp);
#define EIO_DESTROY(req) req_destroy (req)
enum {
FLAG_SV2_RO_OFF = 0x40, /* data was set readonly */
};
#include "libeio/eio.c"
typedef eio_req *aio_req;
typedef eio_req *aio_req_ornot;
......@@ -543,6 +543,7 @@ static int req_invoke (eio_req *req)
{
SV *rv = &PL_sv_undef;
#ifndef _WIN32
if (req->result >= 0)
{
EIO_STRUCT_STATVFS *f = EIO_STATVFS_BUF (req);
......@@ -562,6 +563,7 @@ static int req_invoke (eio_req *req)
hv_store (hv, "flag" , sizeof ("flag" ) - 1, newSVval64 (f->f_flag ), 0);
hv_store (hv, "namemax", sizeof ("namemax") - 1, newSVval64 (f->f_namemax), 0);
}
#endif
PUSHs (rv);
}
......@@ -587,6 +589,7 @@ static int req_invoke (eio_req *req)
break;
case EIO_READLINK:
case EIO_REALPATH:
if (req->result > 0)
PUSHs (sv_2mortal (newSVpvn (req->ptr2, req->result)));
break;
......@@ -596,6 +599,7 @@ static int req_invoke (eio_req *req)
case EIO_FSTAT:
PL_laststype = req->type == EIO_LSTAT ? OP_LSTAT : OP_STAT;
PL_laststatval = req->result;
/* if compilation fails here then perl's Stat_t is not struct _stati64 */
PL_statcache = *(EIO_STRUCT_STAT *)(req->ptr2);
PUSHs (sv_result);
break;
......@@ -657,8 +661,6 @@ static void req_destroy (aio_req req)
static void req_cancel_subs (aio_req grp)
{
aio_req sub;
if (grp->type != EIO_GROUP)
return;
......@@ -668,8 +670,7 @@ static void req_cancel_subs (aio_req grp)
eio_grp_cancel (grp);
}
static void
create_respipe (void)
static void create_respipe (void)
{
if (s_epipe_renew (&respipe))
croak ("IO::AIO: unable to initialize result pipe");
......@@ -710,9 +711,13 @@ static int poll_cb (void)
}
}
static void atfork_child (void)
static void ecb_cold
reinit (void)
{
create_respipe ();
if (eio_init (want_poll, done_poll) < 0)
croak ("IO::AIO: unable to initialise eio library");
}
/*****************************************************************************/
......@@ -733,8 +738,7 @@ static void atfork_child (void)
#define MMAP_MAGIC PERL_MAGIC_ext
static int
mmap_free (pTHX_ SV *sv, MAGIC *mg)
static int mmap_free (pTHX_ SV *sv, MAGIC *mg)
{
int old_errno = errno;
munmap (mg->mg_ptr, (size_t)mg->mg_obj);
......@@ -760,8 +764,7 @@ static MGVTBL mmap_vtbl = {
/*****************************************************************************/
static SV *
get_cb (SV *cb_sv)
static SV * get_cb (SV *cb_sv)
{
SvGETMAGIC (cb_sv);
return SvOK (cb_sv) ? s_get_cv_croak (cb_sv) : 0;
......@@ -895,6 +898,8 @@ BOOT:
const_eio (SYNC_FILE_RANGE_WRITE)
const_eio (SYNC_FILE_RANGE_WAIT_AFTER)
const_eio (FALLOC_FL_KEEP_SIZE)
const_eio (READDIR_DENTS)
const_eio (READDIR_DIRS_FIRST)
const_eio (READDIR_STAT_ORDER)
......@@ -920,15 +925,15 @@ BOOT:
newCONSTSUB (aio_stash, "PAGESIZE", newSViv (PAGESIZE));
create_respipe ();
if (eio_init (want_poll, done_poll) < 0)
croak ("IO::AIO: unable to initialise eio library");
/* atfork child called in fifo order, so before eio's handler */
X_THREAD_ATFORK (0, 0, atfork_child);
reinit ();
}
void
reinit ()
PROTOTYPE:
CODE:
reinit ();
void
max_poll_reqs (unsigned int nreqs)
PROTOTYPE: $
......@@ -1020,28 +1025,51 @@ aio_sync_file_range (SV *fh, off_t offset, size_t nbytes, UV flags, SV *callback
REQ_SEND (req);
}
void
aio_fallocate (SV *fh, int mode, off_t offset, size_t len, SV *callback=&PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
dREQ;
req->type = EIO_FALLOCATE;
req->sv1 = newSVsv (fh);
req->int1 = fd;
req->int2 = mode;
req->offs = offset;
req->size = len;
REQ_SEND (req);
}
void
aio_close (SV *fh, SV *callback=&PL_sv_undef)
PPCODE:
{
static int close_pipe = -1; /* dummy fd to close fds via dup2 */
static int close_fd = -1; /* dummy fd to close fds via dup2 */
int fd = s_fileno_croak (fh, 0);
dREQ;
if (close_pipe < 0)
if (expect_false (close_fd < 0))
{
int pipefd [2];
if (pipe (pipefd) < 0
|| close (pipefd [1]) < 0
|| fcntl (pipefd [0], F_SETFD, FD_CLOEXEC) < 0)
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_pipe = pipefd [0];
close_fd = pipefd [0];
}
req->type = EIO_DUP2;
req->int1 = close_pipe;
req->int1 = close_fd;
req->sv2 = newSVsv (fh);
req->int2 = fd;
......@@ -1103,12 +1131,14 @@ aio_read (SV *fh, SV *offset, SV *length, SV8 *data, IV dataoffset, SV *callback
void
aio_readlink (SV8 *path, SV *callback=&PL_sv_undef)
ALIAS:
aio_readlink = EIO_READLINK
aio_realpath = EIO_REALPATH
PPCODE:
{
SV *data;
dREQ;
req->type = EIO_READLINK;
req->type = ix;
req->sv1 = newSVsv (path);
req->ptr1 = SvPVbyte_nolen (req->sv1);
......
......@@ -5,11 +5,21 @@ TODO: aio_cptree/mvtree
TODO: reduce condvar fairness: schedule hot-cache-threads first?
TODO: splice/tee/vmsplice? (http://kerneltrap.org/node/6505 http://lwn.net/Articles/178199/)
TODO: aio_fcntl, at least for file-locking
TODO: fallocate, if it wouldn't be so useless.
TODO: aio_mincore?
TODO: getxattr etc.?
TODO: MS_xxx, posix_fadvise, posix_madvise
TODO: realpath
4.0 Mon Jul 18 05:01:10 CEST 2011
- INCOMPATIBLE CHANGE: fork is no longer supported (indeed, it never was),
see FORK BEHAVIOUR in manpage for details.
- passes testsuite on win32 now and may actually work
(activestate 5.10.1 / MSVC6, YMMV).
- (libeio) fix a deadlock where a wakeup signal could be missed when
a timeout occured at the same time.
- (libeio) added realpath.
- (libeio) added fallocate.
- (libeio) disabling sendfile on darwin unfortunately broke the emulation.
- (libeio) do not acquire any locks when forking.
- (libeio) use fewer time() syscalls when waiting for new requests.
3.93 Wed Jun 29 23:44:18 CEST 2011
- ECB.H WAS MISSING.
......@@ -36,7 +46,7 @@ TODO: realpath
3.9 Fri May 27 02:43:47 CEST 2011
- (libeio) fix memory corruption in aio_readdirx for the flags
combination READDIR_STAT_ORDER | READDIR_DIRS_FIRST.
- add lots of newre POSIX and GNU/Linux-specific open
- add lots of newer POSIX and GNU/Linux-specific open
flags.
3.8 Sun Mar 27 12:25:33 CEST 2011
......
......@@ -29,4 +29,5 @@ configure
autogen.sh
typemap
META.json Module meta-data (added by MakeMaker)
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
{
"abstract" : "unknown",
"author" : [
"unknown"
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 6.58, CPAN::Meta::Converter version 2.110930001",
"license" : [
"unknown"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "IO-AIO",
"no_index" : {
"directory" : [
"t",
"inc"
]
},
"meta-spec" : {
"version" : 1.4,
"url" : "http://module-build.sourceforge.net/META-spec-v1.4.html"
},
"generated_by" : "ExtUtils::MakeMaker::JSONMETA version 7.000",
"distribution_type" : "module",
"version" : "3.93",
"name" : "IO-AIO",
"author" : [],
"license" : "unknown",
"build_requires" : {
"ExtUtils::MakeMaker" : 0
},
"requires" : {
"common::sense" : 0
"prereqs" : {
"build" : {
"requires" : {
"ExtUtils::MakeMaker" : 0
}
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : 0
}
},
"runtime" : {
"requires" : {
"common::sense" : 0
}
}
},
"abstract" : null,
"configure_requires" : {
"ExtUtils::MakeMaker" : 0
}
"release_status" : "stable",
"version" : "4.0"
}
---
abstract: unknown
author:
- unknown
build_requires:
ExtUtils::MakeMaker: 0
configure_requires:
ExtUtils::MakeMaker: 0
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 6.58, CPAN::Meta::Converter version 2.110930001'
license: unknown
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: IO-AIO
no_index:
directory:
- t
- inc
requires:
common::sense: 0
version: 4.0
......@@ -4,20 +4,37 @@ use ExtUtils::MakeMaker;
use Config;
if ($^O =~ /win32/i or $^O =~ /mswin/) {
if ($^O eq "MSWin32") {
# configuration on windows is hardcoded - as always
warn "your platform is not standards-compliant, you have to port this module first\n";
warn "using some hardcoded config that will not work on your system\n";
print STDERR <<EOF;
***
*** 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
***
*** You can set the INC and LIBS environment variables
*** accordingly before running Makeifle.PL, or you can
*** pass INC and LIBS arguments to Makefile.PL itself.
***
$INC = "-I/Perl/lib/CORE -I/sdk/include -I/vc98/include -I/gtk/include -I/gtk/include/pango-1.0 -I/gtk/include/glib-2.0 -I/gtk/lib/glib-2.0/include/ -I/gtk/include/freetype2";
$LIBS = ["-L/gtk/lib -lpthreadVC2"];
EOF
$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: $!";
print $fh <<EOF;
EOF
} else {
$INC = "";
$LIBS = ['-lpthread', '-lpthreads', '-lpthreadVC2', ''];
$LIBS = ['-lpthread', '-lpthreads', ''];
if ($^O =~ /bsd/i) {
print <<EOF;
......
......@@ -170,6 +170,7 @@ FUNCTIONS
aio_link $srcpath, $dstpath, $callback->($status)
aio_symlink $srcpath, $dstpath, $callback->($status)
aio_readlink $path, $callback->($link)
aio_realpath $path, $callback->($link)
aio_rename $srcpath, $dstpath, $callback->($status)
aio_mkdir $pathname, $mode, $callback->($status)
aio_rmdir $pathname, $callback->($status)
......@@ -559,6 +560,14 @@ FUNCTIONS
the callback. If an error occurs, nothing or undef gets passed to
the callback.
aio_realpath $path, $callback->($path)
Asynchronously make the path absolute and resolve any symlinks in
$path. The resulting path only consists of directories (Same as
Cwd::realpath).
This request can be used to get the absolute path of the current
working directory by passing it a path of . (a single dot).
aio_rename $srcpath, $dstpath, $callback->($status)
Asynchronously rename the object at $srcpath to $dstpath, just as
rename(2) and call the callback with the result code.
......@@ -1373,14 +1382,29 @@ EVENT LOOP INTEGRATION
Usage of pthreads in a program changes the semantics of fork
considerably. Specifically, only async-safe functions can be called
after fork. Perl doesn't know about this, so in general, you cannot call
fork with defined behaviour in perl. IO::AIO uses pthreads, so this
applies, but many other extensions and (for inexplicable reasons) perl
itself often is linked against pthreads, so this limitation applies.
Some operating systems have extensions that allow safe use of fork, and
this module should do "the right thing" on those, and tries on others.
At the time of this writing (2011) only GNU/Linux supports these
extensions to POSIX.
fork with defined behaviour in perl if pthreads are involved. IO::AIO
uses pthreads, so this applies, but many other extensions and (for
inexplicable reasons) perl itself often is linked against pthreads, so
this limitation applies to quite a lot of perls.
This module no longer tries to fight your OS, or POSIX. That means
IO::AIO only works in the process that loaded it. Forking is fully
supported, but using IO::AIO in the child is not.
You might get around by not *using* IO::AIO before (or after) forking.
You could also try to call the IO::AIO::reinit function in the child:
IO::AIO::reinit
Abondons all current requests and I/O threads and simply
reinitialises all data structures. This is not an operation
suppported by any standards, but happens to work on GNU/Linux and
some newer BSD systems.
The only reasonable use for this function is to call it after
forking, if "IO::AIO" was used in the parent. Calling it while
IO::AIO is active in the process will result in undefined behaviour.
Calling it at any time will also result in any undefined (by POSIX)
behaviour.
MEMORY USAGE
Per-request usage:
......
This diff is collapsed.
......@@ -3,6 +3,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* fallocate(2) is available */
#undef HAVE_FALLOCATE
/* fdatasync(2) is available */
#undef HAVE_FDATASYNC
......
......@@ -63,6 +63,49 @@
#endif
#endif
/*****************************************************************************/
#ifndef ECB_MEMORY_FENCE
#if ECB_GCC_VERSION(2,5)
#if __x86
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; or.b $0, -1(%%esp)" : : : "memory")
#define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE
#define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE /* better be safe than sorry */
#elif __amd64
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory")
#define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("lfence" : : : "memory")
#define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("sfence")
#endif
#endif
#endif
#ifndef ECB_MEMORY_FENCE
#if ECB_GCC_VERSION(4,4)
#define ECB_MEMORY_FENCE __sync_synchronize ()
#define ECB_MEMORY_FENCE_ACQUIRE ({ char dummy = 0; __sync_lock_test_and_set (&dummy, 1); })
#define ECB_MEMORY_FENCE_RELEASE ({ char dummy = 1; __sync_lock_release (&dummy ); })
#elif _MSC_VER >= 1400
#define ECB_MEMORY_FENCE do { } while (0)
#define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE
#define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE
#elif defined(_WIN32) && defined(MemoryBarrier)
#define ECB_MEMORY_FENCE MemoryBarrier ()
#define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE
#define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE
#endif
#endif
#ifndef ECB_MEMORY_FENCE
#include <pthread.h>
static pthread_mutex_t ecb_mf_lock = PTHREAD_MUTEX_INITIALIZER;
#define ECB_MEMORY_FENCE do { pthread_mutex_lock (&ecb_mf_lock); pthread_mutex_unlock (&ecb_mf_lock); } while (0)
#define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE
#define ECB_MEMORY_FENCE_RELEASE ECB_MEMORY_FENCE
#endif
/*****************************************************************************/
#define ECB_C99 (__STDC_VERSION__ >= 199901L)
#if __cplusplus
......
This diff is collapsed.
......@@ -45,6 +45,7 @@ extern "C" {
#endif
#include <stddef.h>
#include <signal.h>
#include <sys/types.h>
typedef struct eio_req eio_req;
......@@ -57,7 +58,28 @@ typedef int (*eio_cb)(eio_req *req);
#endif
#ifndef EIO_STRUCT_STAT
# define EIO_STRUCT_STAT struct stat
# ifdef _WIN32
# define EIO_STRUCT_STAT struct _stati64
# define EIO_STRUCT_STATI64
# else
# define EIO_STRUCT_STAT struct stat
# endif
#endif
#ifdef _WIN32
typedef int eio_uid_t;
typedef int eio_gid_t;
typedef intptr_t eio_ssize_t; /* or SSIZE_T */
#if __GNUC__
typedef long long eio_ino_t;
#else
typedef __int64 eio_ino_t; /* unsigned not supported by msvc */
#endif
#else
typedef uid_t eio_uid_t;
typedef gid_t eio_gid_t;
typedef ssize_t eio_ssize_t;
typedef ino_t eio_ino_t;
#endif
#ifndef EIO_STRUCT_STATVFS
......@@ -106,7 +128,7 @@ struct eio_dirent
unsigned short namelen; /* size of filename without trailing 0 */
unsigned char type; /* one of EIO_DT_* */
signed char score; /* internal use */
ino_t inode; /* the inode number, if available, otherwise unspecified */
eio_ino_t inode; /* the inode number, if available, otherwise unspecified */
};
/* eio_msync flags */
......@@ -118,14 +140,12 @@ enum
};
/* eio_mtouch flags */
enum
{
EIO_MT_MODIFY = 1
};
/* eio_sync_file_range flags */
enum
{
EIO_SYNC_FILE_RANGE_WAIT_BEFORE = 1,
......@@ -133,10 +153,16 @@ enum
EIO_SYNC_FILE_RANGE_WAIT_AFTER = 4
};
typedef double eio_tstamp; /* feel free to use double in your code directly */
/* eio_fallocate flags */
enum
{
EIO_FALLOC_FL_KEEP_SIZE = 1 /* MUST match the value in linux/falloc.h */
};
/* the eio request structure */
/* timestamps and differences - feel free to use double in your code directly */
typedef double eio_tstamp;
/* the eio request structure */