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:
print $contents;
# exit event loop and program
EV::unloop;
EV::break;
};
};
......@@ -104,7 +104,7 @@ F</etc/passwd> asynchronously:
# check for sockets etc. etc.
# process events as long as there are some:
EV::loop;
EV::run;
=head1 REQUEST ANATOMY AND LIFETIME
......@@ -169,7 +169,7 @@ use common::sense;
use base 'Exporter';
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
aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx
......@@ -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_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)
......@@ -628,8 +628,9 @@ Linux - it is safe to hardcode these when C<$^O> is C<linux>:
0x0000f15f ecryptfs
0x00414a53 efs
0x0000137d ext
0x0000ef53 ext2/ext3
0x0000ef53 ext2/ext3/ext4
0x0000ef51 ext2
0xf2f52010 f2fs
0x00004006 fat
0x65735546 fuseblk
0x65735543 fusectl
......@@ -638,6 +639,7 @@ Linux - it is safe to hardcode these when C<$^O> is C<linux>:
0x47504653 gpfs
0x00004244 hfs
0xf995e849 hpfs
0x00c0ffee hostfs
0x958458f6 hugetlbfs
0x2bad1dea inotifyfs
0x00009660 isofs
......@@ -662,6 +664,7 @@ Linux - it is safe to hardcode these when C<$^O> is C<linux>:
0x00009fa0 proc
0x6165676c pstorefs
0x0000002f qnx4
0x68191122 qnx6
0x858458f6 ramfs
0x52654973 reiserfs
0x00007275 romfs
......@@ -727,9 +730,13 @@ Works like truncate(2) or ftruncate(2).
Allocates or frees disk space according to the C<$mode> argument. See the
linux C<fallocate> documentation for details.
C<$mode> can currently be C<0> or C<IO::AIO::FALLOC_FL_KEEP_SIZE>
to allocate space, or C<IO::AIO::FALLOC_FL_PUNCH_HOLE |
IO::AIO::FALLOC_FL_KEEP_SIZE>, to deallocate a file range.
C<$mode> is usually C<0> or C<IO::AIO::FALLOC_FL_KEEP_SIZE> to allocate
space, or C<IO::AIO::FALLOC_FL_PUNCH_HOLE | IO::AIO::FALLOC_FL_KEEP_SIZE>,
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
C<f_bsize> returned by C<statvfs>.
......@@ -2055,13 +2062,21 @@ filesize.
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<$flags> can be a combination of C<IO::AIO::MAP_SHARED> or
C<IO::AIO::MAP_PRIVATE>, or a number of system-specific flags (when
not available, the are defined as 0): C<IO::AIO::MAP_ANONYMOUS>
(which is set to C<MAP_ANON> if your system only provides this
constant), C<IO::AIO::MAP_HUGETLB>, C<IO::AIO::MAP_LOCKED>,
C<IO::AIO::MAP_NORESERVE>, C<IO::AIO::MAP_POPULATE> or
C<IO::AIO::MAP_NONBLOCK>
C<$flags> can be a combination of
C<IO::AIO::MAP_SHARED> or
C<IO::AIO::MAP_PRIVATE>,
or a number of system-specific flags (when not available, the are C<0>):
C<IO::AIO::MAP_ANONYMOUS> (which is set to C<MAP_ANON> if your system only provides this constant),
C<IO::AIO::MAP_HUGETLB>,
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.
......@@ -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
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
=cut
......
......@@ -147,6 +147,7 @@ static void req_destroy (eio_req *grp);
#endif
/* defines all sorts of constants to 0 unless they are already defined */
/* also provides const_iv_ and const_niv_ macros for them */
#include "def0.h"
#ifndef makedev
......@@ -341,6 +342,31 @@ SvAIO_WD (SV *sv)
return (aio_wd)(long)SvIVX (SvRV (sv));
}
static SV *
newmortalFH (int fd, int flags)
{
if (fd < 0)
return &PL_sv_undef;
GV *gv = (GV *)sv_newmortal ();
char sym[64];
int symlen;
symlen = snprintf (sym, sizeof (sym), "fd#%d", fd);
gv_init (gv, aio_stash, sym, symlen, 0);
symlen = snprintf (
sym,
sizeof (sym),
"%s&=%d",
flags == O_RDONLY ? "<" : flags == O_WRONLY ? ">" : "+<",
fd
);
return do_open (gv, sym, symlen, 0, 0, 0, 0)
? (SV *)gv : &PL_sv_undef;
}
static void
aio_grp_feed (aio_req grp)
{
......@@ -476,34 +502,7 @@ req_invoke (eio_req *req)
break;
case EIO_OPEN:
{
/* convert fd to fh */
SV *fh = &PL_sv_undef;
if (req->result >= 0)
{
GV *gv = (GV *)sv_newmortal ();
int flags = req->int1 & (O_RDONLY | O_WRONLY | O_RDWR);
char sym [64];
int symlen;
symlen = snprintf (sym, sizeof (sym), "fd#%d", (int)req->result);
gv_init (gv, aio_stash, sym, symlen, 0);
symlen = snprintf (
sym,
sizeof (sym),
"%s&=%d",
flags == O_RDONLY ? "<" : flags == O_WRONLY ? ">" : "+<",
(int)req->result
);
if (do_open (gv, sym, symlen, 0, 0, 0, 0))
fh = (SV *)gv;
}
PUSHs (fh);
}
PUSHs (newmortalFH (req->result, req->int1 & (O_RDONLY | O_WRONLY | O_RDWR)));
break;
case EIO_STATVFS:
......@@ -707,14 +706,14 @@ poll_wait (void)
{
int size;
X_LOCK (reslock);
size = res_queue.size;
X_UNLOCK (reslock);
X_LOCK (EIO_POOL->reslock);
size = EIO_POOL->res_queue.size;
X_UNLOCK (EIO_POOL->reslock);
if (size)
return;
etp_maybe_start_thread ();
etp_maybe_start_thread (EIO_POOL);
s_epipe_wait (&respipe);
}
......@@ -755,11 +754,6 @@ reinit (void)
#if !_POSIX_MEMORY_PROTECTION
# define mprotect(addr,len,prot) EIO_ENOSYS ()
# define PROT_NONE 0
# define PROT_WRITE 0
# define MAP_PRIVATE 0
# define MAP_SHARED 0
# define MAP_FIXED 0
#endif
#define MMAP_MAGIC PERL_MAGIC_ext
......@@ -909,12 +903,30 @@ BOOT:
# define const_iv(name) { # name, (IV) name },
# define const_eio(name) { # name, (IV) EIO_ ## name },
/* you have to re-run ./gendef0 after adding/Removing any constants here */
/* you have to re-run ./gendef0 after adding/removing any constants here */
/* the first block can be undef if missing */
const_iv (ENOSYS)
const_iv (EXDEV)
const_iv (EBADR)
/* for lseek */
const_iv (SEEK_DATA)
const_iv (SEEK_HOLE)
const_niv (FADV_NORMAL , POSIX_FADV_NORMAL)
const_niv (FADV_SEQUENTIAL, POSIX_FADV_SEQUENTIAL)
const_niv (FADV_RANDOM , POSIX_FADV_RANDOM)
const_niv (FADV_NOREUSE , POSIX_FADV_NOREUSE)
const_niv (FADV_WILLNEED , POSIX_FADV_WILLNEED)
const_niv (FADV_DONTNEED , POSIX_FADV_DONTNEED)
const_niv (MADV_NORMAL , POSIX_MADV_NORMAL)
const_niv (MADV_SEQUENTIAL, POSIX_MADV_SEQUENTIAL)
const_niv (MADV_RANDOM , POSIX_MADV_RANDOM)
const_niv (MADV_WILLNEED , POSIX_MADV_WILLNEED)
const_niv (MADV_DONTNEED , POSIX_MADV_DONTNEED)
/* the second block will be 0 when missing */
const_iv (O_RDONLY)
const_iv (O_WRONLY)
const_iv (O_RDWR)
......@@ -937,6 +949,8 @@ BOOT:
const_iv (O_DSYNC)
const_iv (O_RSYNC)
const_iv (O_SYNC)
const_iv (O_PATH)
const_iv (O_TMPFILE)
const_iv (O_TTY_INIT)
const_iv (S_IFIFO)
......@@ -949,19 +963,6 @@ BOOT:
const_iv (S_IFSOCK)
const_iv (S_IFMT)
const_niv (FADV_NORMAL , POSIX_FADV_NORMAL)
const_niv (FADV_SEQUENTIAL, POSIX_FADV_SEQUENTIAL)
const_niv (FADV_RANDOM , POSIX_FADV_RANDOM)
const_niv (FADV_NOREUSE , POSIX_FADV_NOREUSE)
const_niv (FADV_WILLNEED , POSIX_FADV_WILLNEED)
const_niv (FADV_DONTNEED , POSIX_FADV_DONTNEED)
const_niv (MADV_NORMAL , POSIX_MADV_NORMAL)
const_niv (MADV_SEQUENTIAL, POSIX_MADV_SEQUENTIAL)
const_niv (MADV_RANDOM , POSIX_MADV_RANDOM)
const_niv (MADV_WILLNEED , POSIX_MADV_WILLNEED)
const_niv (MADV_DONTNEED , POSIX_MADV_DONTNEED)
const_iv (ST_RDONLY)
const_iv (ST_NOSUID)
const_iv (ST_NODEV)
......@@ -980,9 +981,9 @@ BOOT:
const_iv (PROT_READ)
const_iv (PROT_WRITE)
/*const_iv (MAP_FIXED)*/
const_iv (MAP_PRIVATE)
const_iv (MAP_SHARED)
const_iv (MAP_FIXED)
const_iv (MAP_ANONYMOUS)
/* linuxish */
......@@ -991,6 +992,10 @@ BOOT:
const_iv (MAP_NORESERVE)
const_iv (MAP_POPULATE)
const_iv (MAP_NONBLOCK)
const_iv (MAP_GROWSDOWN)
const_iv (MAP_32BIT)
const_iv (MAP_HUGETLB)
const_iv (MAP_STACK)
const_iv (FIEMAP_FLAG_SYNC)
const_iv (FIEMAP_FLAG_XATTR)
......@@ -1012,10 +1017,7 @@ BOOT:
const_iv (SPLICE_F_MORE)
const_iv (SPLICE_F_GIFT)
const_iv (SEEK_DATA)
const_iv (SEEK_HOLE)
/* libeio constants */
/* these are libeio constants, and are independent of gendef0 */
const_eio (SEEK_SET)
const_eio (SEEK_CUR)
const_eio (SEEK_END)
......@@ -1035,6 +1037,8 @@ BOOT:
const_eio (FALLOC_FL_KEEP_SIZE)
const_eio (FALLOC_FL_PUNCH_HOLE)
const_eio (FALLOC_FL_COLLAPSE_RANGE)
const_eio (FALLOC_FL_ZERO_RANGE)
const_eio (READDIR_DENTS)
const_eio (READDIR_DIRS_FIRST)
......@@ -1112,7 +1116,7 @@ max_outstanding (unsigned int maxreqs)
max_outstanding = maxreqs;
void
aio_wd (SV8 *pathname, SV *callback=&PL_sv_undef)
aio_wd (SV8 *pathname, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
......@@ -1124,7 +1128,7 @@ aio_wd (SV8 *pathname, SV *callback=&PL_sv_undef)
}
void
aio_open (SV8 *pathname, int flags, int mode, SV *callback=&PL_sv_undef)
aio_open (SV8 *pathname, int flags, int mode, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
......@@ -1138,7 +1142,7 @@ aio_open (SV8 *pathname, int flags, int mode, SV *callback=&PL_sv_undef)
}
void
aio_fsync (SV *fh, SV *callback=&PL_sv_undef)
aio_fsync (SV *fh, SV *callback = &PL_sv_undef)
ALIAS:
aio_fsync = EIO_FSYNC
aio_fdatasync = EIO_FDATASYNC
......@@ -1156,7 +1160,7 @@ aio_fsync (SV *fh, SV *callback=&PL_sv_undef)
}
void
aio_sync_file_range (SV *fh, off_t offset, size_t nbytes, UV flags, SV *callback=&PL_sv_undef)
aio_sync_file_range (SV *fh, off_t offset, size_t nbytes, UV flags, SV *callback = &PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
......@@ -1173,7 +1177,7 @@ aio_sync_file_range (SV *fh, off_t offset, size_t nbytes, UV flags, SV *callback
}
void
aio_allocate (SV *fh, int mode, off_t offset, size_t len, SV *callback=&PL_sv_undef)
aio_allocate (SV *fh, int mode, off_t offset, size_t len, SV *callback = &PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
......@@ -1190,7 +1194,7 @@ aio_allocate (SV *fh, int mode, off_t offset, size_t len, SV *callback=&PL_sv_un
}
void
aio_close (SV *fh, SV *callback=&PL_sv_undef)
aio_close (SV *fh, SV *callback = &PL_sv_undef)
PPCODE:
{
static int close_fd = -1; /* dummy fd to close fds via dup2 */
......@@ -1224,7 +1228,7 @@ aio_close (SV *fh, SV *callback=&PL_sv_undef)
}
void
aio_seek (SV *fh, SV *offset, int whence, SV *callback=&PL_sv_undef)
aio_seek (SV *fh, SV *offset, int whence, SV *callback = &PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
......@@ -1240,7 +1244,7 @@ aio_seek (SV *fh, SV *offset, int whence, SV *callback=&PL_sv_undef)
}
void
aio_read (SV *fh, SV *offset, SV *length, SV8 *data, IV dataoffset, SV *callback=&PL_sv_undef)
aio_read (SV *fh, SV *offset, SV *length, SV8 *data, IV dataoffset, SV *callback = &PL_sv_undef)
ALIAS:
aio_read = EIO_READ
aio_write = EIO_WRITE
......@@ -1295,7 +1299,7 @@ aio_read (SV *fh, SV *offset, SV *length, SV8 *data, IV dataoffset, SV *callback
}
void
aio_readlink (SV8 *pathname, SV *callback=&PL_sv_undef)
aio_readlink (SV8 *pathname, SV *callback = &PL_sv_undef)
ALIAS:
aio_readlink = EIO_READLINK
aio_realpath = EIO_REALPATH
......@@ -1310,7 +1314,7 @@ aio_readlink (SV8 *pathname, SV *callback=&PL_sv_undef)
}
void
aio_sendfile (SV *out_fh, SV *in_fh, off_t in_offset, size_t length, SV *callback=&PL_sv_undef)
aio_sendfile (SV *out_fh, SV *in_fh, off_t in_offset, size_t length, SV *callback = &PL_sv_undef)
PPCODE:
{
int ifd = s_fileno_croak (in_fh , 0);
......@@ -1329,7 +1333,7 @@ aio_sendfile (SV *out_fh, SV *in_fh, off_t in_offset, size_t length, SV *callbac
}
void
aio_readahead (SV *fh, off_t offset, size_t length, SV *callback=&PL_sv_undef)
aio_readahead (SV *fh, off_t offset, size_t length, SV *callback = &PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
......@@ -1345,7 +1349,7 @@ aio_readahead (SV *fh, off_t offset, size_t length, SV *callback=&PL_sv_undef)
}
void
aio_stat (SV8 *fh_or_path, SV *callback=&PL_sv_undef)
aio_stat (SV8 *fh_or_path, SV *callback = &PL_sv_undef)
ALIAS:
aio_stat = EIO_STAT
aio_lstat = EIO_LSTAT
......@@ -1376,7 +1380,7 @@ makedev (UV maj, UV min)
RETVAL
void
aio_utime (SV8 *fh_or_path, SV *atime, SV *mtime, SV *callback=&PL_sv_undef)
aio_utime (SV8 *fh_or_path, SV *atime, SV *mtime, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
......@@ -1389,7 +1393,7 @@ aio_utime (SV8 *fh_or_path, SV *atime, SV *mtime, SV *callback=&PL_sv_undef)
}
void
aio_truncate (SV8 *fh_or_path, SV *offset, SV *callback=&PL_sv_undef)
aio_truncate (SV8 *fh_or_path, SV *offset, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
......@@ -1401,7 +1405,7 @@ aio_truncate (SV8 *fh_or_path, SV *offset, SV *callback=&PL_sv_undef)
}
void
aio_chmod (SV8 *fh_or_path, int mode, SV *callback=&PL_sv_undef)
aio_chmod (SV8 *fh_or_path, int mode, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
......@@ -1413,7 +1417,7 @@ aio_chmod (SV8 *fh_or_path, int mode, SV *callback=&PL_sv_undef)
}
void
aio_chown (SV8 *fh_or_path, SV *uid, SV *gid, SV *callback=&PL_sv_undef)
aio_chown (SV8 *fh_or_path, SV *uid, SV *gid, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
......@@ -1426,7 +1430,7 @@ aio_chown (SV8 *fh_or_path, SV *uid, SV *gid, SV *callback=&PL_sv_undef)
}
void
aio_readdirx (SV8 *pathname, IV flags, SV *callback=&PL_sv_undef)
aio_readdirx (SV8 *pathname, IV flags, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
......@@ -1443,7 +1447,7 @@ aio_readdirx (SV8 *pathname, IV flags, SV *callback=&PL_sv_undef)
}
void
aio_mkdir (SV8 *pathname, int mode, SV *callback=&PL_sv_undef)
aio_mkdir (SV8 *pathname, int mode, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
......@@ -1456,7 +1460,7 @@ aio_mkdir (SV8 *pathname, int mode, SV *callback=&PL_sv_undef)
}
void
aio_unlink (SV8 *pathname, SV *callback=&PL_sv_undef)
aio_unlink (SV8 *pathname, SV *callback = &PL_sv_undef)
ALIAS:
aio_unlink = EIO_UNLINK
aio_rmdir = EIO_RMDIR
......@@ -1472,7 +1476,7 @@ aio_unlink (SV8 *pathname, SV *callback=&PL_sv_undef)
}
void
aio_link (SV8 *oldpath, SV8 *newpath, SV *callback=&PL_sv_undef)
aio_link (SV8 *oldpath, SV8 *newpath, SV *callback = &PL_sv_undef)
ALIAS:
aio_link = EIO_LINK
aio_symlink = EIO_SYMLINK
......@@ -1491,7 +1495,7 @@ aio_link (SV8 *oldpath, SV8 *newpath, SV *callback=&PL_sv_undef)
}
void
aio_mknod (SV8 *pathname, int mode, UV dev, SV *callback=&PL_sv_undef)
aio_mknod (SV8 *pathname, int mode, UV dev, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
......@@ -1505,7 +1509,7 @@ aio_mknod (SV8 *pathname, int mode, UV dev, SV *callback=&PL_sv_undef)
}
void
aio_mtouch (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, int flags = 0, SV *callback=&PL_sv_undef)
aio_mtouch (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, int flags = 0, SV *callback = &PL_sv_undef)
ALIAS:
aio_mtouch = EIO_MTOUCH
aio_msync = EIO_MSYNC
......@@ -1538,7 +1542,7 @@ aio_mtouch (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, int flags = 0,
}
void
aio_mlock (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, SV *callback=&PL_sv_undef)
aio_mlock (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, SV *callback = &PL_sv_undef)
PPCODE:
{
STRLEN svlen;
......@@ -1567,7 +1571,7 @@ aio_mlock (SV8 *data, IV offset = 0, SV *length = &PL_sv_undef, SV *callback=&PL
}
void
aio_mlockall (IV flags, SV *callback=&PL_sv_undef)
aio_mlockall (IV flags, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
......@@ -1579,7 +1583,7 @@ aio_mlockall (IV flags, SV *callback=&PL_sv_undef)
}
void
aio_fiemap (SV *fh, off_t start, SV *length, U32 flags, SV *count, SV *callback=&PL_sv_undef)
aio_fiemap (SV *fh, off_t start, SV *length, U32 flags, SV *count, SV *callback = &PL_sv_undef)
PPCODE:
{
int fd = s_fileno_croak (fh, 0);
......@@ -1602,7 +1606,7 @@ aio_fiemap (SV *fh, off_t start, SV *length, U32 flags, SV *count, SV *callback=
}
void
aio_busy (double delay, SV *callback=&PL_sv_undef)
aio_busy (double delay, SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
......@@ -1614,7 +1618,7 @@ aio_busy (double delay, SV *callback=&PL_sv_undef)
}
void
aio_group (SV *callback=&PL_sv_undef)
aio_group (SV *callback = &PL_sv_undef)
PPCODE:
{
dREQ;
......@@ -1629,7 +1633,7 @@ aio_group (SV *callback=&PL_sv_undef)
}
void
aio_nop (SV *callback=&PL_sv_undef)
aio_nop (SV *callback = &PL_sv_undef)
ALIAS:
aio_nop = EIO_NOP
aio_sync = EIO_SYNC
......@@ -1643,7 +1647,7 @@ aio_nop (SV *callback=&PL_sv_undef)
}
int
aioreq_pri (int pri = 0)
aioreq_pri (int pri = NO_INIT)
CODE:
RETVAL = next_pri;
if (items > 0)
......@@ -1894,6 +1898,31 @@ pipesize (aio_rfd rfh, int new_size = -1)
OUTPUT:
RETVAL
void
pipe2 (int flags = 0)
PROTOTYPE: ;$
PPCODE:
{
int fd[2];
int res;
if (flags)
#if HAVE_PIPE2
res = pipe2 (fd, flags);
#else
res = (errno = ENOSYS, -1);
#endif
else
res = pipe (fd);
if (!res)
{
EXTEND (SP, 2);
PUSHs (newmortalFH (fd[0], O_RDONLY));
PUSHs (newmortalFH (fd[1], O_WRONLY));
}
}
void _on_next_submit (SV *cb)
CODE:
SvREFCNT_dec (on_next_submit);
......@@ -1937,7 +1966,7 @@ cancel (aio_req_ornot req)
eio_cancel (req);
void
cb (aio_req_ornot req, SV *callback=&PL_sv_undef)
cb (aio_req_ornot req, SV *callback = NO_INIT)
PPCODE:
{
if (GIMME_V != G_VOID)
......@@ -1945,7 +1974,7 @@ cb (aio_req_ornot req, SV *callback=&PL_sv_undef)
if (items > 1)
{
SV *cb_cv =get_cb (callback);
SV *cb_cv = get_cb (callback);
SvREFCNT_dec (req->callback);
req->callback = SvREFCNT_inc (cb_cv);
......@@ -2012,7 +2041,7 @@ limit (aio_req grp, int limit)
eio_grp_limit (grp, limit);
void
feed (aio_req grp, SV *callback=&PL_sv_undef)
feed (aio_req grp, SV *callback = &PL_sv_undef)
CODE:
{
SvREFCNT_dec (grp->sv2);
......
......@@ -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: 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
- replace off_t by STRLEN where appropriate, should not result in
......
......@@ -4,7 +4,7 @@
"unknown"
],
"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"
],
......@@ -27,7 +27,8 @@
},
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
"Canary::Stability" : "2001",
"ExtUtils::MakeMaker" : "6.52"
}
},
"runtime" : {
......@@ -37,5 +38,5 @@
}
},
"release_status" : "stable",
"version" : 4.32
"version" : 4.33
}
......@@ -5,9 +5,10 @@ author:
build_requires:
ExtUtils::MakeMaker: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
Canary::Stability: '2001'
ExtUtils::MakeMaker: '6.52'
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
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
......@@ -19,4 +20,4 @@ no_index:
- inc
requires:
common::sense: '0'
version: 4.32
version: 4.33
use 5.008002;
use Canary::Stability IO::AIO => 1, 5.008002;
use ExtUtils::MakeMaker;
......@@ -110,6 +110,7 @@ my $mm = MM->new({
PM => {
'AIO.pm' => '$(INST_LIB)/IO/AIO.pm',
},
CONFIGURE_REQUIRES => { ExtUtils::MakeMaker => 6.52, Canary::Stability => 2001 },
PREREQ_PM => {
"common::sense" => 0,
},
......
......@@ -92,7 +92,7 @@ DESCRIPTION
print $contents;
# exit event loop and program
EV::unloop;
EV::break;
};
};
......@@ -100,7 +100,7 @@ DESCRIPTION
# check for sockets etc. etc.
# process events as long as there are some:
EV::loop;
EV::run;
REQUEST ANATOMY AND LIFETIME
Every "aio_*" function creates a request. which is a C data structure
......@@ -332,7 +332,8 @@ FUNCTIONS
"O_ASYNC", "O_DIRECT", "O_NOATIME", "O_CLOEXEC", "O_NOCTTY",
"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)
Asynchronously close a file and call the callback with the result
......@@ -555,8 +556,9 @@ FUNCTIONS
0x0000f15f ecryptfs
0x00414a53 efs
0x0000137d ext
0x0000ef53 ext2/ext3
0x0000ef53 ext2/ext3/ext4
0x0000ef51 ext2
0xf2f52010 f2fs
0x00004006 fat
0x65735546 fuseblk
0x65735543 fusectl
......@@ -565,6 +567,7 @@ FUNCTIONS
0x47504653 gpfs
0x00004244 hfs
0xf995e849 hpfs
0x00c0ffee hostfs
0x958458f6 hugetlbfs
0x2bad1dea inotifyfs
0x00009660 isofs
......@@ -589,6 +592,7 @@ FUNCTIONS
0x00009fa0 proc
0x6165676c pstorefs
0x0000002f qnx4
0x68191122 qnx6
0x858458f6 ramfs
0x52654973 reiserfs
0x00007275 romfs
......@@ -648,10 +652,14 @@ FUNCTIONS
Allocates or frees disk space according to the $mode argument. See
the linux "fallocate" documentation for details.
$mode can currently be 0 or "IO::AIO::FALLOC_FL_KEEP_SIZE" to
allocate space, or "IO::AIO::FALLOC_FL_PUNCH_HOLE |
$mode is usually 0 or "IO::AIO::FALLOC_FL_KEEP_SIZE" to allocate
space, or "IO::AIO::FALLOC_FL_PUNCH_HOLE |
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
"f_bsize" returned by "statvfs".
......@@ -1630,11 +1638,13 @@ FUNCTIONS
$flags can be a combination of "IO::AIO::MAP_SHARED" or
"IO::AIO::MAP_PRIVATE", or a number of system-specific flags (when
not available, the are defined as 0): "IO::AIO::MAP_ANONYMOUS"
(which is set to "MAP_ANON" if your system only provides this
constant), "IO::AIO::MAP_HUGETLB", "IO::AIO::MAP_LOCKED",
"IO::AIO::MAP_NORESERVE", "IO::AIO::MAP_POPULATE" or
"IO::AIO::MAP_NONBLOCK"
not available, the are 0): "IO::AIO::MAP_ANONYMOUS" (which is set to
"MAP_ANON" if your system only provides this constant),
"IO::AIO::MAP_HUGETLB", "IO::AIO::MAP_LOCKED",
"IO::AIO::MAP_NORESERVE", "IO::AIO::MAP_POPULATE",
"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.
......@@ -1691,6 +1701,26 @@ FUNCTIONS
fails with -1/"ENOSYS" everywhere else. If anybody knows how to
influence pipe buffer size on other systems, drop me a note.
($rfh, $wfh) = IO::AIO::pipe2 [$flags]