r75153 - in /branches/upstream/libio-aio-perl/current: AIO.pm AIO.xs Changes META.json README libeio/config.h.in libeio/eio.c
ghedo-guest at users.alioth.debian.org
ghedo-guest at users.alioth.debian.org
Sun Jun 5 13:33:52 UTC 2011
Author: ghedo-guest
Date: Sun Jun 5 13:33:44 2011
New Revision: 75153
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=75153
Log:
[svn-upgrade] new version libio-aio-perl (3.90)
Modified:
branches/upstream/libio-aio-perl/current/AIO.pm
branches/upstream/libio-aio-perl/current/AIO.xs
branches/upstream/libio-aio-perl/current/Changes
branches/upstream/libio-aio-perl/current/META.json
branches/upstream/libio-aio-perl/current/README
branches/upstream/libio-aio-perl/current/libeio/config.h.in
branches/upstream/libio-aio-perl/current/libeio/eio.c
Modified: branches/upstream/libio-aio-perl/current/AIO.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-aio-perl/current/AIO.pm?rev=75153&op=diff
==============================================================================
--- branches/upstream/libio-aio-perl/current/AIO.pm (original)
+++ branches/upstream/libio-aio-perl/current/AIO.pm Sun Jun 5 13:33:44 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: branches/upstream/libio-aio-perl/current/AIO.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-aio-perl/current/AIO.xs?rev=75153&op=diff
==============================================================================
--- branches/upstream/libio-aio-perl/current/AIO.xs (original)
+++ branches/upstream/libio-aio-perl/current/AIO.xs Sun Jun 5 13:33:44 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: branches/upstream/libio-aio-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-aio-perl/current/Changes?rev=75153&op=diff
==============================================================================
--- branches/upstream/libio-aio-perl/current/Changes (original)
+++ branches/upstream/libio-aio-perl/current/Changes Sun Jun 5 13:33:44 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: branches/upstream/libio-aio-perl/current/META.json
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-aio-perl/current/META.json?rev=75153&op=diff
==============================================================================
--- branches/upstream/libio-aio-perl/current/META.json (original)
+++ branches/upstream/libio-aio-perl/current/META.json Sun Jun 5 13:33:44 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: branches/upstream/libio-aio-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-aio-perl/current/README?rev=75153&op=diff
==============================================================================
--- branches/upstream/libio-aio-perl/current/README (original)
+++ branches/upstream/libio-aio-perl/current/README Sun Jun 5 13:33:44 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: branches/upstream/libio-aio-perl/current/libeio/config.h.in
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-aio-perl/current/libeio/config.h.in?rev=75153&op=diff
==============================================================================
--- branches/upstream/libio-aio-perl/current/libeio/config.h.in (original)
+++ branches/upstream/libio-aio-perl/current/libeio/config.h.in Sun Jun 5 13:33:44 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: branches/upstream/libio-aio-perl/current/libeio/eio.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libio-aio-perl/current/libeio/eio.c?rev=75153&op=diff
==============================================================================
--- branches/upstream/libio-aio-perl/current/libeio/eio.c (original)
+++ branches/upstream/libio-aio-perl/current/libeio/eio.c Sun Jun 5 13:33:44 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