Browse Source

Upgrade libeio

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
b8d63c10cd
  1. 7
      deps/libeio/Changes
  2. 11268
      deps/libeio/aclocal.m4
  3. 16
      deps/libeio/config.h.in
  4. 2
      deps/libeio/configure.ac
  5. 2
      deps/libeio/demo.c
  6. 40
      deps/libeio/eio.c
  7. 2
      deps/libeio/eio.h
  8. 49
      deps/libeio/libeio.m4
  9. 1
      deps/libeio/xthread.h

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 OS-independent EIO_MT_* and EIO_MS_* flag enums.
- add eio_statvfs/eio_fstatvfs. - add eio_statvfs/eio_fstatvfs.
- add eio_mlock/eio_mlockall and OS-independent MCL_* flag enums. - 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.

11268
deps/libeio/aclocal.m4

File diff suppressed because it is too large

16
deps/libeio/config.h.in

@ -15,6 +15,12 @@
/* Define to 1 if you have the <memory.h> header file. */ /* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H #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 */ /* pread(2) and pwrite(2) are available */
#undef HAVE_PREADWRITE #undef HAVE_PREADWRITE
@ -48,6 +54,13 @@
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #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 */ /* Name of package */
#undef PACKAGE #undef PACKAGE
@ -63,6 +76,9 @@
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME #undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION

2
deps/libeio/configure.ac

@ -14,7 +14,7 @@ if test "x$GCC" = xyes ; then
fi fi
dnl somebody will forgive me dnl somebody will forgive me
CFLAGS="-D_GNU_SOURCE" CFLAGS="-D_GNU_SOURCE $CFLAGS"
m4_include([libeio.m4]) m4_include([libeio.m4])

2
deps/libeio/demo.c

@ -143,7 +143,7 @@ main (void)
eio_futime (last_fd, 92345.678, 93456.789, 0, res_cb, "futime"); eio_futime (last_fd, 92345.678, 93456.789, 0, res_cb, "futime");
eio_chown ("eio-test-dir", getuid (), getgid (), 0, res_cb, "chown"); eio_chown ("eio-test-dir", getuid (), getgid (), 0, res_cb, "chown");
eio_fchown (last_fd, getuid (), getgid (), 0, res_cb, "fchown"); 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 ("eio-test-dir", 0, 0, readdir_cb, "readdir");
eio_readdir ("/nonexistant", 0, 0, readdir_cb, "readdir"); eio_readdir ("/nonexistant", 0, 0, readdir_cb, "readdir");
eio_fstat (last_fd, 0, stat_cb, "stat"); eio_fstat (last_fd, 0, stat_cb, "stat");

40
deps/libeio/eio.c

@ -81,7 +81,7 @@
# include <signal.h> # include <signal.h>
# include <dirent.h> # include <dirent.h>
#if _POSIX_MEMLOCK || _POSIX_MAPPED_FILES #if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES
# include <sys/mman.h> # include <sys/mman.h>
#endif #endif
@ -818,12 +818,10 @@ eio__pwrite (int fd, void *buf, size_t count, off_t offset)
} }
#endif #endif
#ifndef HAVE_FUTIMES #ifndef HAVE_UTIMES
# undef utimes # undef utimes
# undef futimes
# define utimes(path,times) eio__utimes (path, times) # define utimes(path,times) eio__utimes (path, times)
# define futimes(fd,times) eio__futimes (fd, times)
static int static int
eio__utimes (const char *filename, const struct timeval times[2]) eio__utimes (const char *filename, const struct timeval times[2])
@ -841,6 +839,13 @@ eio__utimes (const char *filename, const struct timeval times[2])
return utime (filename, 0); 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]) static int eio__futimes (int fd, const struct timeval tv[2])
{ {
errno = ENOSYS; errno = ENOSYS;
@ -1428,18 +1433,9 @@ eio_page_align (void **addr, size_t *length)
} }
#if !_POSIX_MEMLOCK #if !_POSIX_MEMLOCK
# define eio__mlock(a,b) ((errno = ENOSYS), -1)
# define eio__mlockall(a) ((errno = ENOSYS), -1) # define eio__mlockall(a) ((errno = ENOSYS), -1)
#else #else
static int
eio__mlock (void *addr, size_t length)
{
eio_page_align (&addr, &length);
return mlock (addr, length);
}
static int static int
eio__mlockall (int flags) eio__mlockall (int flags)
{ {
@ -1460,6 +1456,20 @@ eio__mlockall (int flags)
} }
#endif #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) #if !(_POSIX_MAPPED_FILES && _POSIX_SYNCHRONIZED_IO)
# define eio__msync(a,b,c) ((errno = ENOSYS), -1) # define eio__msync(a,b,c) ((errno = ENOSYS), -1)
#else #else
@ -1632,8 +1642,6 @@ static void eio_api_destroy (eio_req *req)
static void eio_execute (etp_worker *self, eio_req *req) static void eio_execute (etp_worker *self, eio_req *req)
{ {
errno = 0;
switch (req->type) switch (req->type)
{ {
case EIO_READ: ALLOC (req->size); case EIO_READ: ALLOC (req->size);
@ -1724,7 +1732,6 @@ static void eio_execute (etp_worker *self, eio_req *req)
else else
times = 0; times = 0;
req->result = req->type == EIO_FUTIME req->result = req->type == EIO_FUTIME
? futimes (req->int1, times) ? futimes (req->int1, times)
: utimes (req->ptr1, times); : utimes (req->ptr1, times);
@ -1743,6 +1750,7 @@ static void eio_execute (etp_worker *self, eio_req *req)
break; break;
default: default:
errno = ENOSYS;
req->result = -1; req->result = -1;
break; break;
} }

2
deps/libeio/eio.h

@ -171,7 +171,7 @@ enum
enum { enum {
EIO_PRI_MIN = -4, EIO_PRI_MIN = -4,
EIO_PRI_MAX = 4, EIO_PRI_MAX = 4,
EIO_PRI_DEFAULT = 0 EIO_PRI_DEFAULT = 0,
}; };
/* eio request structure */ /* eio request structure */

49
deps/libeio/libeio.m4

@ -5,6 +5,20 @@ AC_SEARCH_LIBS(
[AC_MSG_ERROR(pthread functions not found)] [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([[ AC_CACHE_CHECK(for futimes, ac_cv_futimes, [AC_LINK_IFELSE([[
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
@ -105,3 +119,38 @@ int main(void)
],ac_cv_sync_file_range=yes,ac_cv_sync_file_range=no)]) ],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) 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)

1
deps/libeio/xthread.h

@ -29,7 +29,6 @@ typedef int ssize_t;
#include <windows.h> #include <windows.h>
#include <pthread.h> #include <pthread.h>
#define sigset_t int #define sigset_t int
#define sigfillset(a)
#define pthread_sigmask(a,b,c) #define pthread_sigmask(a,b,c)
#define sigaddset(a,b) #define sigaddset(a,b)
#define sigemptyset(s) #define sigemptyset(s)

Loading…
Cancel
Save