Browse files

Merge branch 'vanilla-libeio'

Conflicts:
	deps/libeio/config.h.in
  • Loading branch information...
2 parents 435ece5 + b8d63c1 commit 464f5d4e13ab5feff085be41011c8e478ac63ef8 @ry ry committed Jan 11, 2011
Showing with 8,197 additions and 6,386 deletions.
  1. +7 −0 deps/libeio/Changes
  2. +8,073 −6,359 deps/libeio/aclocal.m4
  3. +34 −0 deps/libeio/config.h.in
  4. +1 −1 deps/libeio/configure.ac
  5. +1 −1 deps/libeio/demo.c
  6. +25 −17 deps/libeio/eio.c
  7. +1 −1 deps/libeio/eio.h
  8. +55 −6 deps/libeio/libeio.m4
  9. +0 −1 deps/libeio/xthread.h
View
7 deps/libeio/Changes
@@ -25,4 +25,11 @@ TODO: openbsd requites stdint.h for intptr_t - why posix?
- add OS-independent EIO_MT_* and EIO_MS_* flag enums.
- add eio_statvfs/eio_fstatvfs.
- add eio_mlock/eio_mlockall and OS-independent MCL_* flag enums.
+ - no longer set errno to 0 before making syscalls, this only lures
+ people into the trap of believing errno shows success or failure.
+ - "fix" demo.c so that it works as non-root.
+ - suppoert utimes seperately from futimes, as some systems have
+ utimes but not futimes.
+ - use _POSIX_MEMLOCK_RANGE for mlock.
+ - do not (errornously) overwrite CFLAGS in configure.ac.
View
14,432 deps/libeio/aclocal.m4
8,073 additions, 6,359 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
34 deps/libeio/config.h.in
@@ -15,6 +15,12 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* posix_fadvise(2) is available */
+#undef HAVE_POSIX_FADVISE
+
+/* posix_madvise(2) is available */
+#undef HAVE_POSIX_MADVISE
+
/* pread(2) and pwrite(2) are available */
#undef HAVE_PREADWRITE
@@ -48,5 +54,33 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* utimes(2) is available */
+#undef HAVE_UTIMES
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
View
2 deps/libeio/configure.ac
@@ -14,7 +14,7 @@ if test "x$GCC" = xyes ; then
fi
dnl somebody will forgive me
-CFLAGS="-D_GNU_SOURCE"
+CFLAGS="-D_GNU_SOURCE $CFLAGS"
m4_include([libeio.m4])
View
2 deps/libeio/demo.c
@@ -143,7 +143,7 @@ main (void)
eio_futime (last_fd, 92345.678, 93456.789, 0, res_cb, "futime");
eio_chown ("eio-test-dir", getuid (), getgid (), 0, res_cb, "chown");
eio_fchown (last_fd, getuid (), getgid (), 0, res_cb, "fchown");
- eio_fchmod (last_fd, 0123, 0, res_cb, "fchmod");
+ eio_fchmod (last_fd, 0723, 0, res_cb, "fchmod");
eio_readdir ("eio-test-dir", 0, 0, readdir_cb, "readdir");
eio_readdir ("/nonexistant", 0, 0, readdir_cb, "readdir");
eio_fstat (last_fd, 0, stat_cb, "stat");
View
42 deps/libeio/eio.c
@@ -104,7 +104,7 @@
# include <signal.h>
# include <dirent.h>
-#if _POSIX_MEMLOCK || _POSIX_MAPPED_FILES
+#if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES
# include <sys/mman.h>
#endif
@@ -845,12 +845,10 @@ eio__pwrite (int fd, void *buf, size_t count, off_t offset)
}
#endif
-#ifndef HAVE_FUTIMES
+#ifndef HAVE_UTIMES
# undef utimes
-# undef futimes
-# define utimes(path,times) eio__utimes (path, times)
-# define futimes(fd,times) eio__futimes (fd, times)
+# define utimes(path,times) eio__utimes (path, times)
static int
eio__utimes (const char *filename, const struct timeval times[2])
@@ -868,6 +866,13 @@ eio__utimes (const char *filename, const struct timeval times[2])
return utime (filename, 0);
}
+#endif
+
+#ifndef HAVE_FUTIMES
+
+# undef futimes
+# define futimes(fd,times) eio__futimes (fd, times)
+
static int eio__futimes (int fd, const struct timeval tv[2])
{
errno = ENOSYS;
@@ -1479,19 +1484,10 @@ eio_page_align (void **addr, size_t *length)
}
#if !_POSIX_MEMLOCK
-# define eio__mlock(a,b) ((errno = ENOSYS), -1)
# define eio__mlockall(a) ((errno = ENOSYS), -1)
#else
static int
-eio__mlock (void *addr, size_t length)
-{
- eio_page_align (&addr, &length);
-
- return mlock (addr, length);
-}
-
-static int
eio__mlockall (int flags)
{
#if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 7
@@ -1511,6 +1507,20 @@ eio__mlockall (int flags)
}
#endif
+#if !_POSIX_MEMLOCK_RANGE
+# define eio__mlock(a,b) ((errno = ENOSYS), -1)
+#else
+
+static int
+eio__mlock (void *addr, size_t length)
+{
+ eio_page_align (&addr, &length);
+
+ return mlock (addr, length);
+}
+
+#endif
+
#if !(_POSIX_MAPPED_FILES && _POSIX_SYNCHRONIZED_IO)
# define eio__msync(a,b,c) ((errno = ENOSYS), -1)
#else
@@ -1683,8 +1693,6 @@ static void eio_api_destroy (eio_req *req)
static void eio_execute (etp_worker *self, eio_req *req)
{
- errno = 0;
-
switch (req->type)
{
case EIO_READ: ALLOC (req->size);
@@ -1801,7 +1809,6 @@ static void eio_execute (etp_worker *self, eio_req *req)
else
times = 0;
-
req->result = req->type == EIO_FUTIME
? futimes (req->int1, times)
: utimes (req->ptr1, times);
@@ -1820,6 +1827,7 @@ static void eio_execute (etp_worker *self, eio_req *req)
break;
default:
+ errno = ENOSYS;
req->result = -1;
break;
}
View
2 deps/libeio/eio.h
@@ -184,7 +184,7 @@ enum
enum {
EIO_PRI_MIN = -4,
EIO_PRI_MAX = 4,
- EIO_PRI_DEFAULT = 0
+ EIO_PRI_DEFAULT = 0,
};
/* eio request structure */
View
61 deps/libeio/libeio.m4
@@ -5,14 +5,28 @@ AC_SEARCH_LIBS(
[AC_MSG_ERROR(pthread functions not found)]
)
+AC_CACHE_CHECK(for utimes, ac_cv_utimes, [AC_LINK_IFELSE([[
+#include <sys/types.h>
+#include <sys/time.h>
+#include <utime.h>
+struct timeval tv[2];
+int res;
+int main (void)
+{
+ res = utimes ("/", tv);
+ return 0;
+}
+]],ac_cv_utimes=yes,ac_cv_utimes=no)])
+test $ac_cv_utimes = yes && AC_DEFINE(HAVE_UTIMES, 1, utimes(2) is available)
+
AC_CACHE_CHECK(for futimes, ac_cv_futimes, [AC_LINK_IFELSE([[
#include <sys/types.h>
#include <sys/time.h>
#include <utime.h>
struct timeval tv[2];
int res;
int fd;
-int main(void)
+int main (void)
{
res = futimes (fd, tv);
return 0;
@@ -22,7 +36,7 @@ test $ac_cv_futimes = yes && AC_DEFINE(HAVE_FUTIMES, 1, futimes(2) is available)
AC_CACHE_CHECK(for readahead, ac_cv_readahead, [AC_LINK_IFELSE([
#include <fcntl.h>
-int main(void)
+int main (void)
{
int fd = 0;
size_t count = 2;
@@ -35,7 +49,7 @@ test $ac_cv_readahead = yes && AC_DEFINE(HAVE_READAHEAD, 1, readahead(2) is avai
AC_CACHE_CHECK(for fdatasync, ac_cv_fdatasync, [AC_LINK_IFELSE([
#include <unistd.h>
-int main(void)
+int main (void)
{
int fd = 0;
fdatasync (fd);
@@ -46,7 +60,7 @@ test $ac_cv_fdatasync = yes && AC_DEFINE(HAVE_FDATASYNC, 1, fdatasync(2) is avai
AC_CACHE_CHECK(for pread and pwrite, ac_cv_preadwrite, [AC_LINK_IFELSE([
#include <unistd.h>
-int main(void)
+int main (void)
{
int fd = 0;
size_t count = 1;
@@ -72,7 +86,7 @@ AC_CACHE_CHECK(for sendfile, ac_cv_sendfile, [AC_LINK_IFELSE([
#else
# error unsupported architecture
#endif
-int main(void)
+int main (void)
{
int fd = 0;
off_t offset = 1;
@@ -92,7 +106,7 @@ test $ac_cv_sendfile = yes && AC_DEFINE(HAVE_SENDFILE, 1, sendfile(2) is availab
AC_CACHE_CHECK(for sync_file_range, ac_cv_sync_file_range, [AC_LINK_IFELSE([
#include <fcntl.h>
-int main(void)
+int main (void)
{
int fd = 0;
off64_t offset = 1;
@@ -105,3 +119,38 @@ int main(void)
],ac_cv_sync_file_range=yes,ac_cv_sync_file_range=no)])
test $ac_cv_sync_file_range = yes && AC_DEFINE(HAVE_SYNC_FILE_RANGE, 1, sync_file_range(2) is available)
+dnl #############################################################################
+dnl # these checks exist for the benefit of IO::AIO
+
+dnl at least uclibc defines _POSIX_ADVISORY_INFO without *any* of the required
+dnl functionality actually being present. ugh.
+AC_CACHE_CHECK(for posix_madvise, ac_cv_posix_madvise, [AC_LINK_IFELSE([
+#include <sys/mman.h>
+int main (void)
+{
+ int res = posix_madvise ((void *)0, (size_t)0, POSIX_MADV_NORMAL);
+ int a = POSIX_MADV_SEQUENTIAL;
+ int b = POSIX_MADV_RANDOM;
+ int c = POSIX_MADV_WILLNEED;
+ int d = POSIX_MADV_DONTNEED;
+ return 0;
+}
+],ac_cv_posix_madvise=yes,ac_cv_posix_madvise=no)])
+test $ac_cv_posix_madvise = yes && AC_DEFINE(HAVE_POSIX_MADVISE, 1, posix_madvise(2) is available)
+
+AC_CACHE_CHECK(for posix_fadvise, ac_cv_posix_fadvise, [AC_LINK_IFELSE([
+#define _XOPEN_SOURCE 600
+#include <fcntl.h>
+int main (void)
+{
+ int res = posix_fadvise ((int)0, (off_t)0, (off_t)0, POSIX_FADV_NORMAL);
+ int a = POSIX_FADV_SEQUENTIAL;
+ int b = POSIX_FADV_NOREUSE;
+ int c = POSIX_FADV_RANDOM;
+ int d = POSIX_FADV_WILLNEED;
+ int e = POSIX_FADV_DONTNEED;
+ return 0;
+}
+],ac_cv_posix_fadvise=yes,ac_cv_posix_fadvise=no)])
+test $ac_cv_posix_fadvise = yes && AC_DEFINE(HAVE_POSIX_FADVISE, 1, posix_fadvise(2) is available)
+
View
1 deps/libeio/xthread.h
@@ -32,7 +32,6 @@ typedef int ssize_t
#include <windows.h>
#include <pthread.h>
#define sigset_t int
-#define sigfillset(a)
#define pthread_sigmask(a,b,c)
#define sigaddset(a,b)
#define sigemptyset(s)

0 comments on commit 464f5d4

Please sign in to comment.