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

Imported Upstream version 4.33

parent 9a068410
...@@ -96,7 +96,7 @@ F</etc/passwd> asynchronously: ...@@ -96,7 +96,7 @@ F</etc/passwd> asynchronously:
print $contents; print $contents;
# exit event loop and program # exit event loop and program
EV::unloop; EV::break;
}; };
}; };
...@@ -104,7 +104,7 @@ F</etc/passwd> asynchronously: ...@@ -104,7 +104,7 @@ F</etc/passwd> asynchronously:
# check for sockets etc. etc. # check for sockets etc. etc.
# process events as long as there are some: # process events as long as there are some:
EV::loop; EV::run;
=head1 REQUEST ANATOMY AND LIFETIME =head1 REQUEST ANATOMY AND LIFETIME
...@@ -169,7 +169,7 @@ use common::sense; ...@@ -169,7 +169,7 @@ use common::sense;
use base 'Exporter'; use base 'Exporter';
BEGIN { BEGIN {
our $VERSION = 4.32; our $VERSION = 4.33;
our @AIO_REQ = qw(aio_sendfile aio_seek aio_read aio_write aio_open aio_close 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 aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx
...@@ -396,7 +396,7 @@ your system are, as usual, C<0>): ...@@ -396,7 +396,7 @@ your system are, as usual, C<0>):
C<O_ASYNC>, C<O_DIRECT>, C<O_NOATIME>, C<O_CLOEXEC>, C<O_NOCTTY>, C<O_NOFOLLOW>, C<O_ASYNC>, C<O_DIRECT>, C<O_NOATIME>, C<O_CLOEXEC>, C<O_NOCTTY>, C<O_NOFOLLOW>,
C<O_NONBLOCK>, C<O_EXEC>, C<O_SEARCH>, C<O_DIRECTORY>, C<O_DSYNC>, C<O_NONBLOCK>, C<O_EXEC>, C<O_SEARCH>, C<O_DIRECTORY>, C<O_DSYNC>,
C<O_RSYNC>, C<O_SYNC> and C<O_TTY_INIT>. C<O_RSYNC>, C<O_SYNC>, C<O_PATH>, C<O_TMPFILE>, and C<O_TTY_INIT>.
=item aio_close $fh, $callback->($status) =item aio_close $fh, $callback->($status)
...@@ -628,8 +628,9 @@ Linux - it is safe to hardcode these when C<$^O> is C<linux>: ...@@ -628,8 +628,9 @@ Linux - it is safe to hardcode these when C<$^O> is C<linux>:
0x0000f15f ecryptfs 0x0000f15f ecryptfs
0x00414a53 efs 0x00414a53 efs
0x0000137d ext 0x0000137d ext
0x0000ef53 ext2/ext3 0x0000ef53 ext2/ext3/ext4
0x0000ef51 ext2 0x0000ef51 ext2
0xf2f52010 f2fs
0x00004006 fat 0x00004006 fat
0x65735546 fuseblk 0x65735546 fuseblk
0x65735543 fusectl 0x65735543 fusectl
...@@ -638,6 +639,7 @@ Linux - it is safe to hardcode these when C<$^O> is C<linux>: ...@@ -638,6 +639,7 @@ Linux - it is safe to hardcode these when C<$^O> is C<linux>:
0x47504653 gpfs 0x47504653 gpfs
0x00004244 hfs 0x00004244 hfs
0xf995e849 hpfs 0xf995e849 hpfs
0x00c0ffee hostfs
0x958458f6 hugetlbfs 0x958458f6 hugetlbfs
0x2bad1dea inotifyfs 0x2bad1dea inotifyfs
0x00009660 isofs 0x00009660 isofs
...@@ -662,6 +664,7 @@ Linux - it is safe to hardcode these when C<$^O> is C<linux>: ...@@ -662,6 +664,7 @@ Linux - it is safe to hardcode these when C<$^O> is C<linux>:
0x00009fa0 proc 0x00009fa0 proc
0x6165676c pstorefs 0x6165676c pstorefs
0x0000002f qnx4 0x0000002f qnx4
0x68191122 qnx6
0x858458f6 ramfs 0x858458f6 ramfs
0x52654973 reiserfs 0x52654973 reiserfs
0x00007275 romfs 0x00007275 romfs
...@@ -727,9 +730,13 @@ Works like truncate(2) or ftruncate(2). ...@@ -727,9 +730,13 @@ Works like truncate(2) or ftruncate(2).
Allocates or frees disk space according to the C<$mode> argument. See the Allocates or frees disk space according to the C<$mode> argument. See the
linux C<fallocate> documentation for details. linux C<fallocate> documentation for details.
C<$mode> can currently be C<0> or C<IO::AIO::FALLOC_FL_KEEP_SIZE> C<$mode> is usually C<0> or C<IO::AIO::FALLOC_FL_KEEP_SIZE> to allocate
to allocate space, or C<IO::AIO::FALLOC_FL_PUNCH_HOLE | space, or C<IO::AIO::FALLOC_FL_PUNCH_HOLE | IO::AIO::FALLOC_FL_KEEP_SIZE>,
IO::AIO::FALLOC_FL_KEEP_SIZE>, to deallocate a file range. to deallocate a file range.
IO::AIO also supports C<FALLOC_FL_COLLAPSE_RANGE>, to remove a range
(without leaving a hole) and C<FALLOC_FL_ZERO_RANGE>, to zero a range (see
your L<fallocate(2)> manpage).
The file system block size used by C<fallocate> is presumably the The file system block size used by C<fallocate> is presumably the
C<f_bsize> returned by C<statvfs>. C<f_bsize> returned by C<statvfs>.
...@@ -2055,13 +2062,21 @@ filesize. ...@@ -2055,13 +2062,21 @@ filesize.
C<$prot> is a combination of C<IO::AIO::PROT_NONE>, C<IO::AIO::PROT_EXEC>, C<$prot> is a combination of C<IO::AIO::PROT_NONE>, C<IO::AIO::PROT_EXEC>,
C<IO::AIO::PROT_READ> and/or C<IO::AIO::PROT_WRITE>, C<IO::AIO::PROT_READ> and/or C<IO::AIO::PROT_WRITE>,
C<$flags> can be a combination of C<IO::AIO::MAP_SHARED> or C<$flags> can be a combination of
C<IO::AIO::MAP_PRIVATE>, or a number of system-specific flags (when C<IO::AIO::MAP_SHARED> or
not available, the are defined as 0): C<IO::AIO::MAP_ANONYMOUS> C<IO::AIO::MAP_PRIVATE>,
(which is set to C<MAP_ANON> if your system only provides this or a number of system-specific flags (when not available, the are C<0>):
constant), C<IO::AIO::MAP_HUGETLB>, C<IO::AIO::MAP_LOCKED>, C<IO::AIO::MAP_ANONYMOUS> (which is set to C<MAP_ANON> if your system only provides this constant),
C<IO::AIO::MAP_NORESERVE>, C<IO::AIO::MAP_POPULATE> or C<IO::AIO::MAP_HUGETLB>,
C<IO::AIO::MAP_NONBLOCK> C<IO::AIO::MAP_LOCKED>,
C<IO::AIO::MAP_NORESERVE>,
C<IO::AIO::MAP_POPULATE>,
C<IO::AIO::MAP_NONBLOCK>,
C<IO::AIO::MAP_FIXED>,
C<IO::AIO::MAP_GROWSDOWN>,
C<IO::AIO::MAP_32BIT>,
C<IO::AIO::MAP_HUGETLB> or
C<IO::AIO::MAP_STACK>.
If C<$fh> is C<undef>, then a file descriptor of C<-1> is passed. If C<$fh> is C<undef>, then a file descriptor of C<-1> is passed.
...@@ -2124,6 +2139,26 @@ on pipes, and currently works only on GNU/Linux systems, and fails with ...@@ -2124,6 +2139,26 @@ on pipes, and currently works only on GNU/Linux systems, and fails with
C<-1>/C<ENOSYS> everywhere else. If anybody knows how to influence pipe buffer C<-1>/C<ENOSYS> everywhere else. If anybody knows how to influence pipe buffer
size on other systems, drop me a note. size on other systems, drop me a note.
=item ($rfh, $wfh) = IO::AIO::pipe2 [$flags]
This is a direct interface to the Linux L<pipe2(2)> system call. If
C<$flags> is missing or C<0>, then this should be the same as a call to
perl's built-in C<pipe> function and create a new pipe, and works on
systems that lack the pipe2 syscall. On win32, this case invokes C<_pipe
(..., 4096, O_BINARY)>.
If C<$flags> is non-zero, it tries to invoke the pipe2 system call with
the given flags (Linux 2.6.27, glibc 2.9).
On success, the read and write file handles are returned.
On error, nothing will be returned. If the pipe2 syscall is missing and
C<$flags> is non-zero, fails with C<ENOSYS>.
Please refer to L<pipe2(2)> for more info on the C<$flags>, but at the
time of this writing, C<IO::AIO::O_CLOEXEC>, C<IO::AIO::O_NONBLOCK> and
C<IO::AIO::O_DIRECT> (Linux 3.4, for packet-based pipes) were supported.
=back =back
=cut =cut
......
This diff is collapsed.
...@@ -34,6 +34,20 @@ TODO: name_to_handle_At + open_by_handle_at = clone fds ...@@ -34,6 +34,20 @@ TODO: name_to_handle_At + open_by_handle_at = clone fds
TODO: rewrite rmtree et al. to support working directories (also speed them up) TODO: rewrite rmtree et al. to support working directories (also speed them up)
TODO: maybe IO::AIO leaks fds when requests are cancelled? maybe initialise result to -1? TODO: maybe IO::AIO leaks fds when requests are cancelled? maybe initialise result to -1?
TODO: aio_wd should use O_PATH on linux, due to lacking O_SEARCH (http://comments.gmane.org/gmane.linux.file-systems/33611)
http://www.openwall.com/lists/musl/2013/02/23/4
4.33 Mon Jan 18 12:50:10 CET 2016
- add IO::AIO::pipe2 function.
- added support for FALLOC_FL_COLLAPSE_RANGE and FALLOC_FL_ZERO_RANGE
constants.
- added support for O_TMPFILE and O_PATH constants.
- added support for MAP_FIXED, MAP_GROWSDOWN,MAP_32BIT, MAP_HUGETLB, MAP_STACK
consdtants, whether they can be sensibly used or not.
- use NO_INIT where applicable.
- update libecb.
- added stability canary support.
- updated linux super magic table to 4.3.3.
4.32 Wed Feb 11 20:32:11 CET 2015 4.32 Wed Feb 11 20:32:11 CET 2015
- replace off_t by STRLEN where appropriate, should not result in - replace off_t by STRLEN where appropriate, should not result in
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"unknown" "unknown"
], ],
"dynamic_config" : 1, "dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142060", "generated_by" : "ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001",
"license" : [ "license" : [
"unknown" "unknown"
], ],
...@@ -27,7 +27,8 @@ ...@@ -27,7 +27,8 @@
}, },
"configure" : { "configure" : {
"requires" : { "requires" : {
"ExtUtils::MakeMaker" : "0" "Canary::Stability" : "2001",
"ExtUtils::MakeMaker" : "6.52"
} }
}, },
"runtime" : { "runtime" : {
...@@ -37,5 +38,5 @@ ...@@ -37,5 +38,5 @@
} }
}, },
"release_status" : "stable", "release_status" : "stable",
"version" : 4.32 "version" : 4.33
} }
...@@ -5,9 +5,10 @@ author: ...@@ -5,9 +5,10 @@ author:
build_requires: build_requires:
ExtUtils::MakeMaker: '0' ExtUtils::MakeMaker: '0'
configure_requires: configure_requires:
ExtUtils::MakeMaker: '0' Canary::Stability: '2001'
ExtUtils::MakeMaker: '6.52'
dynamic_config: 1 dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142060' generated_by: 'ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150001'
license: unknown license: unknown
meta-spec: meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html url: http://module-build.sourceforge.net/META-spec-v1.4.html
...@@ -19,4 +20,4 @@ no_index: ...@@ -19,4 +20,4 @@ no_index:
- inc - inc
requires: requires:
common::sense: '0' common::sense: '0'
version: 4.32 version: 4.33
use 5.008002; use Canary::Stability IO::AIO => 1, 5.008002;
use ExtUtils::MakeMaker; use ExtUtils::MakeMaker;
...@@ -110,6 +110,7 @@ my $mm = MM->new({ ...@@ -110,6 +110,7 @@ my $mm = MM->new({
PM => { PM => {
'AIO.pm' => '$(INST_LIB)/IO/AIO.pm', 'AIO.pm' => '$(INST_LIB)/IO/AIO.pm',
}, },
CONFIGURE_REQUIRES => { ExtUtils::MakeMaker => 6.52, Canary::Stability => 2001 },
PREREQ_PM => { PREREQ_PM => {
"common::sense" => 0, "common::sense" => 0,
}, },
......
...@@ -92,7 +92,7 @@ DESCRIPTION ...@@ -92,7 +92,7 @@ DESCRIPTION
print $contents; print $contents;
# exit event loop and program # exit event loop and program
EV::unloop; EV::break;
}; };
}; };
...@@ -100,7 +100,7 @@ DESCRIPTION ...@@ -100,7 +100,7 @@ DESCRIPTION
# check for sockets etc. etc. # check for sockets etc. etc.
# process events as long as there are some: # process events as long as there are some:
EV::loop; EV::run;
REQUEST ANATOMY AND LIFETIME REQUEST ANATOMY AND LIFETIME
Every "aio_*" function creates a request. which is a C data structure Every "aio_*" function creates a request. which is a C data structure
...@@ -332,7 +332,8 @@ FUNCTIONS ...@@ -332,7 +332,8 @@ FUNCTIONS
"O_ASYNC", "O_DIRECT", "O_NOATIME", "O_CLOEXEC", "O_NOCTTY", "O_ASYNC", "O_DIRECT", "O_NOATIME", "O_CLOEXEC", "O_NOCTTY",
"O_NOFOLLOW", "O_NONBLOCK", "O_EXEC", "O_SEARCH", "O_DIRECTORY", "O_NOFOLLOW", "O_NONBLOCK", "O_EXEC", "O_SEARCH", "O_DIRECTORY",
"O_DSYNC", "O_RSYNC", "O_SYNC" and "O_TTY_INIT". "O_DSYNC", "O_RSYNC", "O_SYNC", "O_PATH", "O_TMPFILE", and
"O_TTY_INIT".
aio_close $fh, $callback->($status) aio_close $fh, $callback->($status)
Asynchronously close a file and call the callback with the result Asynchronously close a file and call the callback with the result
...@@ -555,8 +556,9 @@ FUNCTIONS ...@@ -555,8 +556,9 @@ FUNCTIONS
0x0000f15f ecryptfs 0x0000f15f ecryptfs
0x00414a53 efs 0x00414a53 efs
0x0000137d ext 0x0000137d ext
0x0000ef53 ext2/ext3 0x0000ef53 ext2/ext3/ext4
0x0000ef51 ext2 0x0000ef51 ext2
0xf2f52010 f2fs
0x00004006 fat 0x00004006 fat
0x65735546 fuseblk 0x65735546 fuseblk
0x65735543 fusectl 0x65735543 fusectl
...@@ -565,6 +567,7 @@ FUNCTIONS ...@@ -565,6 +567,7 @@ FUNCTIONS
0x47504653 gpfs 0x47504653 gpfs
0x00004244 hfs 0x00004244 hfs
0xf995e849 hpfs 0xf995e849 hpfs
0x00c0ffee hostfs
0x958458f6 hugetlbfs 0x958458f6 hugetlbfs
0x2bad1dea inotifyfs 0x2bad1dea inotifyfs
0x00009660 isofs 0x00009660 isofs
...@@ -589,6 +592,7 @@ FUNCTIONS ...@@ -589,6 +592,7 @@ FUNCTIONS
0x00009fa0 proc 0x00009fa0 proc
0x6165676c pstorefs 0x6165676c pstorefs
0x0000002f qnx4 0x0000002f qnx4
0x68191122 qnx6
0x858458f6 ramfs 0x858458f6 ramfs
0x52654973 reiserfs 0x52654973 reiserfs
0x00007275 romfs 0x00007275 romfs
...@@ -648,10 +652,14 @@ FUNCTIONS ...@@ -648,10 +652,14 @@ FUNCTIONS
Allocates or frees disk space according to the $mode argument. See Allocates or frees disk space according to the $mode argument. See
the linux "fallocate" documentation for details. the linux "fallocate" documentation for details.
$mode can currently be 0 or "IO::AIO::FALLOC_FL_KEEP_SIZE" to $mode is usually 0 or "IO::AIO::FALLOC_FL_KEEP_SIZE" to allocate
allocate space, or "IO::AIO::FALLOC_FL_PUNCH_HOLE | space, or "IO::AIO::FALLOC_FL_PUNCH_HOLE |
IO::AIO::FALLOC_FL_KEEP_SIZE", to deallocate a file range. IO::AIO::FALLOC_FL_KEEP_SIZE", to deallocate a file range.
IO::AIO also supports "FALLOC_FL_COLLAPSE_RANGE", to remove a range
(without leaving a hole) and "FALLOC_FL_ZERO_RANGE", to zero a range
(see your fallocate(2) manpage).
The file system block size used by "fallocate" is presumably the The file system block size used by "fallocate" is presumably the
"f_bsize" returned by "statvfs". "f_bsize" returned by "statvfs".
...@@ -1630,11 +1638,13 @@ FUNCTIONS ...@@ -1630,11 +1638,13 @@ FUNCTIONS
$flags can be a combination of "IO::AIO::MAP_SHARED" or $flags can be a combination of "IO::AIO::MAP_SHARED" or
"IO::AIO::MAP_PRIVATE", or a number of system-specific flags (when "IO::AIO::MAP_PRIVATE", or a number of system-specific flags (when
not available, the are defined as 0): "IO::AIO::MAP_ANONYMOUS" not available, the are 0): "IO::AIO::MAP_ANONYMOUS" (which is set to
(which is set to "MAP_ANON" if your system only provides this "MAP_ANON" if your system only provides this constant),
constant), "IO::AIO::MAP_HUGETLB", "IO::AIO::MAP_LOCKED", "IO::AIO::MAP_HUGETLB", "IO::AIO::MAP_LOCKED",
"IO::AIO::MAP_NORESERVE", "IO::AIO::MAP_POPULATE" or "IO::AIO::MAP_NORESERVE", "IO::AIO::MAP_POPULATE",
"IO::AIO::MAP_NONBLOCK" "IO::AIO::MAP_NONBLOCK", "IO::AIO::MAP_FIXED",
"IO::AIO::MAP_GROWSDOWN", "IO::AIO::MAP_32BIT",
"IO::AIO::MAP_HUGETLB" or "IO::AIO::MAP_STACK".
If $fh is "undef", then a file descriptor of -1 is passed. If $fh is "undef", then a file descriptor of -1 is passed.
...@@ -1691,6 +1701,26 @@ FUNCTIONS ...@@ -1691,6 +1701,26 @@ FUNCTIONS
fails with -1/"ENOSYS" everywhere else. If anybody knows how to fails with -1/"ENOSYS" everywhere else. If anybody knows how to
influence pipe buffer size on other systems, drop me a note. influence pipe buffer size on other systems, drop me a note.
($rfh, $wfh) = IO::AIO::pipe2 [$flags]
This is a direct interface to the Linux pipe2(2) system call. If
$flags is missing or 0, then this should be the same as a call to
perl's built-in "pipe" function and create a new pipe, and works on
systems that lack the pipe2 syscall. On win32, this case invokes
"_pipe (..., 4096, O_BINARY)".
If $flags is non-zero, it tries to invoke the pipe2 system call with
the given flags (Linux 2.6.27, glibc 2.9).
On success, the read and write file handles are returned.
On error, nothing will be returned. If the pipe2 syscall is missing
and $flags is non-zero, fails with "ENOSYS".
Please refer to pipe2(2) for more info on the $flags, but at the
time of this writing, "IO::AIO::O_CLOEXEC", "IO::AIO::O_NONBLOCK"
and "IO::AIO::O_DIRECT" (Linux 3.4, for packet-based pipes) were
supported.
EVENT LOOP INTEGRATION EVENT LOOP INTEGRATION
It is recommended to use AnyEvent::AIO to integrate IO::AIO It is recommended to use AnyEvent::AIO to integrate IO::AIO
automatically into many event loops: automatically into many event loops:
......
This diff is collapsed.
...@@ -69,6 +69,12 @@ ...@@ -69,6 +69,12 @@
#ifndef O_SYNC #ifndef O_SYNC
#define O_SYNC 0 #define O_SYNC 0
#endif #endif
#ifndef O_PATH
#define O_PATH 0
#endif
#ifndef O_TMPFILE
#define O_TMPFILE 0
#endif
#ifndef O_TTY_INIT #ifndef O_TTY_INIT
#define O_TTY_INIT 0 #define O_TTY_INIT 0
#endif #endif
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H #undef HAVE_MEMORY_H
/* pipe2(2) is available */
#undef HAVE_PIPE2
/* posix_fadvise(2) is available */ /* posix_fadvise(2) is available */
#undef HAVE_POSIX_FADVISE #undef HAVE_POSIX_FADVISE
......
This diff is collapsed.
...@@ -122,6 +122,7 @@ static void eio_destroy (eio_req *req); ...@@ -122,6 +122,7 @@ static void eio_destroy (eio_req *req);
#define chmod(path,mode) _chmod (path, mode) #define chmod(path,mode) _chmod (path, mode)
#define dup(fd) _dup (fd) #define dup(fd) _dup (fd)
#define dup2(fd1,fd2) _dup2 (fd1, fd2) #define dup2(fd1,fd2) _dup2 (fd1, fd2)
#define pipe(fds) _pipe (fds, 4096, O_BINARY)
#define fchmod(fd,mode) EIO_ENOSYS () #define fchmod(fd,mode) EIO_ENOSYS ()
#define chown(path,uid,gid) EIO_ENOSYS () #define chown(path,uid,gid) EIO_ENOSYS ()
...@@ -337,25 +338,7 @@ static void eio_destroy (eio_req *req); ...@@ -337,25 +338,7 @@ static void eio_destroy (eio_req *req);
/*****************************************************************************/ /*****************************************************************************/
struct tmpbuf struct etp_tmpbuf;
{
void *ptr;
int len;
};
static void *
tmpbuf_get (struct tmpbuf *buf, int len)
{
if (buf->len < len)
{
free (buf->ptr);
buf->ptr = malloc (buf->len = len);
}
return buf->ptr;
}
struct tmpbuf;
#if _POSIX_VERSION >= 200809L #if _POSIX_VERSION >= 200809L
#define HAVE_AT 1 #define HAVE_AT 1
...@@ -365,7 +348,7 @@ struct tmpbuf; ...@@ -365,7 +348,7 @@ struct tmpbuf;
#endif #endif
#else #else
#define HAVE_AT 0 #define HAVE_AT 0
static const char *wd_expand (struct tmpbuf *tmpbuf, eio_wd wd, const char *path); static const char *wd_expand (struct etp_tmpbuf *tmpbuf, eio_wd wd, const char *path);
#endif #endif
struct eio_pwd struct eio_pwd
...@@ -385,8 +368,14 @@ struct eio_pwd ...@@ -385,8 +368,14 @@ struct eio_pwd
#define ETP_TYPE_QUIT -1 #define ETP_TYPE_QUIT -1
#define ETP_TYPE_GROUP EIO_GROUP #define ETP_TYPE_GROUP EIO_GROUP
struct etp_worker; static void eio_nop_callback (void) { }
static void (*eio_want_poll_cb)(void) = eio_nop_callback;
static void (*eio_done_poll_cb)(void) = eio_nop_callback;
#define ETP_WANT_POLL(pool) eio_want_poll_cb ()
#define ETP_DONE_POLL(pool) eio_done_poll_cb ()
struct etp_worker;
#define ETP_REQ eio_req #define ETP_REQ eio_req
#define ETP_DESTROY(req) eio_destroy (req) #define ETP_DESTROY(req) eio_destroy (req)
static int eio_finish (eio_req *req); static int eio_finish (eio_req *req);
...@@ -396,6 +385,9 @@ static void eio_execute (struct etp_worker *self, eio_req *req); ...@@ -396,6 +385,9 @@ static void eio_execute (struct etp_worker *self, eio_req *req);
#include "etp.c" #include "etp.c"
static struct etp_pool eio_pool;
#define EIO_POOL (&eio_pool)
/*****************************************************************************/ /*****************************************************************************/
static void static void
...@@ -403,12 +395,12 @@ grp_try_feed (eio_req *grp) ...@@ -403,12 +395,12 @@ grp_try_feed (eio_req *grp)
{ {
while (grp->size < grp->int2 && !EIO_CANCELLED (grp)) while (grp->size < grp->int2 && !EIO_CANCELLED (grp))
{ {
grp->flags &= ~EIO_FLAG_GROUPADD; grp->flags &= ~ETP_FLAG_GROUPADD;
EIO_FEED (grp); EIO_FEED (grp);
/* stop if no progress has been made */ /* stop if no progress has been made */
if (!(grp->flags & EIO_FLAG_GROUPADD)) if (!(grp->flags & ETP_FLAG_GROUPADD))
{ {
grp->feed = 0; grp->feed = 0;
break; break;
...@@ -425,7 +417,7 @@ grp_dec (eio_req *grp) ...@@ -425,7 +417,7 @@ grp_dec (eio_req *grp)
grp_try_feed (grp); grp_try_feed (grp);
/* finish, if done */ /* finish, if done */
if (!grp->size && grp->int1) if (!grp->size && grp->flags & ETP_FLAG_DELAYED)
return eio_finish (grp); return eio_finish (grp);
else else
return 0; return 0;
...@@ -471,84 +463,84 @@ eio_finish (eio_req *req) ...@@ -471,84 +463,84 @@ eio_finish (eio_req *req)
void void
eio_grp_cancel (eio_req *grp) eio_grp_cancel (eio_req *grp)
{ {
etp_grp_cancel (grp); etp_grp_cancel (EIO_POOL, grp);
} }
void void
eio_cancel (eio_req *req) eio_cancel (eio_req *req)
{ {
etp_cancel (req); etp_cancel (EIO_POOL, req);
} }
void void
eio_submit (eio_req *req) eio_submit (eio_req *req)
{ {
etp_submit (req); etp_submit (EIO_POOL, req);
} }
unsigned int unsigned int
eio_nreqs (void) eio_nreqs (void)
{ {
return etp_nreqs (); return etp_nreqs (EIO_POOL);
} }
unsigned int unsigned int
eio_nready (void) eio_nready (void)
{ {
return etp_nready (); return etp_nready (EIO_POOL);
} }
unsigned int unsigned int
eio_npending (void) eio_npending (void)
{ {
return etp_npending (); return etp_npending (EIO_POOL);
} }
unsigned int ecb_cold unsigned int ecb_cold
eio_nthreads (void) eio_nthreads (void)
{ {
return etp_nthreads (); return etp_nthreads (EIO_POOL);
} }
void ecb_cold void ecb_cold
eio_set_max_poll_time (double nseconds) eio_set_max_poll_time (double nseconds)
{ {
etp_set_max_poll_time (nseconds); etp_set_max_poll_time (EIO_POOL, nseconds);
} }
void ecb_cold void ecb_cold
eio_set_max_poll_reqs (unsigned int maxreqs) eio_set_max_poll_reqs (unsigned int maxreqs)
{ {
etp_set_max_poll_reqs (maxreqs); etp_set_max_poll_reqs (EIO_POOL, maxreqs);
} }
void ecb_cold void ecb_cold
eio_set_max_idle (unsigned int nthreads) eio_set_max_idle (unsigned int nthreads)
{ {
etp_set_max_idle (nthreads); etp_set_max_idle (EIO_POOL, nthreads);
} }
void ecb_cold void ecb_cold
eio_set_idle_timeout (unsigned int seconds) eio_set_idle_timeout (unsigned int seconds)
{ {
etp_set_idle_timeout (seconds); etp_set_idle_timeout (EIO_POOL, seconds);
} }
void ecb_cold void ecb_cold
eio_set_min_parallel (unsigned int nthreads) eio_set_min_parallel (unsigned int nthreads)
{ {
etp_set_min_parallel (nthreads); etp_set_min_parallel (EIO_POOL, nthreads);
} }
void ecb_cold void ecb_cold
eio_set_max_parallel (unsigned int nthreads) eio_set_max_parallel (unsigned int nthreads)
{ {
etp_set_max_parallel (nthreads); etp_set_max_parallel (EIO_POOL, nthreads);
} }
int eio_poll (void) int eio_poll (void)
{ {
return etp_poll (); return etp_poll (EIO_POOL);
} }
/*****************************************************************************/ /*****************************************************************************/
...@@ -968,7 +960,7 @@ eio__lseek (eio_req *req) ...@@ -968,7 +960,7 @@ eio__lseek (eio_req *req)
/* result will always end up in tmpbuf, there is always space for adding a 0-byte */ /* result will always end up in tmpbuf, there is always space for adding a 0-byte */
static int static int
eio__realpath (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) eio__realpath (struct etp_tmpbuf *tmpbuf, eio_wd wd, const char *path)
{ {
char *res; char *res;
const char *rel = path; const char *rel = path;
...@@ -987,7 +979,7 @@ eio__realpath (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) ...@@ -987,7 +979,7 @@ eio__realpath (struct tmpbuf *tmpbuf, eio_wd wd, const char *path)
if (!*rel) if (!*rel)
return -1; return -1;
res = tmpbuf_get (tmpbuf, PATH_MAX * 3); res = etp_tmpbuf_get (tmpbuf, PATH_MAX * 3);
#ifdef _WIN32 #ifdef _WIN32
if (_access (rel, 4) != 0) if (_access (rel, 4) != 0)
return -1; return -1;
...@@ -1606,7 +1598,7 @@ eio__scandir (eio_req *req, etp_worker *self) ...@@ -1606,7 +1598,7 @@ eio__scandir (eio_req *req, etp_worker *self)
/* a bit like realpath, but usually faster because it doesn'T have to return */ /* a bit like realpath, but usually faster because it doesn'T have to return */
/* an absolute or canonical path */</