diff -Nru libio-aio-perl-4.32/AIO.pm libio-aio-perl-4.33/AIO.pm --- libio-aio-perl-4.32/AIO.pm 2015-02-11 19:32:24.000000000 +0000 +++ libio-aio-perl-4.33/AIO.pm 2016-01-18 11:50:47.000000000 +0000 @@ -96,7 +96,7 @@ print $contents; # exit event loop and program - EV::unloop; + EV::break; }; }; @@ -104,7 +104,7 @@ # 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 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 @@ C, C, C, C, C, C, C, C, C, C, C, -C, C and C. +C, C, C, C, and C. =item aio_close $fh, $callback->($status) @@ -628,8 +628,9 @@ 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 @@ 0x47504653 gpfs 0x00004244 hfs 0xf995e849 hpfs + 0x00c0ffee hostfs 0x958458f6 hugetlbfs 0x2bad1dea inotifyfs 0x00009660 isofs @@ -662,6 +664,7 @@ 0x00009fa0 proc 0x6165676c pstorefs 0x0000002f qnx4 + 0x68191122 qnx6 0x858458f6 ramfs 0x52654973 reiserfs 0x00007275 romfs @@ -727,9 +730,13 @@ Allocates or frees disk space according to the C<$mode> argument. See the linux C documentation for details. -C<$mode> can currently be C<0> or C -to allocate space, or C, to deallocate a file range. +C<$mode> is usually C<0> or C to allocate +space, or C, +to deallocate a file range. + +IO::AIO also supports C, to remove a range +(without leaving a hole) and C, to zero a range (see +your L manpage). The file system block size used by C is presumably the C returned by C. @@ -2055,13 +2062,21 @@ C<$prot> is a combination of C, C, C and/or C, -C<$flags> can be a combination of C or -C, or a number of system-specific flags (when -not available, the are defined as 0): C -(which is set to C if your system only provides this -constant), C, C, -C, C or -C +C<$flags> can be a combination of +C or +C, +or a number of system-specific flags (when not available, the are C<0>): +C (which is set to C if your system only provides this constant), +C, +C, +C, +C, +C, +C, +C, +C, +C or +C. If C<$fh> is C, then a file descriptor of C<-1> is passed. @@ -2124,6 +2139,26 @@ C<-1>/C 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 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 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. + +Please refer to L for more info on the C<$flags>, but at the +time of this writing, C, C and +C (Linux 3.4, for packet-based pipes) were supported. + =back =cut diff -Nru libio-aio-perl-4.32/AIO.xs libio-aio-perl-4.33/AIO.xs --- libio-aio-perl-4.32/AIO.xs 2014-11-21 14:49:56.000000000 +0000 +++ libio-aio-perl-4.33/AIO.xs 2015-06-25 18:07:47.000000000 +0000 @@ -147,6 +147,7 @@ #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 @@ 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 @@ 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 @@ { 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 @@ #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 @@ # 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 = 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } 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 @@ } void -aio_group (SV *callback=&PL_sv_undef) +aio_group (SV *callback = &PL_sv_undef) PPCODE: { dREQ; @@ -1629,7 +1633,7 @@ } 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 @@ } int -aioreq_pri (int pri = 0) +aioreq_pri (int pri = NO_INIT) CODE: RETVAL = next_pri; if (items > 0) @@ -1894,6 +1898,31 @@ 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 @@ 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 @@ 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 @@ 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); diff -Nru libio-aio-perl-4.32/Changes libio-aio-perl-4.33/Changes --- libio-aio-perl-4.32/Changes 2015-02-11 19:32:20.000000000 +0000 +++ libio-aio-perl-4.33/Changes 2016-01-18 11:50:31.000000000 +0000 @@ -34,6 +34,20 @@ 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 diff -Nru libio-aio-perl-4.32/configure libio-aio-perl-4.33/configure --- libio-aio-perl-4.32/configure 2012-06-02 20:13:11.000000000 +0000 +++ libio-aio-perl-4.33/configure 2015-06-25 13:03:55.000000000 +0000 @@ -1,11 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67. +# Generated by GNU Autoconf 2.69. # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -89,6 +87,7 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -133,6 +132,31 @@ # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -166,7 +190,8 @@ else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -211,14 +236,25 @@ if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -320,6 +356,14 @@ } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -441,6 +485,10 @@ chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -475,16 +523,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -496,28 +544,8 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -1058,7 +1086,7 @@ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac @@ -1109,8 +1137,6 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1336,9 +1362,9 @@ if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.67 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1382,7 +1408,7 @@ ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile @@ -1419,7 +1445,7 @@ ac_retval=1 fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp @@ -1432,10 +1458,10 @@ ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval "test \"\${$3+set}\"" = set; then : + if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 @@ -1498,7 +1524,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" @@ -1507,7 +1533,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel @@ -1548,7 +1574,7 @@ ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run @@ -1562,7 +1588,7 @@ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } -if eval "test \"\${$3+set}\"" = set; then : +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -1580,7 +1606,7 @@ eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile @@ -1611,7 +1637,7 @@ test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext + test -x conftest$ac_exeext }; then : ac_retval=0 else @@ -1625,7 +1651,7 @@ # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link @@ -1634,7 +1660,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -1892,7 +1918,7 @@ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi done @@ -1996,7 +2022,7 @@ set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2008,7 +2034,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2036,7 +2062,7 @@ set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2048,7 +2074,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2089,7 +2115,7 @@ set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2101,7 +2127,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2129,7 +2155,7 @@ set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2142,7 +2168,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -2188,7 +2214,7 @@ set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2200,7 +2226,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2232,7 +2258,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2244,7 +2270,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2287,7 +2313,7 @@ test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -2402,7 +2428,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } @@ -2445,7 +2471,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 @@ -2504,7 +2530,7 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi fi fi @@ -2515,7 +2541,7 @@ ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if test "${ac_cv_objext+set}" = set; then : +if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2556,7 +2582,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi @@ -2566,7 +2592,7 @@ ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -2603,7 +2629,7 @@ ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -2681,7 +2707,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -2690,8 +2716,7 @@ /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -2789,7 +2814,7 @@ CPP= fi if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then : + if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -2905,7 +2930,7 @@ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c @@ -2917,7 +2942,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if test "${ac_cv_path_GREP+set}" = set; then : +if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -2931,7 +2956,7 @@ for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -2980,7 +3005,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then : +if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -2997,7 +3022,7 @@ for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -3047,7 +3072,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then : +if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3176,7 +3201,7 @@ ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = x""yes; then : +if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= @@ -3198,14 +3223,14 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if test "${ac_cv_safe_to_define___extensions__+set}" = set; then : +if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -# define __EXTENSIONS__ 1 - $ac_includes_default +# define __EXTENSIONS__ 1 + $ac_includes_default int main () { @@ -3246,7 +3271,7 @@ set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3258,7 +3283,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3286,7 +3311,7 @@ set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3298,7 +3323,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3339,7 +3364,7 @@ set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3351,7 +3376,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3379,7 +3404,7 @@ set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3392,7 +3417,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -3438,7 +3463,7 @@ set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_CC+set}" = set; then : +if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3450,7 +3475,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3482,7 +3507,7 @@ set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : +if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3494,7 +3519,7 @@ IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3537,7 +3562,7 @@ test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5 ; } +See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 @@ -3566,7 +3591,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if test "${ac_cv_c_compiler_gnu+set}" = set; then : +if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3603,7 +3628,7 @@ ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if test "${ac_cv_prog_cc_g+set}" = set; then : +if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag @@ -3681,7 +3706,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if test "${ac_cv_prog_cc_c89+set}" = set; then : +if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no @@ -3690,8 +3715,7 @@ /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3793,7 +3817,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create" >&5 $as_echo_n "checking for library containing pthread_create... " >&6; } -if test "${ac_cv_search_pthread_create+set}" = set; then : +if ${ac_cv_search_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS @@ -3827,11 +3851,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext - if test "${ac_cv_search_pthread_create+set}" = set; then : + if ${ac_cv_search_pthread_create+:} false; then : break fi done -if test "${ac_cv_search_pthread_create+set}" = set; then : +if ${ac_cv_search_pthread_create+:} false; then : else ac_cv_search_pthread_create=no @@ -3853,7 +3877,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for utimes" >&5 $as_echo_n "checking for utimes... " >&6; } -if test "${ac_cv_utimes+set}" = set; then : +if ${ac_cv_utimes+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3887,7 +3911,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for futimes" >&5 $as_echo_n "checking for futimes... " >&6; } -if test "${ac_cv_futimes+set}" = set; then : +if ${ac_cv_futimes+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3922,7 +3946,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readahead" >&5 $as_echo_n "checking for readahead... " >&6; } -if test "${ac_cv_readahead+set}" = set; then : +if ${ac_cv_readahead+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3955,7 +3979,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fdatasync" >&5 $as_echo_n "checking for fdatasync... " >&6; } -if test "${ac_cv_fdatasync+set}" = set; then : +if ${ac_cv_fdatasync+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -3986,7 +4010,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sendfile" >&5 $as_echo_n "checking for sendfile... " >&6; } -if test "${ac_cv_sendfile+set}" = set; then : +if ${ac_cv_sendfile+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4036,7 +4060,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sync_file_range" >&5 $as_echo_n "checking for sync_file_range... " >&6; } -if test "${ac_cv_sync_file_range+set}" = set; then : +if ${ac_cv_sync_file_range+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4071,7 +4095,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fallocate" >&5 $as_echo_n "checking for fallocate... " >&6; } -if test "${ac_cv_linux_fallocate+set}" = set; then : +if ${ac_cv_linux_fallocate+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4106,7 +4130,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys_syncfs" >&5 $as_echo_n "checking for sys_syncfs... " >&6; } -if test "${ac_cv_sys_syncfs+set}" = set; then : +if ${ac_cv_sys_syncfs+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4136,7 +4160,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for prctl_set_name" >&5 $as_echo_n "checking for prctl_set_name... " >&6; } -if test "${ac_cv_prctl_set_name+set}" = set; then : +if ${ac_cv_prctl_set_name+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4167,7 +4191,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for posix_madvise" >&5 $as_echo_n "checking for posix_madvise... " >&6; } -if test "${ac_cv_posix_madvise+set}" = set; then : +if ${ac_cv_posix_madvise+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4201,7 +4225,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for posix_fadvise" >&5 $as_echo_n "checking for posix_fadvise... " >&6; } -if test "${ac_cv_posix_fadvise+set}" = set; then : +if ${ac_cv_posix_fadvise+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4251,7 +4275,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for splice, vmsplice and tee" >&5 $as_echo_n "checking for splice, vmsplice and tee... " >&6; } -if test "${ac_cv_linux_splice+set}" = set; then : +if ${ac_cv_linux_splice+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -4284,6 +4308,38 @@ +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pipe2" >&5 +$as_echo_n "checking for pipe2... " >&6; } +if ${ac_cv_pipe2+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int res; +int main (void) +{ + res = pipe2 (0, 0); + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_pipe2=yes +else + ac_cv_pipe2=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_pipe2" >&5 +$as_echo "$ac_cv_pipe2" >&6; } +test $ac_cv_pipe2 = yes && +$as_echo "#define HAVE_PIPE2 1" >>confdefs.h + + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -4348,10 +4404,21 @@ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - test "x$cache_file" != "x/dev/null" && + if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - cat confcache >$cache_file + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} @@ -4383,7 +4450,7 @@ -: ${CONFIG_STATUS=./config.status} +: "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" @@ -4484,6 +4551,7 @@ IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. +as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -4679,16 +4747,16 @@ # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -4748,28 +4816,16 @@ as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -4791,7 +4847,7 @@ # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.67. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4844,10 +4900,10 @@ ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.67, +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -4927,7 +4983,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' @@ -4958,7 +5014,7 @@ case $ac_config_target in "libeio/config.h") CONFIG_HEADERS="$CONFIG_HEADERS libeio/config.h" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done @@ -4979,9 +5035,10 @@ # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= + tmp= ac_tmp= trap 'exit_status=$? - { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } @@ -4989,18 +5046,19 @@ { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" + test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || +cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -5012,8 +5070,8 @@ # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 @@ -5114,7 +5172,7 @@ esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -5133,7 +5191,7 @@ for ac_f do case $ac_f in - -) ac_f="$tmp/stdin";; + -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -5142,7 +5200,7 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" @@ -5168,8 +5226,8 @@ esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac @@ -5242,20 +5300,20 @@ if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ + mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; diff -Nru libio-aio-perl-4.32/debian/changelog libio-aio-perl-4.33/debian/changelog --- libio-aio-perl-4.32/debian/changelog 2015-12-18 15:12:36.000000000 +0000 +++ libio-aio-perl-4.33/debian/changelog 2016-01-23 02:45:27.000000000 +0000 @@ -1,8 +1,22 @@ -libio-aio-perl (4.32-1build1) xenial; urgency=medium +libio-aio-perl (4.33-2) unstable; urgency=medium - * Rebuild for Perl 5.22.1. + * Recreate def0.h before configuring. This way we get the list of + defines for constants in AIO.xs updated. + * Drop workaround-missing-O_CLOEXEC.patch. The #define is now in def0.h. - -- Colin Watson Fri, 18 Dec 2015 15:12:36 +0000 + -- gregor herrmann Sat, 23 Jan 2016 03:45:07 +0100 + +libio-aio-perl (4.33-1) unstable; urgency=medium + + * New upstream release. + * Update years of upstream and packaging copyright. + * Add new build dependency. + * Don't install debian/Maintainership.txt in the binary package. + * Add a patch to fix spelling mistakes in the POD. + * Add a patch to fix a "Constant subroutine ... redefined" warning. + Thanks to autopkgtest. + + -- gregor herrmann Sat, 23 Jan 2016 01:00:02 +0100 libio-aio-perl (4.32-1) unstable; urgency=medium diff -Nru libio-aio-perl-4.32/debian/clean libio-aio-perl-4.33/debian/clean --- libio-aio-perl-4.32/debian/clean 2015-10-31 20:14:46.000000000 +0000 +++ libio-aio-perl-4.33/debian/clean 2016-01-23 02:45:27.000000000 +0000 @@ -1,3 +1,4 @@ config.log config.status libeio/config.h +def0.h diff -Nru libio-aio-perl-4.32/debian/control libio-aio-perl-4.33/debian/control --- libio-aio-perl-4.32/debian/control 2015-10-31 20:14:46.000000000 +0000 +++ libio-aio-perl-4.33/debian/control 2016-01-23 02:45:27.000000000 +0000 @@ -5,6 +5,7 @@ Testsuite: autopkgtest-pkg-perl Priority: optional Build-Depends: debhelper (>= 9.20120312~), + libcanary-stability-perl, libcommon-sense-perl Standards-Version: 3.9.6 Vcs-Browser: https://anonscm.debian.org/cgit/pkg-perl/packages/libio-aio-perl.git diff -Nru libio-aio-perl-4.32/debian/copyright libio-aio-perl-4.33/debian/copyright --- libio-aio-perl-4.32/debian/copyright 2015-10-31 20:14:46.000000000 +0000 +++ libio-aio-perl-4.33/debian/copyright 2016-01-23 02:45:27.000000000 +0000 @@ -7,8 +7,8 @@ Copyright: 2005-2011, Mark Lehmann License: Artistic or GPL-1+ -Files: libeio/eio.* -Copyright: 2007-2013, Mark Lehmann +Files: libeio/eio.* libeio/etp.c +Copyright: 2007-2015, Mark Lehmann License: BSD-2-Clause or GPL-2+ Files: libeio/ecb.h @@ -20,7 +20,7 @@ Copyright: 2007, Pascal Hakim 2011, Nicholas Bamber - 2011-2015, gregor herrmann + 2011-2016, gregor herrmann License: Artistic or GPL-1+ License: Artistic diff -Nru libio-aio-perl-4.32/debian/libio-aio-perl.docs libio-aio-perl-4.33/debian/libio-aio-perl.docs --- libio-aio-perl-4.32/debian/libio-aio-perl.docs 2015-10-31 20:14:46.000000000 +0000 +++ libio-aio-perl-4.33/debian/libio-aio-perl.docs 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -debian/Maintainership.txt diff -Nru libio-aio-perl-4.32/debian/patches/duplicate-constant.patch libio-aio-perl-4.33/debian/patches/duplicate-constant.patch --- libio-aio-perl-4.32/debian/patches/duplicate-constant.patch 1970-01-01 00:00:00.000000000 +0000 +++ libio-aio-perl-4.33/debian/patches/duplicate-constant.patch 2016-01-23 02:45:27.000000000 +0000 @@ -0,0 +1,19 @@ +Description: remove duplicate const declaration + Changes for 4.33 claims to add support for MAP_HUGETLB. + But the line was already there since 3.71, and causes a warning: + "Constant subroutine MAP_HUGETLB redefined ..." +Origin: vendor +Forwarded: no +Author: gregor herrmann +Last-Update: 2016-01-23 + +--- a/AIO.xs ++++ b/AIO.xs +@@ -994,7 +994,6 @@ + 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) diff -Nru libio-aio-perl-4.32/debian/patches/series libio-aio-perl-4.33/debian/patches/series --- libio-aio-perl-4.32/debian/patches/series 2015-10-31 20:14:46.000000000 +0000 +++ libio-aio-perl-4.33/debian/patches/series 2016-01-23 02:45:27.000000000 +0000 @@ -1 +1,2 @@ -workaround-missing-O_CLOEXEC.patch +spelling.patch +duplicate-constant.patch diff -Nru libio-aio-perl-4.32/debian/patches/spelling.patch libio-aio-perl-4.33/debian/patches/spelling.patch --- libio-aio-perl-4.32/debian/patches/spelling.patch 1970-01-01 00:00:00.000000000 +0000 +++ libio-aio-perl-4.33/debian/patches/spelling.patch 2016-01-23 02:45:27.000000000 +0000 @@ -0,0 +1,26 @@ +Description: spelling fixes +Origin: vendor +Forwarded: no +Author: gregor herrmann +Last-Update: 2016-01-23 + +--- a/AIO.pm ++++ b/AIO.pm +@@ -290,7 +290,7 @@ + which must be a code reference. This code reference will be called after + the syscall has been executed in an asynchronous fashion. The results + of the request will be passed as arguments to the callback (and, if an +-error occured, in C<$!>) - for most requests the syscall return code (e.g. ++error occurred, in C<$!>) - for most requests the syscall return code (e.g. + most syscalls return C<-1> on error, unlike perl, which usually delivers + "false"). + +@@ -493,7 +493,7 @@ + into a trap where C reads some data with readahead, then + fails to write all data, and when the socket is ready the next time, the + data in the cache is already lost, forcing C to again hit +-the disk. Explicit C + C let's you better control ++the disk. Explicit C + C lets you better control + resource usage. + + This call tries to make use of a native C-like syscall to diff -Nru libio-aio-perl-4.32/debian/patches/workaround-missing-O_CLOEXEC.patch libio-aio-perl-4.33/debian/patches/workaround-missing-O_CLOEXEC.patch --- libio-aio-perl-4.32/debian/patches/workaround-missing-O_CLOEXEC.patch 2015-10-31 20:14:46.000000000 +0000 +++ libio-aio-perl-4.33/debian/patches/workaround-missing-O_CLOEXEC.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -Description: Fix FTBS on platforms not having O_CLOEXEC. -Origin: vendor -Bug: http://bugs.debian.org/645543 -Author: Alessandro Ghedini -Last-Update: 2011-10-20 - ---- a/libeio/eio.c -+++ b/libeio/eio.c -@@ -73,6 +73,10 @@ - # define ELOOP EDOM - #endif - -+#ifndef O_CLOEXEC -+# define O_CLOEXEC 0 -+#endif -+ - #if !defined(ENOTSOCK) && defined(WSAENOTSOCK) - # define ENOTSOCK WSAENOTSOCK - #endif diff -Nru libio-aio-perl-4.32/debian/rules libio-aio-perl-4.33/debian/rules --- libio-aio-perl-4.32/debian/rules 2015-10-31 20:14:46.000000000 +0000 +++ libio-aio-perl-4.33/debian/rules 2016-01-23 02:45:27.000000000 +0000 @@ -6,6 +6,10 @@ %: dh $@ --buildsystem=perl_makemaker +override_dh_auto_configure: + perl $(CURDIR)/gendef0 + dh_auto_configure + override_dh_install: dh_install $(RM) -rv $(TMP)/usr/bin diff -Nru libio-aio-perl-4.32/def0.h libio-aio-perl-4.33/def0.h --- libio-aio-perl-4.32/def0.h 2014-01-25 00:15:35.000000000 +0000 +++ libio-aio-perl-4.33/def0.h 2015-06-26 13:00:05.000000000 +0000 @@ -69,6 +69,12 @@ #ifndef O_SYNC #define O_SYNC 0 #endif +#ifndef O_PATH +#define O_PATH 0 +#endif +#ifndef O_TMPFILE +#define O_TMPFILE 0 +#endif #ifndef O_TTY_INIT #define O_TTY_INIT 0 #endif diff -Nru libio-aio-perl-4.32/libeio/config.h.in libio-aio-perl-4.33/libeio/config.h.in --- libio-aio-perl-4.32/libeio/config.h.in 2013-02-18 03:14:58.000000000 +0000 +++ libio-aio-perl-4.33/libeio/config.h.in 2015-10-11 12:11:25.000000000 +0000 @@ -27,6 +27,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* pipe2(2) is available */ +#undef HAVE_PIPE2 + /* posix_fadvise(2) is available */ #undef HAVE_POSIX_FADVISE diff -Nru libio-aio-perl-4.32/libeio/ecb.h libio-aio-perl-4.33/libeio/ecb.h --- libio-aio-perl-4.32/libeio/ecb.h 2015-02-11 18:47:45.000000000 +0000 +++ libio-aio-perl-4.33/libeio/ecb.h 2015-12-02 08:29:31.000000000 +0000 @@ -42,7 +42,7 @@ #define ECB_H /* 16 bits major, 16 bits minor */ -#define ECB_VERSION 0x00010004 +#define ECB_VERSION 0x00010005 #ifdef _WIN32 typedef signed char int8_t; @@ -69,15 +69,18 @@ #endif #else #include - #if UINTMAX_MAX > 0xffffffffU + #if (defined INTPTR_MAX ? INTPTR_MAX : ULONG_MAX) > 0xffffffffU #define ECB_PTRSIZE 8 #else #define ECB_PTRSIZE 4 #endif #endif +#define ECB_GCC_AMD64 (__amd64 || __amd64__ || __x86_64 || __x86_64__) +#define ECB_MSVC_AMD64 (_M_AMD64 || _M_X64) + /* work around x32 idiocy by defining proper macros */ -#if __amd64 || __x86_64 || _M_AMD64 || _M_X64 +#if ECB_GCC_AMD64 || ECB_MSVC_AMD64 #if _ILP32 #define ECB_AMD64_X32 1 #else @@ -149,27 +152,44 @@ #define ECB_MEMORY_FENCE do { } while (0) #endif +/* http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/compiler_ref/compiler_builtins.html */ +#if __xlC__ && ECB_CPP + #include +#endif + +#if 1400 <= _MSC_VER + #include /* fence functions _ReadBarrier, also bit search functions _BitScanReverse */ +#endif + #ifndef ECB_MEMORY_FENCE #if ECB_GCC_VERSION(2,5) || defined __INTEL_COMPILER || (__llvm__ && __GNUC__) || __SUNPRO_C >= 0x5110 || __SUNPRO_CC >= 0x5110 #if __i386 || __i386__ #define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory") #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("") - #elif __amd64 || __amd64__ || __x86_64 || __x86_64__ + #elif ECB_GCC_AMD64 #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mfence" : : : "memory") #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("" : : : "memory") #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("") #elif __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ #define ECB_MEMORY_FENCE __asm__ __volatile__ ("sync" : : : "memory") + #elif defined __ARM_ARCH_2__ \ + || defined __ARM_ARCH_3__ || defined __ARM_ARCH_3M__ \ + || defined __ARM_ARCH_4__ || defined __ARM_ARCH_4T__ \ + || defined __ARM_ARCH_5__ || defined __ARM_ARCH_5E__ \ + || defined __ARM_ARCH_5T__ || defined __ARM_ARCH_5TE__ \ + || defined __ARM_ARCH_5TEJ__ + /* should not need any, unless running old code on newer cpu - arm doesn't support that */ #elif defined __ARM_ARCH_6__ || defined __ARM_ARCH_6J__ \ - || defined __ARM_ARCH_6K__ || defined __ARM_ARCH_6ZK__ + || defined __ARM_ARCH_6K__ || defined __ARM_ARCH_6ZK__ \ + || defined __ARM_ARCH_6T2__ #define ECB_MEMORY_FENCE __asm__ __volatile__ ("mcr p15,0,%0,c7,c10,5" : : "r" (0) : "memory") #elif defined __ARM_ARCH_7__ || defined __ARM_ARCH_7A__ \ - || defined __ARM_ARCH_7M__ || defined __ARM_ARCH_7R__ + || defined __ARM_ARCH_7R__ || defined __ARM_ARCH_7M__ #define ECB_MEMORY_FENCE __asm__ __volatile__ ("dmb" : : : "memory") #elif __aarch64__ #define ECB_MEMORY_FENCE __asm__ __volatile__ ("dmb ish" : : : "memory") - #elif (__sparc || __sparc__) && !__sparcv8 + #elif (__sparc || __sparc__) && !(__sparc_v8__ || defined __sparcv8) #define ECB_MEMORY_FENCE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad | #StoreStore | #StoreLoad" : : : "memory") #define ECB_MEMORY_FENCE_ACQUIRE __asm__ __volatile__ ("membar #LoadStore | #LoadLoad" : : : "memory") #define ECB_MEMORY_FENCE_RELEASE __asm__ __volatile__ ("membar #LoadStore | #StoreStore") @@ -304,6 +324,7 @@ #define ECB_CONCAT(a, b) ECB_CONCAT_(a, b) #define ECB_STRINGIFY_(a) # a #define ECB_STRINGIFY(a) ECB_STRINGIFY_(a) +#define ECB_STRINGIFY_EXPR(expr) ((expr), ECB_STRINGIFY_ (expr)) #define ecb_function_ ecb_inline @@ -350,15 +371,32 @@ #define ecb_deprecated ecb_attribute ((__deprecated__)) #endif -#define ecb_noinline ecb_attribute ((__noinline__)) +#if _MSC_VER >= 1500 + #define ecb_deprecated_message(msg) __declspec (deprecated (msg)) +#elif ECB_GCC_VERSION(4,5) + #define ecb_deprecated_message(msg) ecb_attribute ((__deprecated__ (msg)) +#else + #define ecb_deprecated_message(msg) ecb_deprecated +#endif + +#if _MSC_VER >= 1400 + #define ecb_noinline __declspec (noinline) +#else + #define ecb_noinline ecb_attribute ((__noinline__)) +#endif + #define ecb_unused ecb_attribute ((__unused__)) #define ecb_const ecb_attribute ((__const__)) #define ecb_pure ecb_attribute ((__pure__)) -/* TODO http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx __declspec(noreturn) */ #if ECB_C11 || __IBMC_NORETURN - /* http://pic.dhe.ibm.com/infocenter/compbg/v121v141/topic/com.ibm.xlcpp121.bg.doc/language_ref/noreturn.html */ + /* http://www-01.ibm.com/support/knowledgecenter/SSGH3R_13.1.0/com.ibm.xlcpp131.aix.doc/language_ref/noreturn.html */ #define ecb_noreturn _Noreturn +#elif ECB_CPP11 + #define ecb_noreturn [[noreturn]] +#elif _MSC_VER >= 1200 + /* http://msdn.microsoft.com/en-us/library/k6ktzx3s.aspx */ + #define ecb_noreturn __declspec (noreturn) #else #define ecb_noreturn ecb_attribute ((__noreturn__)) #endif @@ -399,6 +437,11 @@ ecb_function_ ecb_const int ecb_ctz32 (uint32_t x) { +#if 1400 <= _MSC_VER && (_M_IX86 || _M_X64 || _M_IA64 || _M_ARM) + unsigned long r; + _BitScanForward (&r, x); + return (int)r; +#else int r = 0; x &= ~x + 1; /* this isolates the lowest bit */ @@ -418,14 +461,21 @@ #endif return r; +#endif } ecb_function_ ecb_const int ecb_ctz64 (uint64_t x); ecb_function_ ecb_const int ecb_ctz64 (uint64_t x) { - int shift = x & 0xffffffffU ? 0 : 32; +#if 1400 <= _MSC_VER && (_M_X64 || _M_IA64 || _M_ARM) + unsigned long r; + _BitScanForward64 (&r, x); + return (int)r; +#else + int shift = x & 0xffffffff ? 0 : 32; return ecb_ctz32 (x >> shift) + shift; +#endif } ecb_function_ ecb_const int ecb_popcount32 (uint32_t x); @@ -443,6 +493,11 @@ ecb_function_ ecb_const int ecb_ld32 (uint32_t x); ecb_function_ ecb_const int ecb_ld32 (uint32_t x) { +#if 1400 <= _MSC_VER && (_M_IX86 || _M_X64 || _M_IA64 || _M_ARM) + unsigned long r; + _BitScanReverse (&r, x); + return (int)r; +#else int r = 0; if (x >> 16) { x >>= 16; r += 16; } @@ -452,16 +507,23 @@ if (x >> 1) { r += 1; } return r; +#endif } ecb_function_ ecb_const int ecb_ld64 (uint64_t x); ecb_function_ ecb_const int ecb_ld64 (uint64_t x) { +#if 1400 <= _MSC_VER && (_M_X64 || _M_IA64 || _M_ARM) + unsigned long r; + _BitScanReverse64 (&r, x); + return (int)r; +#else int r = 0; if (x >> 32) { x >>= 32; r += 32; } return r + ecb_ld32 (x); +#endif } #endif @@ -528,9 +590,18 @@ ecb_inline ecb_const uint64_t ecb_rotr64 (uint64_t x, unsigned int count) { return (x << (64 - count)) | (x >> count); } #if ECB_GCC_VERSION(4,3) || (ECB_CLANG_BUILTIN(__builtin_bswap32) && ECB_CLANG_BUILTIN(__builtin_bswap64)) + #if ECB_GCC_VERSION(4,8) || ECB_CLANG_BUILTIN(__builtin_bswap16) + #define ecb_bswap16(x) __builtin_bswap16 (x) + #else #define ecb_bswap16(x) (__builtin_bswap32 (x) >> 16) + #endif #define ecb_bswap32(x) __builtin_bswap32 (x) #define ecb_bswap64(x) __builtin_bswap64 (x) +#elif _MSC_VER + #include + #define ecb_bswap16(x) ((uint16_t)_byteswap_ushort ((uint16_t)(x))) + #define ecb_bswap32(x) ((uint32_t)_byteswap_ulong ((uint32_t)(x))) + #define ecb_bswap64(x) ((uint64_t)_byteswap_uint64 ((uint64_t)(x))) #else ecb_function_ ecb_const uint16_t ecb_bswap16 (uint16_t x); ecb_function_ ecb_const uint16_t @@ -565,8 +636,8 @@ /* try to tell the compiler that some condition is definitely true */ #define ecb_assume(cond) if (!(cond)) ecb_unreachable (); else 0 -ecb_inline ecb_const unsigned char ecb_byteorder_helper (void); -ecb_inline ecb_const unsigned char +ecb_inline ecb_const uint32_t ecb_byteorder_helper (void); +ecb_inline ecb_const uint32_t ecb_byteorder_helper (void) { /* the union code still generates code under pressure in gcc, */ @@ -575,26 +646,28 @@ /* the reason why we have this horrible preprocessor mess */ /* is to avoid it in all cases, at least on common architectures */ /* or when using a recent enough gcc version (>= 4.6) */ -#if __i386 || __i386__ || _M_X86 || __amd64 || __amd64__ || _M_X64 - return 0x44; -#elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - return 0x44; -#elif __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - return 0x11; +#if (defined __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) \ + || ((__i386 || __i386__ || _M_IX86 || ECB_GCC_AMD64 || ECB_MSVC_AMD64) && !__VOS__) + #define ECB_LITTLE_ENDIAN 1 + return 0x44332211; +#elif (defined __BYTE_ORDER__ && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) \ + || ((__AARCH64EB__ || __MIPSEB__ || __ARMEB__) && !__VOS__) + #define ECB_BIG_ENDIAN 1 + return 0x11223344; #else union { - uint32_t i; - uint8_t c; - } u = { 0x11223344 }; - return u.c; + uint8_t c[4]; + uint32_t u; + } u = { 0x11, 0x22, 0x33, 0x44 }; + return u.u; #endif } ecb_inline ecb_const ecb_bool ecb_big_endian (void); -ecb_inline ecb_const ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11; } +ecb_inline ecb_const ecb_bool ecb_big_endian (void) { return ecb_byteorder_helper () == 0x11223344; } ecb_inline ecb_const ecb_bool ecb_little_endian (void); -ecb_inline ecb_const ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44; } +ecb_inline ecb_const ecb_bool ecb_little_endian (void) { return ecb_byteorder_helper () == 0x44332211; } #if ECB_GCC_VERSION(3,0) || ECB_C99 #define ecb_mod(m,n) ((m) % (n) + ((m) % (n) < 0 ? (n) : 0)) @@ -629,6 +702,102 @@ #define ecb_array_length(name) (sizeof (name) / sizeof (name [0])) #endif +ecb_function_ ecb_const uint32_t ecb_binary16_to_binary32 (uint32_t x); +ecb_function_ ecb_const uint32_t +ecb_binary16_to_binary32 (uint32_t x) +{ + unsigned int s = (x & 0x8000) << (31 - 15); + int e = (x >> 10) & 0x001f; + unsigned int m = x & 0x03ff; + + if (ecb_expect_false (e == 31)) + /* infinity or NaN */ + e = 255 - (127 - 15); + else if (ecb_expect_false (!e)) + { + if (ecb_expect_true (!m)) + /* zero, handled by code below by forcing e to 0 */ + e = 0 - (127 - 15); + else + { + /* subnormal, renormalise */ + unsigned int s = 10 - ecb_ld32 (m); + + m = (m << s) & 0x3ff; /* mask implicit bit */ + e -= s - 1; + } + } + + /* e and m now are normalised, or zero, (or inf or nan) */ + e += 127 - 15; + + return s | (e << 23) | (m << (23 - 10)); +} + +ecb_function_ ecb_const uint16_t ecb_binary32_to_binary16 (uint32_t x); +ecb_function_ ecb_const uint16_t +ecb_binary32_to_binary16 (uint32_t x) +{ + unsigned int s = (x >> 16) & 0x00008000; /* sign bit, the easy part */ + unsigned int e = ((x >> 23) & 0x000000ff) - (127 - 15); /* the desired exponent */ + unsigned int m = x & 0x007fffff; + + x &= 0x7fffffff; + + /* if it's within range of binary16 normals, use fast path */ + if (ecb_expect_true (0x38800000 <= x && x <= 0x477fefff)) + { + /* mantissa round-to-even */ + m += 0x00000fff + ((m >> (23 - 10)) & 1); + + /* handle overflow */ + if (ecb_expect_false (m >= 0x00800000)) + { + m >>= 1; + e += 1; + } + + return s | (e << 10) | (m >> (23 - 10)); + } + + /* handle large numbers and infinity */ + if (ecb_expect_true (0x477fefff < x && x <= 0x7f800000)) + return s | 0x7c00; + + /* handle zero, subnormals and small numbers */ + if (ecb_expect_true (x < 0x38800000)) + { + /* zero */ + if (ecb_expect_true (!x)) + return s; + + /* handle subnormals */ + + /* too small, will be zero */ + if (e < (14 - 24)) /* might not be sharp, but is good enough */ + return s; + + m |= 0x00800000; /* make implicit bit explicit */ + + /* very tricky - we need to round to the nearest e (+10) bit value */ + { + unsigned int bits = 14 - e; + unsigned int half = (1 << (bits - 1)) - 1; + unsigned int even = (m >> bits) & 1; + + /* if this overflows, we will end up with a normalised number */ + m = (m + half + even) >> bits; + } + + return s | m; + } + + /* handle NaNs, preserve leftmost nan bits, but make sure we don't turn them into infinities */ + m >>= 13; + + return s | 0x7c00 | m | !m; +} + /*******************************************************************************/ /* floating point stuff, can be disabled by defining ECB_NO_LIBM */ @@ -636,7 +805,7 @@ /* the only noteworthy exception is ancient armle, which uses order 43218765 */ #if 0 \ || __i386 || __i386__ \ - || __amd64 || __amd64__ || __x86_64 || __x86_64__ \ + || ECB_GCC_AMD64 \ || __powerpc__ || __ppc__ || __powerpc64__ || __ppc64__ \ || defined __s390__ || defined __s390x__ \ || defined __mips__ \ @@ -646,7 +815,7 @@ || defined __m68k__ \ || defined __m88k__ \ || defined __sh__ \ - || defined _M_IX86 || defined _M_AMD64 || defined _M_IA64 \ + || defined _M_IX86 || defined ECB_MSVC_AMD64 || defined _M_IA64 \ || (defined __arm__ && (defined __ARM_EABI__ || defined __EABI__ || defined __VFP_FP__ || defined _WIN32_WCE || defined __ANDROID__)) \ || defined __aarch64__ #define ECB_STDFP 1 @@ -674,27 +843,12 @@ #if ECB_C99 || _XOPEN_VERSION >= 600 || _POSIX_VERSION >= 200112L #define ecb_ldexpf(x,e) ldexpf ((x), (e)) + #define ecb_frexpf(x,e) frexpf ((x), (e)) #else - #define ecb_ldexpf(x,e) (float) ldexp ((x), (e)) + #define ecb_ldexpf(x,e) (float) ldexp ((double) (x), (e)) + #define ecb_frexpf(x,e) (float) frexp ((double) (x), (e)) #endif - /* converts an ieee half/binary16 to a float */ - ecb_function_ ecb_const float ecb_binary16_to_float (uint16_t x); - ecb_function_ ecb_const float - ecb_binary16_to_float (uint16_t x) - { - int e = (x >> 10) & 0x1f; - int m = x & 0x3ff; - float r; - - if (!e ) r = ecb_ldexpf (m , -24); - else if (e != 31) r = ecb_ldexpf (m + 0x400, e - 25); - else if (m ) r = ECB_NAN; - else r = ECB_INFINITY; - - return x & 0x8000 ? -r : r; - } - /* convert a float to ieee single/binary32 */ ecb_function_ ecb_const uint32_t ecb_float_to_binary32 (float x); ecb_function_ ecb_const uint32_t @@ -714,7 +868,7 @@ if (x < -3.40282346638528860e+38f) return 0xff800000U; if (x != x ) return 0x7fbfffffU; - m = frexpf (x, &e) * 0x1000000U; + m = ecb_frexpf (x, &e) * 0x1000000U; r = m & 0x80000000U; @@ -835,6 +989,22 @@ return r; } + /* convert a float to ieee half/binary16 */ + ecb_function_ ecb_const uint16_t ecb_float_to_binary16 (float x); + ecb_function_ ecb_const uint16_t + ecb_float_to_binary16 (float x) + { + return ecb_binary32_to_binary16 (ecb_float_to_binary32 (x)); + } + + /* convert an ieee half/binary16 to float */ + ecb_function_ ecb_const float ecb_binary16_to_float (uint16_t x); + ecb_function_ ecb_const float + ecb_binary16_to_float (uint16_t x) + { + return ecb_binary32_to_float (ecb_binary16_to_binary32 (x)); + } + #endif #endif diff -Nru libio-aio-perl-4.32/libeio/eio.c libio-aio-perl-4.33/libeio/eio.c --- libio-aio-perl-4.32/libeio/eio.c 2014-09-07 14:49:56.000000000 +0000 +++ libio-aio-perl-4.33/libeio/eio.c 2015-06-25 18:14:00.000000000 +0000 @@ -122,6 +122,7 @@ #define chmod(path,mode) _chmod (path, mode) #define dup(fd) _dup (fd) #define dup2(fd1,fd2) _dup2 (fd1, fd2) + #define pipe(fds) _pipe (fds, 4096, O_BINARY) #define fchmod(fd,mode) EIO_ENOSYS () #define chown(path,uid,gid) EIO_ENOSYS () @@ -337,25 +338,7 @@ /*****************************************************************************/ -struct 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; +struct etp_tmpbuf; #if _POSIX_VERSION >= 200809L #define HAVE_AT 1 @@ -365,7 +348,7 @@ #endif #else #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 struct eio_pwd @@ -385,8 +368,14 @@ #define ETP_TYPE_QUIT -1 #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_DESTROY(req) eio_destroy (req) static int eio_finish (eio_req *req); @@ -396,6 +385,9 @@ #include "etp.c" +static struct etp_pool eio_pool; +#define EIO_POOL (&eio_pool) + /*****************************************************************************/ static void @@ -403,12 +395,12 @@ { while (grp->size < grp->int2 && !EIO_CANCELLED (grp)) { - grp->flags &= ~EIO_FLAG_GROUPADD; + grp->flags &= ~ETP_FLAG_GROUPADD; EIO_FEED (grp); /* stop if no progress has been made */ - if (!(grp->flags & EIO_FLAG_GROUPADD)) + if (!(grp->flags & ETP_FLAG_GROUPADD)) { grp->feed = 0; break; @@ -425,7 +417,7 @@ grp_try_feed (grp); /* finish, if done */ - if (!grp->size && grp->int1) + if (!grp->size && grp->flags & ETP_FLAG_DELAYED) return eio_finish (grp); else return 0; @@ -471,84 +463,84 @@ void eio_grp_cancel (eio_req *grp) { - etp_grp_cancel (grp); + etp_grp_cancel (EIO_POOL, grp); } void eio_cancel (eio_req *req) { - etp_cancel (req); + etp_cancel (EIO_POOL, req); } void eio_submit (eio_req *req) { - etp_submit (req); + etp_submit (EIO_POOL, req); } unsigned int eio_nreqs (void) { - return etp_nreqs (); + return etp_nreqs (EIO_POOL); } unsigned int eio_nready (void) { - return etp_nready (); + return etp_nready (EIO_POOL); } unsigned int eio_npending (void) { - return etp_npending (); + return etp_npending (EIO_POOL); } unsigned int ecb_cold eio_nthreads (void) { - return etp_nthreads (); + return etp_nthreads (EIO_POOL); } void ecb_cold eio_set_max_poll_time (double nseconds) { - etp_set_max_poll_time (nseconds); + etp_set_max_poll_time (EIO_POOL, nseconds); } void ecb_cold 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 eio_set_max_idle (unsigned int nthreads) { - etp_set_max_idle (nthreads); + etp_set_max_idle (EIO_POOL, nthreads); } void ecb_cold eio_set_idle_timeout (unsigned int seconds) { - etp_set_idle_timeout (seconds); + etp_set_idle_timeout (EIO_POOL, seconds); } void ecb_cold eio_set_min_parallel (unsigned int nthreads) { - etp_set_min_parallel (nthreads); + etp_set_min_parallel (EIO_POOL, nthreads); } void ecb_cold eio_set_max_parallel (unsigned int nthreads) { - etp_set_max_parallel (nthreads); + etp_set_max_parallel (EIO_POOL, nthreads); } int eio_poll (void) { - return etp_poll (); + return etp_poll (EIO_POOL); } /*****************************************************************************/ @@ -968,7 +960,7 @@ /* result will always end up in tmpbuf, there is always space for adding a 0-byte */ 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; const char *rel = path; @@ -987,7 +979,7 @@ if (!*rel) return -1; - res = tmpbuf_get (tmpbuf, PATH_MAX * 3); + res = etp_tmpbuf_get (tmpbuf, PATH_MAX * 3); #ifdef _WIN32 if (_access (rel, 4) != 0) return -1; @@ -1606,7 +1598,7 @@ /* a bit like realpath, but usually faster because it doesn'T have to return */ /* an absolute or canonical path */ static const char * -wd_expand (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) +wd_expand (struct etp_tmpbuf *tmpbuf, eio_wd wd, const char *path) { if (!wd || *path == '/') return path; @@ -1618,7 +1610,7 @@ int l1 = wd->len; int l2 = strlen (path); - char *res = tmpbuf_get (tmpbuf, l1 + l2 + 2); + char *res = etp_tmpbuf_get (tmpbuf, l1 + l2 + 2); memcpy (res, wd->str, l1); res [l1] = '/'; @@ -1631,7 +1623,7 @@ #endif static eio_wd -eio__wd_open_sync (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) +eio__wd_open_sync (struct etp_tmpbuf *tmpbuf, eio_wd wd, const char *path) { int fd; eio_wd res; @@ -1663,7 +1655,7 @@ eio_wd eio_wd_open_sync (eio_wd wd, const char *path) { - struct tmpbuf tmpbuf = { 0 }; + struct etp_tmpbuf tmpbuf = { }; wd = eio__wd_open_sync (&tmpbuf, wd, path); free (tmpbuf.ptr); @@ -1722,9 +1714,9 @@ #define ALLOC(len) \ if (!req->ptr2) \ { \ - X_LOCK (wrklock); \ + X_LOCK (EIO_POOL->wrklock); \ req->flags |= EIO_FLAG_PTR2_FREE; \ - X_UNLOCK (wrklock); \ + X_UNLOCK (EIO_POOL->wrklock); \ req->ptr2 = malloc (len); \ if (!req->ptr2) \ { \ @@ -1734,112 +1726,15 @@ } \ } -static void ecb_noinline ecb_cold -etp_proc_init (void) -{ -#if HAVE_PRCTL_SET_NAME - /* provide a more sensible "thread name" */ - char name[16 + 1]; - const int namelen = sizeof (name) - 1; - int len; - - prctl (PR_GET_NAME, (unsigned long)name, 0, 0, 0); - name [namelen] = 0; - len = strlen (name); - strcpy (name + (len <= namelen - 4 ? len : namelen - 4), "/eio"); - prctl (PR_SET_NAME, (unsigned long)name, 0, 0, 0); -#endif -} - -/* TODO: move somehow to etp.c */ -X_THREAD_PROC (etp_proc) -{ - ETP_REQ *req; - struct timespec ts; - etp_worker *self = (etp_worker *)thr_arg; - - etp_proc_init (); - - /* try to distribute timeouts somewhat evenly */ - ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); - - for (;;) - { - ts.tv_sec = 0; - - X_LOCK (reqlock); - - for (;;) - { - req = reqq_shift (&req_queue); - - if (req) - break; - - if (ts.tv_sec == 1) /* no request, but timeout detected, let's quit */ - { - X_UNLOCK (reqlock); - X_LOCK (wrklock); - --started; - X_UNLOCK (wrklock); - goto quit; - } - - ++idle; - - if (idle <= max_idle) - /* we are allowed to idle, so do so without any timeout */ - X_COND_WAIT (reqwait, reqlock); - else - { - /* initialise timeout once */ - if (!ts.tv_sec) - ts.tv_sec = time (0) + idle_timeout; - - if (X_COND_TIMEDWAIT (reqwait, reqlock, ts) == ETIMEDOUT) - ts.tv_sec = 1; /* assuming this is not a value computed above.,.. */ - } - - --idle; - } - - --nready; - - X_UNLOCK (reqlock); - - if (req->type == ETP_TYPE_QUIT) - goto quit; - - ETP_EXECUTE (self, req); - - X_LOCK (reslock); - - ++npending; - - if (!reqq_push (&res_queue, req) && want_poll_cb) - want_poll_cb (); - - etp_worker_clear (self); - - X_UNLOCK (reslock); - } - -quit: - free (req); - - X_LOCK (wrklock); - etp_worker_free (self); - X_UNLOCK (wrklock); - - return 0; -} - /*****************************************************************************/ int ecb_cold eio_init (void (*want_poll)(void), void (*done_poll)(void)) { - return etp_init (want_poll, done_poll); + eio_want_poll_cb = want_poll; + eio_done_poll_cb = done_poll; + + return etp_init (EIO_POOL, 0, 0, 0); } ecb_inline void @@ -2074,8 +1969,10 @@ #endif break; +#if 0 case EIO_GROUP: abort (); /* handled in eio_request */ +#endif case EIO_NOP: req->result = 0; @@ -2385,7 +2282,7 @@ { assert (("cannot add requests to IO::AIO::GRP after the group finished", grp->int1 != 2)); - grp->flags |= EIO_FLAG_GROUPADD; + grp->flags |= ETP_FLAG_GROUPADD; ++grp->size; req->grp = grp; diff -Nru libio-aio-perl-4.32/libeio/eio.h libio-aio-perl-4.33/libeio/eio.h --- libio-aio-perl-4.32/libeio/eio.h 2014-08-18 04:45:40.000000000 +0000 +++ libio-aio-perl-4.33/libeio/eio.h 2015-06-25 16:57:16.000000000 +0000 @@ -1,7 +1,7 @@ /* * libeio API header * - * Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann + * Copyright (c) 2007,2008,2009,2010,2011,2012,2015 Marc Alexander Lehmann * All rights reserved. * * Redistribution and use in source and binary forms, with or without modifica- @@ -171,8 +171,10 @@ enum { /* these MUST match the value in linux/falloc.h */ - EIO_FALLOC_FL_KEEP_SIZE = 1, - EIO_FALLOC_FL_PUNCH_HOLE = 2 + EIO_FALLOC_FL_KEEP_SIZE = 0x01, + EIO_FALLOC_FL_PUNCH_HOLE = 0x02, + EIO_FALLOC_FL_COLLAPSE_RANGE = 0x08, + EIO_FALLOC_FL_ZERO_RANGE = 0x10 }; /* timestamps and differences - feel free to use double in your code directly */ @@ -285,7 +287,6 @@ enum { EIO_FLAG_PTR1_FREE = 0x01, /* need to free(ptr1) */ EIO_FLAG_PTR2_FREE = 0x02, /* need to free(ptr2) */ - EIO_FLAG_GROUPADD = 0x04 /* some request was added to the group */ }; /* undocumented/unsupported/private helper */ diff -Nru libio-aio-perl-4.32/libeio/etp.c libio-aio-perl-4.33/libeio/etp.c --- libio-aio-perl-4.32/libeio/etp.c 2014-08-18 04:25:55.000000000 +0000 +++ libio-aio-perl-4.33/libeio/etp.c 2015-09-21 08:02:53.000000000 +0000 @@ -1,7 +1,7 @@ /* * libetp implementation * - * Copyright (c) 2007,2008,2009,2010,2011,2012,2013 Marc Alexander Lehmann + * Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2015 Marc Alexander Lehmann * All rights reserved. * * Redistribution and use in source and binary forms, with or without modifica- @@ -54,10 +54,22 @@ # define ETP_TYPE_GROUP 1 #endif +#ifndef ETP_WANT_POLL +# define ETP_WANT_POLL(pool) pool->want_poll_cb (pool->userdata) +#endif +#ifndef ETP_DONE_POLL +# define ETP_DONE_POLL(pool) pool->done_poll_cb (pool->userdata) +#endif + #define ETP_NUM_PRI (ETP_PRI_MAX - ETP_PRI_MIN + 1) #define ETP_TICKS ((1000000 + 1023) >> 10) +enum { + ETP_FLAG_GROUPADD = 0x04, /* some request was added to the group */ + ETP_FLAG_DELAYED = 0x08, /* groiup request has been delayed */ +}; + /* calculate time difference in ~1/ETP_TICKS of a second */ ecb_inline int etp_tvdiff (struct timeval *tv1, struct timeval *tv2) @@ -66,30 +78,44 @@ + ((tv2->tv_usec - tv1->tv_usec) >> 10); } -static unsigned int started, idle, wanted = 4; +struct etp_tmpbuf +{ + void *ptr; + int len; +}; + +static void * +etp_tmpbuf_get (struct etp_tmpbuf *buf, int len) +{ + if (buf->len < len) + { + free (buf->ptr); + buf->ptr = malloc (buf->len = len); + } -static void (*want_poll_cb) (void); -static void (*done_poll_cb) (void); - -static unsigned int max_poll_time; /* reslock */ -static unsigned int max_poll_reqs; /* reslock */ + return buf->ptr; +} + +/* + * a somewhat faster data structure might be nice, but + * with 8 priorities this actually needs <20 insns + * per shift, the most expensive operation. + */ +typedef struct +{ + ETP_REQ *qs[ETP_NUM_PRI], *qe[ETP_NUM_PRI]; /* qstart, qend */ + int size; +} etp_reqq; -static unsigned int nreqs; /* reqlock */ -static unsigned int nready; /* reqlock */ -static unsigned int npending; /* reqlock */ -static unsigned int max_idle = 4; /* maximum number of threads that can idle indefinitely */ -static unsigned int idle_timeout = 10; /* number of seconds after which an idle threads exit */ - -static xmutex_t wrklock; -static xmutex_t reslock; -static xmutex_t reqlock; -static xcond_t reqwait; +typedef struct etp_pool *etp_pool; typedef struct etp_worker { - struct tmpbuf tmpbuf; + etp_pool pool; + + struct etp_tmpbuf tmpbuf; - /* locked by wrklock */ + /* locked by pool->wrklock */ struct etp_worker *prev, *next; xthread_t tid; @@ -99,10 +125,37 @@ #endif } etp_worker; -static etp_worker wrk_first; /* NOT etp */ +struct etp_pool +{ + void *userdata; + + etp_reqq req_queue; + etp_reqq res_queue; + + unsigned int started, idle, wanted; + + unsigned int max_poll_time; /* pool->reslock */ + unsigned int max_poll_reqs; /* pool->reslock */ + + unsigned int nreqs; /* pool->reqlock */ + unsigned int nready; /* pool->reqlock */ + unsigned int npending; /* pool->reqlock */ + unsigned int max_idle; /* maximum number of threads that can pool->idle indefinitely */ + unsigned int idle_timeout; /* number of seconds after which an pool->idle threads exit */ + + void (*want_poll_cb) (void *userdata); + void (*done_poll_cb) (void *userdata); + + xmutex_t wrklock; + xmutex_t reslock; + xmutex_t reqlock; + xcond_t reqwait; -#define ETP_WORKER_LOCK(wrk) X_LOCK (wrklock) -#define ETP_WORKER_UNLOCK(wrk) X_UNLOCK (wrklock) + etp_worker wrk_first; +}; + +#define ETP_WORKER_LOCK(wrk) X_LOCK (pool->wrklock) +#define ETP_WORKER_UNLOCK(wrk) X_UNLOCK (pool->wrklock) /* worker threads management */ @@ -123,64 +176,51 @@ } ETP_API_DECL unsigned int -etp_nreqs (void) +etp_nreqs (etp_pool pool) { int retval; - if (WORDACCESS_UNSAFE) X_LOCK (reqlock); - retval = nreqs; - if (WORDACCESS_UNSAFE) X_UNLOCK (reqlock); + if (WORDACCESS_UNSAFE) X_LOCK (pool->reqlock); + retval = pool->nreqs; + if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock); return retval; } ETP_API_DECL unsigned int -etp_nready (void) +etp_nready (etp_pool pool) { unsigned int retval; - if (WORDACCESS_UNSAFE) X_LOCK (reqlock); - retval = nready; - if (WORDACCESS_UNSAFE) X_UNLOCK (reqlock); + if (WORDACCESS_UNSAFE) X_LOCK (pool->reqlock); + retval = pool->nready; + if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock); return retval; } ETP_API_DECL unsigned int -etp_npending (void) +etp_npending (etp_pool pool) { unsigned int retval; - if (WORDACCESS_UNSAFE) X_LOCK (reqlock); - retval = npending; - if (WORDACCESS_UNSAFE) X_UNLOCK (reqlock); + if (WORDACCESS_UNSAFE) X_LOCK (pool->reqlock); + retval = pool->npending; + if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock); return retval; } ETP_API_DECL unsigned int -etp_nthreads (void) +etp_nthreads (etp_pool pool) { unsigned int retval; - if (WORDACCESS_UNSAFE) X_LOCK (reqlock); - retval = started; - if (WORDACCESS_UNSAFE) X_UNLOCK (reqlock); + if (WORDACCESS_UNSAFE) X_LOCK (pool->reqlock); + retval = pool->started; + if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock); return retval; } -/* - * a somewhat faster data structure might be nice, but - * with 8 priorities this actually needs <20 insns - * per shift, the most expensive operation. - */ -typedef struct { - ETP_REQ *qs[ETP_NUM_PRI], *qe[ETP_NUM_PRI]; /* qstart, qend */ - int size; -} etp_reqq; - -static etp_reqq req_queue; -static etp_reqq res_queue; - static void ecb_noinline ecb_cold reqq_init (etp_reqq *q) { @@ -236,100 +276,204 @@ } ETP_API_DECL int ecb_cold -etp_init (void (*want_poll)(void), void (*done_poll)(void)) +etp_init (etp_pool pool, void *userdata, void (*want_poll)(void *userdata), void (*done_poll)(void *userdata)) { - X_MUTEX_CREATE (wrklock); - X_MUTEX_CREATE (reslock); - X_MUTEX_CREATE (reqlock); - X_COND_CREATE (reqwait); - - reqq_init (&req_queue); - reqq_init (&res_queue); - - wrk_first.next = - wrk_first.prev = &wrk_first; - - started = 0; - idle = 0; - nreqs = 0; - nready = 0; - npending = 0; - - want_poll_cb = want_poll; - done_poll_cb = done_poll; + X_MUTEX_CREATE (pool->wrklock); + X_MUTEX_CREATE (pool->reslock); + X_MUTEX_CREATE (pool->reqlock); + X_COND_CREATE (pool->reqwait); + + reqq_init (&pool->req_queue); + reqq_init (&pool->res_queue); + + pool->wrk_first.next = + pool->wrk_first.prev = &pool->wrk_first; + + pool->started = 0; + pool->idle = 0; + pool->nreqs = 0; + pool->nready = 0; + pool->npending = 0; + pool->wanted = 4; + + pool->max_idle = 4; /* maximum number of threads that can pool->idle indefinitely */ + pool->idle_timeout = 10; /* number of seconds after which an pool->idle threads exit */ + + pool->userdata = userdata; + pool->want_poll_cb = want_poll; + pool->done_poll_cb = done_poll; return 0; } -/* not yet in etp.c */ -X_THREAD_PROC (etp_proc); +static void ecb_noinline ecb_cold +etp_proc_init (void) +{ +#if HAVE_PRCTL_SET_NAME + /* provide a more sensible "thread name" */ + char name[16 + 1]; + const int namelen = sizeof (name) - 1; + int len; + + prctl (PR_GET_NAME, (unsigned long)name, 0, 0, 0); + name [namelen] = 0; + len = strlen (name); + strcpy (name + (len <= namelen - 4 ? len : namelen - 4), "/eio"); + prctl (PR_SET_NAME, (unsigned long)name, 0, 0, 0); +#endif +} + +X_THREAD_PROC (etp_proc) +{ + ETP_REQ *req; + struct timespec ts; + etp_worker *self = (etp_worker *)thr_arg; + etp_pool pool = self->pool; + + etp_proc_init (); + + /* try to distribute timeouts somewhat evenly */ + ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); + + for (;;) + { + ts.tv_sec = 0; + + X_LOCK (pool->reqlock); + + for (;;) + { + req = reqq_shift (&pool->req_queue); + + if (ecb_expect_true (req)) + break; + + if (ts.tv_sec == 1) /* no request, but timeout detected, let's quit */ + { + X_UNLOCK (pool->reqlock); + X_LOCK (pool->wrklock); + --pool->started; + X_UNLOCK (pool->wrklock); + goto quit; + } + + ++pool->idle; + + if (pool->idle <= pool->max_idle) + /* we are allowed to pool->idle, so do so without any timeout */ + X_COND_WAIT (pool->reqwait, pool->reqlock); + else + { + /* initialise timeout once */ + if (!ts.tv_sec) + ts.tv_sec = time (0) + pool->idle_timeout; + + if (X_COND_TIMEDWAIT (pool->reqwait, pool->reqlock, ts) == ETIMEDOUT) + ts.tv_sec = 1; /* assuming this is not a value computed above.,.. */ + } + + --pool->idle; + } + + --pool->nready; + + X_UNLOCK (pool->reqlock); + + if (ecb_expect_false (req->type == ETP_TYPE_QUIT)) + goto quit; + + ETP_EXECUTE (self, req); + + X_LOCK (pool->reslock); + + ++pool->npending; + + if (!reqq_push (&pool->res_queue, req)) + ETP_WANT_POLL (pool); + + etp_worker_clear (self); + + X_UNLOCK (pool->reslock); + } + +quit: + free (req); + + X_LOCK (pool->wrklock); + etp_worker_free (self); + X_UNLOCK (pool->wrklock); + + return 0; +} static void ecb_cold -etp_start_thread (void) +etp_start_thread (etp_pool pool) { etp_worker *wrk = calloc (1, sizeof (etp_worker)); /*TODO*/ assert (("unable to allocate worker thread data", wrk)); - X_LOCK (wrklock); + wrk->pool = pool; + + X_LOCK (pool->wrklock); if (xthread_create (&wrk->tid, etp_proc, (void *)wrk)) { - wrk->prev = &wrk_first; - wrk->next = wrk_first.next; - wrk_first.next->prev = wrk; - wrk_first.next = wrk; - ++started; + wrk->prev = &pool->wrk_first; + wrk->next = pool->wrk_first.next; + pool->wrk_first.next->prev = wrk; + pool->wrk_first.next = wrk; + ++pool->started; } else free (wrk); - X_UNLOCK (wrklock); + X_UNLOCK (pool->wrklock); } static void -etp_maybe_start_thread (void) +etp_maybe_start_thread (etp_pool pool) { - if (ecb_expect_true (etp_nthreads () >= wanted)) + if (ecb_expect_true (etp_nthreads (pool) >= pool->wanted)) return; - /* todo: maybe use idle here, but might be less exact */ - if (ecb_expect_true (0 <= (int)etp_nthreads () + (int)etp_npending () - (int)etp_nreqs ())) + /* todo: maybe use pool->idle here, but might be less exact */ + if (ecb_expect_true (0 <= (int)etp_nthreads (pool) + (int)etp_npending (pool) - (int)etp_nreqs (pool))) return; - etp_start_thread (); + etp_start_thread (pool); } static void ecb_cold -etp_end_thread (void) +etp_end_thread (etp_pool pool) { ETP_REQ *req = calloc (1, sizeof (ETP_REQ)); /* will be freed by worker */ req->type = ETP_TYPE_QUIT; req->pri = ETP_PRI_MAX - ETP_PRI_MIN; - X_LOCK (reqlock); - reqq_push (&req_queue, req); - X_COND_SIGNAL (reqwait); - X_UNLOCK (reqlock); - - X_LOCK (wrklock); - --started; - X_UNLOCK (wrklock); + X_LOCK (pool->reqlock); + reqq_push (&pool->req_queue, req); + X_COND_SIGNAL (pool->reqwait); + X_UNLOCK (pool->reqlock); + + X_LOCK (pool->wrklock); + --pool->started; + X_UNLOCK (pool->wrklock); } ETP_API_DECL int -etp_poll (void) +etp_poll (etp_pool pool) { unsigned int maxreqs; unsigned int maxtime; struct timeval tv_start, tv_now; - X_LOCK (reslock); - maxreqs = max_poll_reqs; - maxtime = max_poll_time; - X_UNLOCK (reslock); + X_LOCK (pool->reslock); + maxreqs = pool->max_poll_reqs; + maxtime = pool->max_poll_time; + X_UNLOCK (pool->reslock); if (maxtime) gettimeofday (&tv_start, 0); @@ -338,31 +482,31 @@ { ETP_REQ *req; - etp_maybe_start_thread (); + etp_maybe_start_thread (pool); - X_LOCK (reslock); - req = reqq_shift (&res_queue); + X_LOCK (pool->reslock); + req = reqq_shift (&pool->res_queue); - if (req) + if (ecb_expect_true (req)) { - --npending; + --pool->npending; - if (!res_queue.size && done_poll_cb) - done_poll_cb (); + if (!pool->res_queue.size) + ETP_DONE_POLL (pool); } - X_UNLOCK (reslock); + X_UNLOCK (pool->reslock); - if (!req) + if (ecb_expect_false (!req)) return 0; - X_LOCK (reqlock); - --nreqs; - X_UNLOCK (reqlock); + X_LOCK (pool->reqlock); + --pool->nreqs; + X_UNLOCK (pool->reqlock); if (ecb_expect_false (req->type == ETP_TYPE_GROUP && req->size)) { - req->int1 = 1; /* mark request as delayed */ + req->flags |= ETP_FLAG_DELAYED; /* mark request as delayed */ continue; } else @@ -389,25 +533,25 @@ } ETP_API_DECL void -etp_grp_cancel (ETP_REQ *grp); +etp_grp_cancel (etp_pool pool, ETP_REQ *grp); ETP_API_DECL void -etp_cancel (ETP_REQ *req) +etp_cancel (etp_pool pool, ETP_REQ *req) { req->cancelled = 1; - etp_grp_cancel (req); + etp_grp_cancel (pool, req); } ETP_API_DECL void -etp_grp_cancel (ETP_REQ *grp) +etp_grp_cancel (etp_pool pool, ETP_REQ *grp) { for (grp = grp->grp_first; grp; grp = grp->grp_next) - etp_cancel (grp); + etp_cancel (pool, grp); } ETP_API_DECL void -etp_submit (ETP_REQ *req) +etp_submit (etp_pool pool, ETP_REQ *req) { req->pri -= ETP_PRI_MIN; @@ -417,78 +561,78 @@ if (ecb_expect_false (req->type == ETP_TYPE_GROUP)) { /* I hope this is worth it :/ */ - X_LOCK (reqlock); - ++nreqs; - X_UNLOCK (reqlock); + X_LOCK (pool->reqlock); + ++pool->nreqs; + X_UNLOCK (pool->reqlock); - X_LOCK (reslock); + X_LOCK (pool->reslock); - ++npending; + ++pool->npending; - if (!reqq_push (&res_queue, req) && want_poll_cb) - want_poll_cb (); + if (!reqq_push (&pool->res_queue, req)) + ETP_WANT_POLL (pool); - X_UNLOCK (reslock); + X_UNLOCK (pool->reslock); } else { - X_LOCK (reqlock); - ++nreqs; - ++nready; - reqq_push (&req_queue, req); - X_COND_SIGNAL (reqwait); - X_UNLOCK (reqlock); + X_LOCK (pool->reqlock); + ++pool->nreqs; + ++pool->nready; + reqq_push (&pool->req_queue, req); + X_COND_SIGNAL (pool->reqwait); + X_UNLOCK (pool->reqlock); - etp_maybe_start_thread (); + etp_maybe_start_thread (pool); } } ETP_API_DECL void ecb_cold -etp_set_max_poll_time (double nseconds) +etp_set_max_poll_time (etp_pool pool, double seconds) { - if (WORDACCESS_UNSAFE) X_LOCK (reslock); - max_poll_time = nseconds * ETP_TICKS; - if (WORDACCESS_UNSAFE) X_UNLOCK (reslock); + if (WORDACCESS_UNSAFE) X_LOCK (pool->reslock); + pool->max_poll_time = seconds * ETP_TICKS; + if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reslock); } ETP_API_DECL void ecb_cold -etp_set_max_poll_reqs (unsigned int maxreqs) +etp_set_max_poll_reqs (etp_pool pool, unsigned int maxreqs) { - if (WORDACCESS_UNSAFE) X_LOCK (reslock); - max_poll_reqs = maxreqs; - if (WORDACCESS_UNSAFE) X_UNLOCK (reslock); + if (WORDACCESS_UNSAFE) X_LOCK (pool->reslock); + pool->max_poll_reqs = maxreqs; + if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reslock); } ETP_API_DECL void ecb_cold -etp_set_max_idle (unsigned int nthreads) +etp_set_max_idle (etp_pool pool, unsigned int threads) { - if (WORDACCESS_UNSAFE) X_LOCK (reqlock); - max_idle = nthreads; - if (WORDACCESS_UNSAFE) X_UNLOCK (reqlock); + if (WORDACCESS_UNSAFE) X_LOCK (pool->reqlock); + pool->max_idle = threads; + if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock); } ETP_API_DECL void ecb_cold -etp_set_idle_timeout (unsigned int seconds) +etp_set_idle_timeout (etp_pool pool, unsigned int seconds) { - if (WORDACCESS_UNSAFE) X_LOCK (reqlock); - idle_timeout = seconds; - if (WORDACCESS_UNSAFE) X_UNLOCK (reqlock); + if (WORDACCESS_UNSAFE) X_LOCK (pool->reqlock); + pool->idle_timeout = seconds; + if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock); } ETP_API_DECL void ecb_cold -etp_set_min_parallel (unsigned int nthreads) +etp_set_min_parallel (etp_pool pool, unsigned int threads) { - if (wanted < nthreads) - wanted = nthreads; + if (pool->wanted < threads) + pool->wanted = threads; } ETP_API_DECL void ecb_cold -etp_set_max_parallel (unsigned int nthreads) +etp_set_max_parallel (etp_pool pool, unsigned int threads) { - if (wanted > nthreads) - wanted = nthreads; + if (pool->wanted > threads) + pool->wanted = threads; - while (started > wanted) - etp_end_thread (); + while (pool->started > pool->wanted) + etp_end_thread (pool); } diff -Nru libio-aio-perl-4.32/libeio/libeio.m4 libio-aio-perl-4.33/libeio/libeio.m4 --- libio-aio-perl-4.32/libeio/libeio.m4 2012-11-13 20:16:47.000000000 +0000 +++ libio-aio-perl-4.33/libeio/libeio.m4 2015-06-25 13:21:23.000000000 +0000 @@ -193,3 +193,15 @@ ])],ac_cv_linux_splice=yes,ac_cv_linux_splice=no)]) test $ac_cv_linux_splice = yes && AC_DEFINE(HAVE_LINUX_SPLICE, 1, splice/vmsplice/tee(2) are available) +AC_CACHE_CHECK(for pipe2, ac_cv_pipe2, [AC_LINK_IFELSE([AC_LANG_SOURCE([[ +#include +#include +int res; +int main (void) +{ + res = pipe2 (0, 0); + return 0; +} +]])],ac_cv_pipe2=yes,ac_cv_pipe2=no)]) +test $ac_cv_pipe2 = yes && AC_DEFINE(HAVE_PIPE2, 1, pipe2(2) is available) + diff -Nru libio-aio-perl-4.32/libeio/xthread.h libio-aio-perl-4.33/libeio/xthread.h --- libio-aio-perl-4.32/libeio/xthread.h 2013-12-17 17:30:27.000000000 +0000 +++ libio-aio-perl-4.33/libeio/xthread.h 2015-09-21 08:02:53.000000000 +0000 @@ -168,5 +168,18 @@ #endif +#if __linux && __GNUC__ >= 4 && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 3 && 0 /* also check arch */ +/* __thread has little to no advantage over pthread_* in most configurations, so this is not used */ +# define X_TLS_DECLARE(varname) __thread void *varname +# define X_TLS_INIT(varname) +# define X_TLS_SET(varname,value) varname = (value) +# define X_TLS_GET(varname) varname +#else +# define X_TLS_DECLARE(varname) pthread_key_t varname +# define X_TLS_INIT(varname) do { if (pthread_key_create (&(varname), 0)) abort (); } while (0) +# define X_TLS_SET(varname,value) pthread_setspecific (varname, (value)) +# define X_TLS_GET(varname) pthread_getspecific (varname) +#endif + #endif diff -Nru libio-aio-perl-4.32/Makefile.PL libio-aio-perl-4.33/Makefile.PL --- libio-aio-perl-4.32/Makefile.PL 2013-12-17 17:46:31.000000000 +0000 +++ libio-aio-perl-4.33/Makefile.PL 2015-06-04 16:50:29.000000000 +0000 @@ -1,4 +1,4 @@ -use 5.008002; +use Canary::Stability IO::AIO => 1, 5.008002; use ExtUtils::MakeMaker; @@ -110,6 +110,7 @@ PM => { 'AIO.pm' => '$(INST_LIB)/IO/AIO.pm', }, + CONFIGURE_REQUIRES => { ExtUtils::MakeMaker => 6.52, Canary::Stability => 2001 }, PREREQ_PM => { "common::sense" => 0, }, diff -Nru libio-aio-perl-4.32/META.json libio-aio-perl-4.33/META.json --- libio-aio-perl-4.32/META.json 2015-02-11 19:32:27.000000000 +0000 +++ libio-aio-perl-4.33/META.json 2016-01-18 11:52:59.000000000 +0000 @@ -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 } diff -Nru libio-aio-perl-4.32/META.yml libio-aio-perl-4.33/META.yml --- libio-aio-perl-4.32/META.yml 2015-02-11 19:32:27.000000000 +0000 +++ libio-aio-perl-4.33/META.yml 2016-01-18 11:52:59.000000000 +0000 @@ -5,9 +5,10 @@ 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 @@ - inc requires: common::sense: '0' -version: 4.32 +version: 4.33 diff -Nru libio-aio-perl-4.32/README libio-aio-perl-4.33/README --- libio-aio-perl-4.32/README 2015-02-11 19:32:27.000000000 +0000 +++ libio-aio-perl-4.33/README 2016-01-18 11:52:59.000000000 +0000 @@ -92,7 +92,7 @@ print $contents; # exit event loop and program - EV::unloop; + EV::break; }; }; @@ -100,7 +100,7 @@ # 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 @@ "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 @@ 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 @@ 0x47504653 gpfs 0x00004244 hfs 0xf995e849 hpfs + 0x00c0ffee hostfs 0x958458f6 hugetlbfs 0x2bad1dea inotifyfs 0x00009660 isofs @@ -589,6 +592,7 @@ 0x00009fa0 proc 0x6165676c pstorefs 0x0000002f qnx4 + 0x68191122 qnx6 0x858458f6 ramfs 0x52654973 reiserfs 0x00007275 romfs @@ -648,10 +652,14 @@ 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 @@ $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 @@ 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] + 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 It is recommended to use AnyEvent::AIO to integrate IO::AIO automatically into many event loops: