r75180 - in /trunk/libio-aio-perl: AIO.pm AIO.xs Changes META.json README debian/changelog debian/compat debian/control debian/patches/pod.patch libeio/config.h.in libeio/eio.c

ghedo-guest at users.alioth.debian.org ghedo-guest at users.alioth.debian.org
Sun Jun 5 15:25:11 UTC 2011


Author: ghedo-guest
Date: Sun Jun  5 15:25:00 2011
New Revision: 75180

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=75180
Log:
TODO: Decide whether it is a good idea to package libeio separately. Note
that currently it is used also by the nodejs package.
* New upstream release
* Refresh patch
* Add myself to Uploader
* Bump debhelper compat level to 8
* Bump Standards-Version to 3.9.2 (no changes needed)

Modified:
    trunk/libio-aio-perl/AIO.pm
    trunk/libio-aio-perl/AIO.xs
    trunk/libio-aio-perl/Changes
    trunk/libio-aio-perl/META.json
    trunk/libio-aio-perl/README
    trunk/libio-aio-perl/debian/changelog
    trunk/libio-aio-perl/debian/compat
    trunk/libio-aio-perl/debian/control
    trunk/libio-aio-perl/debian/patches/pod.patch
    trunk/libio-aio-perl/libeio/config.h.in
    trunk/libio-aio-perl/libeio/eio.c

Modified: trunk/libio-aio-perl/AIO.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-aio-perl/AIO.pm?rev=75180&op=diff
==============================================================================
--- trunk/libio-aio-perl/AIO.pm (original)
+++ trunk/libio-aio-perl/AIO.pm Sun Jun  5 15:25:00 2011
@@ -170,7 +170,7 @@
 use base 'Exporter';
 
 BEGIN {
-   our $VERSION = '3.8';
+   our $VERSION = '3.9';
 
    our @AIO_REQ = qw(aio_sendfile aio_read aio_write aio_open aio_close
                      aio_stat aio_lstat aio_unlink aio_rmdir aio_readdir aio_readdirx
@@ -370,6 +370,15 @@
       }
    };
 
+In addition to all the common open modes/flags (C<O_RDONLY>, C<O_WRONLY>,
+C<O_RDWR>, C<O_CREAT>, C<O_TRUNC>, C<O_EXCL> and C<O_APPEND>), the
+following POSIX and non-POSIX constants are available (missing ones on
+your system are, as usual, C<0>):
+
+C<O_ASYNC>, C<O_DIRECT>, C<O_NOATIME>, C<O_CLOEXEC>, C<O_NOCTTY>, C<O_NOFOLLOW>,
+C<O_NONBLOCK>, C<O_EXEC>, C<O_SEARCH>, C<O_DIRECTORY>, C<O_DSYNC>,
+C<O_RSYNC>, C<O_SYNC> and C<O_TTY_INIT>.
+
 
 =item aio_close $fh, $callback->($status)
 
@@ -670,8 +679,8 @@
 
 =item IO::AIO::READDIR_DENTS
 
-When this flag is off, then the callback gets an arrayref with of names
-only (as with C<aio_readdir>), otherwise it gets an arrayref with
+When this flag is off, then the callback gets an arrayref consisting of
+names only (as with C<aio_readdir>), otherwise it gets an arrayref with
 C<[$name, $type, $inode]> arrayrefs, each describing a single directory
 entry in more detail.
 
@@ -694,13 +703,13 @@
 =item IO::AIO::READDIR_DIRS_FIRST
 
 When this flag is set, then the names will be returned in an order where
-likely directories come first. This is useful when you need to quickly
-find directories, or you want to find all directories while avoiding to
-stat() each entry.
+likely directories come first, in optimal stat order. This is useful when
+you need to quickly find directories, or you want to find all directories
+while avoiding to stat() each entry.
 
 If the system returns type information in readdir, then this is used
-to find directories directly.  Otherwise, likely directories are files
-beginning with ".", or otherwise files with no dots, of which files with
+to find directories directly. Otherwise, likely directories are names
+beginning with ".", or otherwise names with no dots, of which names with
 short names are tried first.
 
 =item IO::AIO::READDIR_STAT_ORDER
@@ -1408,15 +1417,23 @@
 
 =item IO::AIO::poll_cb
 
-Process some outstanding events on the result pipe. You have to call this
-regularly. Returns C<0> if all events could be processed, or C<-1> if it
-returned earlier for whatever reason. Returns immediately when no events
-are outstanding. The amount of events processed depends on the settings of
-C<IO::AIO::max_poll_req> and C<IO::AIO::max_poll_time>.
+Process some outstanding events on the result pipe. You have to call
+this regularly. Returns C<0> if all events could be processed (or there
+were no events to process), or C<-1> if it returned earlier for whatever
+reason. Returns immediately when no events are outstanding. The amount of
+events processed depends on the settings of C<IO::AIO::max_poll_req> and
+C<IO::AIO::max_poll_time>.
 
 If not all requests were processed for whatever reason, the filehandle
 will still be ready when C<poll_cb> returns, so normally you don't have to
 do anything special to have it called later.
+
+Apart from calling C<IO::AIO::poll_cb> when the event filehandle becomes
+ready, it can be beneficial to call this function from loops which submit
+a lot of requests, to make sure the results get processed when they become
+available and not just when the loop is finished and the event loop takes
+over again. This function returns very fast when there are no outstanding
+requests.
 
 Example: Install an Event watcher that automatically calls
 IO::AIO::poll_cb with high priority (more examples can be found in the

Modified: trunk/libio-aio-perl/AIO.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-aio-perl/AIO.xs?rev=75180&op=diff
==============================================================================
--- trunk/libio-aio-perl/AIO.xs (original)
+++ trunk/libio-aio-perl/AIO.xs Sun Jun  5 15:25:00 2011
@@ -123,6 +123,52 @@
 #include "libeio/config.h"
 #include "libeio/eio.h"
 
+/* Linux/others */
+#ifndef O_ASYNC
+# define O_ASYNC 0
+#endif
+#ifndef O_DIRECT
+# define O_DIRECT 0
+#endif
+#ifndef O_NOATIME
+# define O_NOATIME 0
+#endif
+
+/* POSIX */
+#ifndef O_CLOEXEC
+# define O_CLOEXEC 0
+#endif
+#ifndef O_NOFOLLOW
+# define O_NOFOLLOW 0
+#endif
+#ifndef O_NOCTTY
+# define O_NOCTTY 0
+#endif
+#ifndef O_NONBLOCK
+# define O_NONBLOCK 0
+#endif
+#ifndef O_EXEC
+# define O_EXEC 0
+#endif
+#ifndef O_SEARCH
+# define O_SEARCH 0
+#endif
+#ifndef O_DIRECTORY
+# define O_DIRECTORY 0
+#endif
+#ifndef O_DSYNC
+# define O_DSYNC 0
+#endif
+#ifndef O_RSYNC
+# define O_RSYNC 0
+#endif
+#ifndef O_SYNC
+# define O_SYNC 0
+#endif
+#ifndef O_TTY_INIT
+# define O_TTY_INIT 0
+#endif
+
 #ifndef POSIX_FADV_NORMAL
 # define POSIX_FADV_NORMAL 0
 #endif
@@ -767,6 +813,22 @@
     const_iv (O_EXCL)
     const_iv (O_APPEND)
 
+    const_iv (O_ASYNC)
+    const_iv (O_DIRECT)
+    const_iv (O_NOATIME)
+
+    const_iv (O_CLOEXEC)
+    const_iv (O_NOCTTY)
+    const_iv (O_NOFOLLOW)
+    const_iv (O_NONBLOCK)
+    const_iv (O_EXEC)
+    const_iv (O_SEARCH)
+    const_iv (O_DIRECTORY)
+    const_iv (O_DSYNC)
+    const_iv (O_RSYNC)
+    const_iv (O_SYNC)
+    const_iv (O_TTY_INIT)
+
     const_iv (S_IFIFO)
     const_iv (S_IFCHR)
     const_iv (S_IFBLK)

Modified: trunk/libio-aio-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-aio-perl/Changes?rev=75180&op=diff
==============================================================================
--- trunk/libio-aio-perl/Changes (original)
+++ trunk/libio-aio-perl/Changes Sun Jun  5 15:25:00 2011
@@ -7,8 +7,12 @@
 TODO: aio_fcntl, at least for file-locking
 TODO: fallocate, if it wouldn't be so useless.
 TODO: aio_mincore?
-TODO: add? also linux-specific stuff?
-TODO: O_EXEC O_SEARCH O_CLOEXEC O_DIRECTORY O_DSYNC O_NOCTTY O_NOFOLLOW O_NONBLOCK O_RSYNC O_SYNC O_TTY_INIT O_DIRECT O_LARGEFILE O_NOATIME O_ASYNC
+
+3.9  Fri May 27 02:43:47 CEST 2011
+        - (libeio) fix memory corruption in aio_readdirx for the flags
+          combination READDIR_STAT_ORDER | READDIR_DIRS_FIRST.
+        - add lots of newre POSIX and GNU/Linux-specific open
+          flags.
 
 3.8  Sun Mar 27 12:25:33 CEST 2011
 	- use nonstandard but maybe-working-on-bsd fork technique.
@@ -16,7 +20,7 @@
 	- support setting of idle timeout value (IO::AIO::idle_timeout).
 
 3.72 Fri Feb 11 04:25:38 CET 2011
-	- use _POSIX_MEMLOCK_RANGE to detetc mlock/munlock.
+	- use _POSIX_MEMLOCK_RANGE to detect mlock/munlock.
         - aio_mknod always used a dev_t value of 0.
         - new treescan option: --grep.
         - add more S_IF macros, and major/minor/makedev "macros".

Modified: trunk/libio-aio-perl/META.json
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-aio-perl/META.json?rev=75180&op=diff
==============================================================================
--- trunk/libio-aio-perl/META.json (original)
+++ trunk/libio-aio-perl/META.json Sun Jun  5 15:25:00 2011
@@ -11,7 +11,7 @@
    },
    "generated_by" : "ExtUtils::MakeMaker::JSONMETA version 7.000",
    "distribution_type" : "module",
-   "version" : "3.8",
+   "version" : "3.9",
    "name" : "IO-AIO",
    "author" : [],
    "license" : "unknown",

Modified: trunk/libio-aio-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-aio-perl/README?rev=75180&op=diff
==============================================================================
--- trunk/libio-aio-perl/README (original)
+++ trunk/libio-aio-perl/README Sun Jun  5 15:25:00 2011
@@ -308,6 +308,15 @@
               }
            };
 
+        In addition to all the common open modes/flags ("O_RDONLY",
+        "O_WRONLY", "O_RDWR", "O_CREAT", "O_TRUNC", "O_EXCL" and
+        "O_APPEND"), the following POSIX and non-POSIX constants are
+        available (missing ones on your system are, as usual, 0):
+
+        "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".
+
     aio_close $fh, $callback->($status)
         Asynchronously close a file and call the callback with the result
         code.
@@ -571,9 +580,9 @@
         modified):
 
         IO::AIO::READDIR_DENTS
-            When this flag is off, then the callback gets an arrayref with
-            of names only (as with "aio_readdir"), otherwise it gets an
-            arrayref with "[$name, $type, $inode]" arrayrefs, each
+            When this flag is off, then the callback gets an arrayref
+            consisting of names only (as with "aio_readdir"), otherwise it
+            gets an arrayref with "[$name, $type, $inode]" arrayrefs, each
             describing a single directory entry in more detail.
 
             $name is the name of the entry.
@@ -596,14 +605,15 @@
 
         IO::AIO::READDIR_DIRS_FIRST
             When this flag is set, then the names will be returned in an
-            order where likely directories come first. This is useful when
-            you need to quickly find directories, or you want to find all
-            directories while avoiding to stat() each entry.
+            order where likely directories come first, in optimal stat
+            order. This is useful when you need to quickly find directories,
+            or you want to find all directories while avoiding to stat()
+            each entry.
 
             If the system returns type information in readdir, then this is
             used to find directories directly. Otherwise, likely directories
-            are files beginning with ".", or otherwise files with no dots,
-            of which files with short names are tried first.
+            are names beginning with ".", or otherwise names with no dots,
+            of which names with short names are tried first.
 
         IO::AIO::READDIR_STAT_ORDER
             When this flag is set, then the names will be returned in an
@@ -1024,15 +1034,22 @@
 
     IO::AIO::poll_cb
         Process some outstanding events on the result pipe. You have to call
-        this regularly. Returns 0 if all events could be processed, or -1 if
-        it returned earlier for whatever reason. Returns immediately when no
-        events are outstanding. The amount of events processed depends on
-        the settings of "IO::AIO::max_poll_req" and
-        "IO::AIO::max_poll_time".
+        this regularly. Returns 0 if all events could be processed (or there
+        were no events to process), or -1 if it returned earlier for
+        whatever reason. Returns immediately when no events are outstanding.
+        The amount of events processed depends on the settings of
+        "IO::AIO::max_poll_req" and "IO::AIO::max_poll_time".
 
         If not all requests were processed for whatever reason, the
         filehandle will still be ready when "poll_cb" returns, so normally
         you don't have to do anything special to have it called later.
+
+        Apart from calling "IO::AIO::poll_cb" when the event filehandle
+        becomes ready, it can be beneficial to call this function from loops
+        which submit a lot of requests, to make sure the results get
+        processed when they become available and not just when the loop is
+        finished and the event loop takes over again. This function returns
+        very fast when there are no outstanding requests.
 
         Example: Install an Event watcher that automatically calls
         IO::AIO::poll_cb with high priority (more examples can be found in

Modified: trunk/libio-aio-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-aio-perl/debian/changelog?rev=75180&op=diff
==============================================================================
--- trunk/libio-aio-perl/debian/changelog (original)
+++ trunk/libio-aio-perl/debian/changelog Sun Jun  5 15:25:00 2011
@@ -1,6 +1,19 @@
+libio-aio-perl (3.90-1) UNRELEASED; urgency=low
+
+  TODO: Decide whether it is a good idea to package libeio separately. Note
+  that currently it is used also by the nodejs package.
+
+  * New upstream release
+  * Refresh patch
+  * Add myself to Uploader
+  * Bump debhelper compat level to 8
+  * Bump Standards-Version to 3.9.2 (no changes needed)
+
+ -- Alessandro Ghedini <al3xbio at gmail.com>  Sun, 05 Jun 2011 15:34:14 +0200
+
 libio-aio-perl (3.80-1) unstable; urgency=low
 
-  * Updated watch file 
+  * Updated watch file
   * New upstream release
   * Updated copyright
   * Refreshed patch

Modified: trunk/libio-aio-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-aio-perl/debian/compat?rev=75180&op=diff
==============================================================================
--- trunk/libio-aio-perl/debian/compat (original)
+++ trunk/libio-aio-perl/debian/compat Sun Jun  5 15:25:00 2011
@@ -1,1 +1,1 @@
-7
+8

Modified: trunk/libio-aio-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-aio-perl/debian/control?rev=75180&op=diff
==============================================================================
--- trunk/libio-aio-perl/debian/control (original)
+++ trunk/libio-aio-perl/debian/control Sun Jun  5 15:25:00 2011
@@ -2,9 +2,10 @@
 Section: perl
 Priority: optional
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Nicholas Bamber <nicholas at periapt.co.uk>
-Build-Depends: debhelper (>= 7.3.7~), libcommon-sense-perl
-Standards-Version: 3.9.1
+Uploaders: Nicholas Bamber <nicholas at periapt.co.uk>,
+ Alessandro Ghedini <al3xbio at gmail.com>
+Build-Depends: debhelper (>= 8), libcommon-sense-perl
+Standards-Version: 3.9.2
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libio-aio-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libio-aio-perl/
 Homepage: http://search.cpan.org/dist/IO-AIO/

Modified: trunk/libio-aio-perl/debian/patches/pod.patch
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-aio-perl/debian/patches/pod.patch?rev=75180&op=diff
==============================================================================
--- trunk/libio-aio-perl/debian/patches/pod.patch (original)
+++ trunk/libio-aio-perl/debian/patches/pod.patch Sun Jun  5 15:25:00 2011
@@ -4,7 +4,7 @@
 Last-Update: 2011-03-30
 --- a/AIO.pm
 +++ b/AIO.pm
-@@ -717,7 +717,7 @@
+@@ -726,7 +726,7 @@
  
  This flag should not be set when calling C<aio_readdirx>. Instead, it
  is being set by C<aio_readdirx>, when any of the C<$type>'s found were
@@ -13,7 +13,7 @@
  C<$type>'s are known, which can be used to speed up some algorithms.
  
  =back
-@@ -909,7 +909,7 @@
+@@ -918,7 +918,7 @@
  entry plus an appended C</.> will be C<stat>'ed, likely directories first,
  in order of their inode numbers. If that succeeds, it assumes that the
  entry is a directory or a symlink to directory (which will be checked
@@ -22,7 +22,7 @@
  filesystems might detect the type of the entry without reading the inode
  data (e.g. ext2fs filetype feature), even on systems that cannot return
  the filetype information on readdir.
-@@ -1613,7 +1613,7 @@
+@@ -1630,7 +1630,7 @@
  
  Simply calls the C<posix_fadvise> function (see its
  manpage for details). The following advice constants are
@@ -31,7 +31,7 @@
  C<IO::AIO::FADV_RANDOM>, C<IO::AIO::FADV_NOREUSE>,
  C<IO::AIO::FADV_WILLNEED>, C<IO::AIO::FADV_DONTNEED>.
  
-@@ -1624,7 +1624,7 @@
+@@ -1641,7 +1641,7 @@
  
  Simply calls the C<posix_madvise> function (see its
  manpage for details). The following advice constants are
@@ -40,7 +40,7 @@
  C<IO::AIO::MADV_RANDOM>, C<IO::AIO::MADV_WILLNEED>, C<IO::AIO::MADV_DONTNEED>.
  
  On systems that do not implement C<posix_madvise>, this function returns
-@@ -1634,7 +1634,7 @@
+@@ -1651,7 +1651,7 @@
  
  Simply calls the C<mprotect> function on the preferably AIO::mmap'ed
  $scalar (see its manpage for details). The following protect

Modified: trunk/libio-aio-perl/libeio/config.h.in
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-aio-perl/libeio/config.h.in?rev=75180&op=diff
==============================================================================
--- trunk/libio-aio-perl/libeio/config.h.in (original)
+++ trunk/libio-aio-perl/libeio/config.h.in Sun Jun  5 15:25:00 2011
@@ -85,5 +85,37 @@
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
 /* Version number of package */
 #undef VERSION
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE

Modified: trunk/libio-aio-perl/libeio/eio.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libio-aio-perl/libeio/eio.c?rev=75180&op=diff
==============================================================================
--- trunk/libio-aio-perl/libeio/eio.c (original)
+++ trunk/libio-aio-perl/libeio/eio.c Sun Jun  5 15:25:00 2011
@@ -1062,8 +1062,10 @@
 static signed char
 eio_dent_cmp (const eio_dirent *a, const eio_dirent *b)
 {
-    return a->score - b->score ? a->score - b->score /* works because our signed char is always 0..100 */
-              : a->inode < b->inode ? -1 : a->inode > b->inode ? 1 : 0;
+  return a->score - b->score ? a->score - b->score /* works because our signed char is always 0..100 */
+       : a->inode < b->inode ? -1
+       : a->inode > b->inode ?  1
+       :                        0;
 }
 
 #define EIO_DENT_CMP(i,op,j) eio_dent_cmp (&i, &j) op 0
@@ -1079,8 +1081,8 @@
 
   assert (CHAR_BIT == 8);
   assert (sizeof (eio_dirent) * 8 < 256);
-  assert (offsetof (eio_dirent, inode)); /* we use 0 as sentinel */
-  assert (offsetof (eio_dirent, score)); /* we use 0 as sentinel */
+  assert (offsetof (eio_dirent, inode)); /* we use bit #0 as sentinel */
+  assert (offsetof (eio_dirent, score)); /* we use bit #0 as sentinel */
 
   if (size <= EIO_SORT_FAST)
     return;
@@ -1245,6 +1247,7 @@
   X_LOCK (wrklock);
   /* the corresponding closedir is in ETP_WORKER_CLEAR */
   self->dirp = dirp = opendir (req->ptr1);
+
   req->flags |= EIO_FLAG_PTR1_FREE | EIO_FLAG_PTR2_FREE;
   req->ptr1 = dents = flags ? malloc (dentalloc * sizeof (eio_dirent)) : 0;
   req->ptr2 = names = malloc (namesalloc);
@@ -1266,7 +1269,7 @@
             req->result = dentoffs;
 
             if (flags & EIO_READDIR_STAT_ORDER)
-              eio_dent_sort (dents, dentoffs, 0, inode_bits); /* sort by inode exclusively */
+              eio_dent_sort (dents, dentoffs, flags & EIO_READDIR_DIRS_FIRST ? 7 : 0, inode_bits);
             else if (flags & EIO_READDIR_DIRS_FIRST)
               if (flags & EIO_READDIR_FOUND_UNKNOWN)
                 eio_dent_sort (dents, dentoffs, 7, inode_bits); /* sort by score and inode */
@@ -1278,7 +1281,6 @@
 
                   /* now partition dirs to the front, and non-dirs to the back */
                   /* by walking from both sides and swapping if necessary */
-                  /* also clear score, so it doesn't influence sorting */
                   while (oth > dir)
                     {
                       if (dir->type == EIO_DT_DIR)
@@ -1291,7 +1293,7 @@
                         }
                     }
 
-                  /* now sort the dirs only */
+                  /* now sort the dirs only (dirs all have the same score) */
                   eio_dent_sort (dents, dir - dents, 0, inode_bits);
                 }
 




More information about the Pkg-perl-cvs-commits mailing list