Hello community, here is the log from the commit of package libuv for openSUSE:Factory checked in at 2015-03-03 11:15:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libuv (Old) and /work/SRC/openSUSE:Factory/.libuv.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libuv" Changes: -------- --- /work/SRC/openSUSE:Factory/libuv/libuv.changes 2015-02-18 11:38:13.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.libuv.new/libuv.changes 2015-03-03 11:16:06.000000000 +0100 @@ -1,0 +2,12 @@ +Mon Mar 2 15:50:47 UTC 2015 - [email protected] + +- Version bump to 1.4.2: + * stream: ignore EINVAL for SO_OOBINLINE on OS X (Fedor Indutny) + * win: don't use inline keyword in thread.c (Ben Noordhuis) * windows: fix + * setting dirent types on uv_fs_scandir_next (Saúl Ibarra Corretgé) * + * unix,windows: make uv_thread_create() return errno (Ben Noordhuis) * tty: + * fix build for SmartOS (Julien Gilli) * unix: fix for uv_async data race + * (Michael Penick) * unix, windows: map EHOSTDOWN errno (Ben Noordhuis) * + * stream: use SO_OOBINLINE on OS X (Fedor Indutny) + +------------------------------------------------------------------- Old: ---- v1.4.0.tar.gz New: ---- v1.4.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libuv.spec ++++++ --- /var/tmp/diff_new_pack.f8vbGg/_old 2015-03-03 11:16:07.000000000 +0100 +++ /var/tmp/diff_new_pack.f8vbGg/_new 2015-03-03 11:16:07.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package libuv # -# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %define somajor 1 Name: libuv -Version: 1.4.0 +Version: 1.4.2 Release: 0 Summary: Cross-platform asychronous I/O License: MIT ++++++ v1.4.0.tar.gz -> v1.4.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/AUTHORS new/libuv-1.4.2/AUTHORS --- old/libuv-1.4.0/AUTHORS 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/AUTHORS 2015-02-26 11:20:00.000000000 +0100 @@ -180,3 +180,4 @@ Johan Bergström <[email protected]> Alex Mo <[email protected]> Luis Martinez de Bartolome <[email protected]> +Michael Penick <[email protected]> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/ChangeLog new/libuv-1.4.2/ChangeLog --- old/libuv-1.4.0/ChangeLog 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/ChangeLog 2015-02-26 11:20:00.000000000 +0100 @@ -1,4 +1,31 @@ -2015.02.10, Version 1.4.0 (Stable) +2015.02.27, Version 1.4.2 (Stable) + +Changes since version 1.4.1: + +* stream: ignore EINVAL for SO_OOBINLINE on OS X (Fedor Indutny) + + +2015.02.25, Version 1.4.1 (Stable), e8e3fc5789cc0f02937879d141cca0411274093c + +Changes since version 1.4.0: + +* win: don't use inline keyword in thread.c (Ben Noordhuis) + +* windows: fix setting dirent types on uv_fs_scandir_next (Saúl Ibarra + Corretgé) + +* unix,windows: make uv_thread_create() return errno (Ben Noordhuis) + +* tty: fix build for SmartOS (Julien Gilli) + +* unix: fix for uv_async data race (Michael Penick) + +* unix, windows: map EHOSTDOWN errno (Ben Noordhuis) + +* stream: use SO_OOBINLINE on OS X (Fedor Indutny) + + +2015.02.10, Version 1.4.0 (Stable), 19fb8a90648f3763240db004b77ab984264409be Changes since version 1.3.0: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/Makefile.am new/libuv-1.4.2/Makefile.am --- old/libuv-1.4.0/Makefile.am 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/Makefile.am 2015-02-26 11:20:00.000000000 +0100 @@ -222,6 +222,7 @@ test/test-tcp-read-stop.c \ test/test-tcp-shutdown-after-write.c \ test/test-tcp-unexpected-read.c \ + test/test-tcp-oob.c \ test/test-tcp-write-to-half-open-connection.c \ test/test-tcp-write-after-connect.c \ test/test-tcp-writealot.c \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/checksparse.sh new/libuv-1.4.2/checksparse.sh --- old/libuv-1.4.0/checksparse.sh 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/checksparse.sh 2015-02-26 11:20:00.000000000 +0100 @@ -145,6 +145,7 @@ test/test-tcp-read-stop.c test/test-tcp-shutdown-after-write.c test/test-tcp-unexpected-read.c +test/test-tcp-oob.c test/test-tcp-write-error.c test/test-tcp-write-to-half-open-connection.c test/test-tcp-writealot.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/configure.ac new/libuv-1.4.2/configure.ac --- old/libuv-1.4.0/configure.ac 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/configure.ac 2015-02-26 11:20:00.000000000 +0100 @@ -13,7 +13,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_PREREQ(2.57) -AC_INIT([libuv], [1.4.0], [https://github.com/libuv/libuv/issues]) +AC_INIT([libuv], [1.4.2], [https://github.com/libuv/libuv/issues]) AC_CONFIG_MACRO_DIR([m4]) m4_include([m4/libuv-extra-automake-flags.m4]) m4_include([m4/as_case.m4]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/docs/src/threading.rst new/libuv-1.4.2/docs/src/threading.rst --- old/libuv-1.4.0/docs/src/threading.rst 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/docs/src/threading.rst 2015-02-26 11:20:00.000000000 +0100 @@ -56,6 +56,9 @@ ^^^^^^^ .. c:function:: int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg) + + .. versionchanged:: 1.4.1 returns a UV_E* error code on failure + .. c:function:: uv_thread_t uv_thread_self(void) .. c:function:: int uv_thread_join(uv_thread_t *tid) .. c:function:: int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/include/uv-errno.h new/libuv-1.4.2/include/uv-errno.h --- old/libuv-1.4.0/include/uv-errno.h 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/include/uv-errno.h 2015-02-26 11:20:00.000000000 +0100 @@ -399,4 +399,20 @@ # define UV__EMLINK (-4032) #endif +/* EHOSTDOWN is not visible on BSD-like systems when _POSIX_C_SOURCE is + * defined. Fortunately, its value is always 64 so it's possible albeit + * icky to hard-code it. + */ +#if defined(EHOSTDOWN) && !defined(_WIN32) +# define UV__EHOSTDOWN (-EHOSTDOWN) +#elif defined(__APPLE__) || \ + defined(__DragonFly__) || \ + defined(__FreeBSD__) || \ + defined(__NetBSD__) || \ + defined(__OpenBSD__) +# define UV__EHOSTDOWN (-64) +#else +# define UV__EHOSTDOWN (-4031) +#endif + #endif /* UV_ERRNO_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/include/uv-version.h new/libuv-1.4.2/include/uv-version.h --- old/libuv-1.4.0/include/uv-version.h 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/include/uv-version.h 2015-02-26 11:20:00.000000000 +0100 @@ -32,7 +32,7 @@ #define UV_VERSION_MAJOR 1 #define UV_VERSION_MINOR 4 -#define UV_VERSION_PATCH 0 +#define UV_VERSION_PATCH 2 #define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_SUFFIX "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/include/uv-win.h new/libuv-1.4.2/include/uv-win.h --- old/libuv-1.4.0/include/uv-win.h 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/include/uv-win.h 2015-02-26 11:20:00.000000000 +0100 @@ -294,6 +294,7 @@ char d_name[1]; } uv__dirent_t; +#define HAVE_DIRENT_TYPES #define UV__DT_DIR UV_DIRENT_DIR #define UV__DT_FILE UV_DIRENT_FILE #define UV__DT_LINK UV_DIRENT_LINK diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/include/uv.h new/libuv-1.4.2/include/uv.h --- old/libuv-1.4.0/include/uv.h 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/include/uv.h 2015-02-26 11:20:00.000000000 +0100 @@ -138,6 +138,7 @@ XX(EOF, "end of file") \ XX(ENXIO, "no such device or address") \ XX(EMLINK, "too many links") \ + XX(EHOSTDOWN, "host is down") \ #define UV_HANDLE_TYPE_MAP(XX) \ XX(ASYNC, async) \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/src/unix/async.c new/libuv-1.4.2/src/unix/async.c --- old/libuv-1.4.0/src/unix/async.c 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/src/unix/async.c 2015-02-26 11:20:00.000000000 +0100 @@ -24,6 +24,7 @@ #include "uv.h" #include "internal.h" +#include "atomic-ops.h" #include <errno.h> #include <stdio.h> /* snprintf() */ @@ -35,7 +36,6 @@ static void uv__async_event(uv_loop_t* loop, struct uv__async* w, unsigned int nevents); -static int uv__async_make_pending(int* pending); static int uv__async_eventfd(void); @@ -58,7 +58,11 @@ int uv_async_send(uv_async_t* handle) { - if (uv__async_make_pending(&handle->pending) == 0) + /* Do a cheap read first. */ + if (ACCESS_ONCE(int, handle->pending) != 0) + return 0; + + if (cmpxchgi(&handle->pending, 0, 1) == 0) uv__async_send(&handle->loop->async_watcher); return 0; @@ -80,9 +84,8 @@ QUEUE_FOREACH(q, &loop->async_handles) { h = QUEUE_DATA(q, uv_async_t, queue); - if (h->pending == 0) + if (cmpxchgi(&h->pending, 1, 0) == 0) continue; - h->pending = 0; if (h->async_cb == NULL) continue; @@ -91,37 +94,6 @@ } -static int uv__async_make_pending(int* pending) { - /* Do a cheap read first. */ - if (ACCESS_ONCE(int, *pending) != 0) - return 1; - - /* Micro-optimization: use atomic memory operations to detect if we've been - * preempted by another thread and don't have to make an expensive syscall. - * This speeds up the heavily contended case by about 1-2% and has little - * if any impact on the non-contended case. - * - * Use XCHG instead of the CMPXCHG that __sync_val_compare_and_swap() emits - * on x86, it's about 4x faster. It probably makes zero difference in the - * grand scheme of things but I'm OCD enough not to let this one pass. - */ -#if defined(__i386__) || defined(__x86_64__) - { - unsigned int val = 1; - __asm__ __volatile__ ("xchgl %0, %1" - : "+r" (val) - : "m" (*pending)); - return val != 0; - } -#elif defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 0) - return __sync_val_compare_and_swap(pending, 0, 1) != 0; -#else - ACCESS_ONCE(int, *pending) = 1; - return 0; -#endif -} - - static void uv__async_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) { struct uv__async* wa; char buf[1024]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/src/unix/stream.c new/libuv-1.4.2/src/unix/stream.c --- old/libuv-1.4.0/src/unix/stream.c 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/src/unix/stream.c 2015-02-26 11:20:00.000000000 +0100 @@ -375,6 +375,10 @@ int uv__stream_open(uv_stream_t* stream, int fd, int flags) { +#if defined(__APPLE__) + int enable; +#endif + assert(fd >= 0); stream->flags |= flags; @@ -387,6 +391,15 @@ return -errno; } +#if defined(__APPLE__) + enable = 1; + if (setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &enable, sizeof(enable)) && + errno != ENOTSOCK && + errno != EINVAL) { + return -errno; + } +#endif + stream->io_watcher.fd = fd; return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/src/unix/thread.c new/libuv-1.4.2/src/unix/thread.c --- old/libuv-1.4.0/src/unix/thread.c 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/src/unix/thread.c 2015-02-26 11:20:00.000000000 +0100 @@ -68,7 +68,7 @@ if (err) free(ctx); - return err ? -1 : 0; + return -err; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/src/unix/tty.c new/libuv-1.4.2/src/unix/tty.c --- old/libuv-1.4.0/src/unix/tty.c 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/src/unix/tty.c 2015-02-26 11:20:00.000000000 +0100 @@ -103,6 +103,24 @@ return 0; } +static void uv__tty_make_raw(struct termios* tio) { + assert(tio != NULL); + +#ifdef __sun + /* + * This implementation of cfmakeraw for Solaris and derivatives is taken from + * http://www.perkin.org.uk/posts/solaris-portability-cfmakeraw.html. + */ + tio->c_iflag &= ~(IMAXBEL | IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | + IGNCR | ICRNL | IXON); + tio->c_oflag &= ~OPOST; + tio->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + tio->c_cflag &= ~(CSIZE | PARENB); + tio->c_cflag |= CS8; +#else + cfmakeraw(tio); +#endif /* #ifdef __sun */ +} int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) { struct termios tmp; @@ -138,7 +156,7 @@ tmp.c_cc[VTIME] = 0; break; case UV_TTY_MODE_IO: - cfmakeraw(&tmp); + uv__tty_make_raw(&tmp); break; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/src/win/thread.c new/libuv-1.4.2/src/win/thread.c --- old/libuv-1.4.0/src/win/thread.c 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/src/win/thread.c 2015-02-26 11:20:00.000000000 +0100 @@ -30,53 +30,43 @@ #define HAVE_SRWLOCK_API() (pTryAcquireSRWLockShared != NULL) #define HAVE_CONDVAR_API() (pInitializeConditionVariable != NULL) -#ifdef _MSC_VER /* msvc */ -# define inline __inline -# define NOINLINE __declspec (noinline) -#else /* gcc */ -# define inline inline -# define NOINLINE __attribute__ ((noinline)) -#endif - - -inline static int uv__rwlock_srwlock_init(uv_rwlock_t* rwlock); -inline static void uv__rwlock_srwlock_destroy(uv_rwlock_t* rwlock); -inline static void uv__rwlock_srwlock_rdlock(uv_rwlock_t* rwlock); -inline static int uv__rwlock_srwlock_tryrdlock(uv_rwlock_t* rwlock); -inline static void uv__rwlock_srwlock_rdunlock(uv_rwlock_t* rwlock); -inline static void uv__rwlock_srwlock_wrlock(uv_rwlock_t* rwlock); -inline static int uv__rwlock_srwlock_trywrlock(uv_rwlock_t* rwlock); -inline static void uv__rwlock_srwlock_wrunlock(uv_rwlock_t* rwlock); - -inline static int uv__rwlock_fallback_init(uv_rwlock_t* rwlock); -inline static void uv__rwlock_fallback_destroy(uv_rwlock_t* rwlock); -inline static void uv__rwlock_fallback_rdlock(uv_rwlock_t* rwlock); -inline static int uv__rwlock_fallback_tryrdlock(uv_rwlock_t* rwlock); -inline static void uv__rwlock_fallback_rdunlock(uv_rwlock_t* rwlock); -inline static void uv__rwlock_fallback_wrlock(uv_rwlock_t* rwlock); -inline static int uv__rwlock_fallback_trywrlock(uv_rwlock_t* rwlock); -inline static void uv__rwlock_fallback_wrunlock(uv_rwlock_t* rwlock); - - -inline static int uv_cond_fallback_init(uv_cond_t* cond); -inline static void uv_cond_fallback_destroy(uv_cond_t* cond); -inline static void uv_cond_fallback_signal(uv_cond_t* cond); -inline static void uv_cond_fallback_broadcast(uv_cond_t* cond); -inline static void uv_cond_fallback_wait(uv_cond_t* cond, uv_mutex_t* mutex); -inline static int uv_cond_fallback_timedwait(uv_cond_t* cond, +static int uv__rwlock_srwlock_init(uv_rwlock_t* rwlock); +static void uv__rwlock_srwlock_destroy(uv_rwlock_t* rwlock); +static void uv__rwlock_srwlock_rdlock(uv_rwlock_t* rwlock); +static int uv__rwlock_srwlock_tryrdlock(uv_rwlock_t* rwlock); +static void uv__rwlock_srwlock_rdunlock(uv_rwlock_t* rwlock); +static void uv__rwlock_srwlock_wrlock(uv_rwlock_t* rwlock); +static int uv__rwlock_srwlock_trywrlock(uv_rwlock_t* rwlock); +static void uv__rwlock_srwlock_wrunlock(uv_rwlock_t* rwlock); + +static int uv__rwlock_fallback_init(uv_rwlock_t* rwlock); +static void uv__rwlock_fallback_destroy(uv_rwlock_t* rwlock); +static void uv__rwlock_fallback_rdlock(uv_rwlock_t* rwlock); +static int uv__rwlock_fallback_tryrdlock(uv_rwlock_t* rwlock); +static void uv__rwlock_fallback_rdunlock(uv_rwlock_t* rwlock); +static void uv__rwlock_fallback_wrlock(uv_rwlock_t* rwlock); +static int uv__rwlock_fallback_trywrlock(uv_rwlock_t* rwlock); +static void uv__rwlock_fallback_wrunlock(uv_rwlock_t* rwlock); + + +static int uv_cond_fallback_init(uv_cond_t* cond); +static void uv_cond_fallback_destroy(uv_cond_t* cond); +static void uv_cond_fallback_signal(uv_cond_t* cond); +static void uv_cond_fallback_broadcast(uv_cond_t* cond); +static void uv_cond_fallback_wait(uv_cond_t* cond, uv_mutex_t* mutex); +static int uv_cond_fallback_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout); -inline static int uv_cond_condvar_init(uv_cond_t* cond); -inline static void uv_cond_condvar_destroy(uv_cond_t* cond); -inline static void uv_cond_condvar_signal(uv_cond_t* cond); -inline static void uv_cond_condvar_broadcast(uv_cond_t* cond); -inline static void uv_cond_condvar_wait(uv_cond_t* cond, uv_mutex_t* mutex); -inline static int uv_cond_condvar_timedwait(uv_cond_t* cond, +static int uv_cond_condvar_init(uv_cond_t* cond); +static void uv_cond_condvar_destroy(uv_cond_t* cond); +static void uv_cond_condvar_signal(uv_cond_t* cond); +static void uv_cond_condvar_broadcast(uv_cond_t* cond); +static void uv_cond_condvar_wait(uv_cond_t* cond, uv_mutex_t* mutex); +static int uv_cond_condvar_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout); -static NOINLINE void uv__once_inner(uv_once_t* guard, - void (*callback)(void)) { +static void uv__once_inner(uv_once_t* guard, void (*callback)(void)) { DWORD result; HANDLE existing_event, created_event; @@ -185,7 +175,18 @@ ResumeThread(thread); } - return err; + switch (err) { + case 0: + return 0; + case EACCES: + return UV_EACCES; + case EAGAIN: + return UV_EAGAIN; + case EINVAL: + return UV_EINVAL; + } + + return UV_EIO; } @@ -346,23 +347,23 @@ } -inline static int uv__rwlock_srwlock_init(uv_rwlock_t* rwlock) { +static int uv__rwlock_srwlock_init(uv_rwlock_t* rwlock) { pInitializeSRWLock(&rwlock->srwlock_); return 0; } -inline static void uv__rwlock_srwlock_destroy(uv_rwlock_t* rwlock) { +static void uv__rwlock_srwlock_destroy(uv_rwlock_t* rwlock) { (void) rwlock; } -inline static void uv__rwlock_srwlock_rdlock(uv_rwlock_t* rwlock) { +static void uv__rwlock_srwlock_rdlock(uv_rwlock_t* rwlock) { pAcquireSRWLockShared(&rwlock->srwlock_); } -inline static int uv__rwlock_srwlock_tryrdlock(uv_rwlock_t* rwlock) { +static int uv__rwlock_srwlock_tryrdlock(uv_rwlock_t* rwlock) { if (pTryAcquireSRWLockShared(&rwlock->srwlock_)) return 0; else @@ -370,17 +371,17 @@ } -inline static void uv__rwlock_srwlock_rdunlock(uv_rwlock_t* rwlock) { +static void uv__rwlock_srwlock_rdunlock(uv_rwlock_t* rwlock) { pReleaseSRWLockShared(&rwlock->srwlock_); } -inline static void uv__rwlock_srwlock_wrlock(uv_rwlock_t* rwlock) { +static void uv__rwlock_srwlock_wrlock(uv_rwlock_t* rwlock) { pAcquireSRWLockExclusive(&rwlock->srwlock_); } -inline static int uv__rwlock_srwlock_trywrlock(uv_rwlock_t* rwlock) { +static int uv__rwlock_srwlock_trywrlock(uv_rwlock_t* rwlock) { if (pTryAcquireSRWLockExclusive(&rwlock->srwlock_)) return 0; else @@ -388,12 +389,12 @@ } -inline static void uv__rwlock_srwlock_wrunlock(uv_rwlock_t* rwlock) { +static void uv__rwlock_srwlock_wrunlock(uv_rwlock_t* rwlock) { pReleaseSRWLockExclusive(&rwlock->srwlock_); } -inline static int uv__rwlock_fallback_init(uv_rwlock_t* rwlock) { +static int uv__rwlock_fallback_init(uv_rwlock_t* rwlock) { int err; err = uv_mutex_init(&rwlock->fallback_.read_mutex_); @@ -412,13 +413,13 @@ } -inline static void uv__rwlock_fallback_destroy(uv_rwlock_t* rwlock) { +static void uv__rwlock_fallback_destroy(uv_rwlock_t* rwlock) { uv_mutex_destroy(&rwlock->fallback_.read_mutex_); uv_mutex_destroy(&rwlock->fallback_.write_mutex_); } -inline static void uv__rwlock_fallback_rdlock(uv_rwlock_t* rwlock) { +static void uv__rwlock_fallback_rdlock(uv_rwlock_t* rwlock) { uv_mutex_lock(&rwlock->fallback_.read_mutex_); if (++rwlock->fallback_.num_readers_ == 1) @@ -428,7 +429,7 @@ } -inline static int uv__rwlock_fallback_tryrdlock(uv_rwlock_t* rwlock) { +static int uv__rwlock_fallback_tryrdlock(uv_rwlock_t* rwlock) { int err; err = uv_mutex_trylock(&rwlock->fallback_.read_mutex_); @@ -449,7 +450,7 @@ } -inline static void uv__rwlock_fallback_rdunlock(uv_rwlock_t* rwlock) { +static void uv__rwlock_fallback_rdunlock(uv_rwlock_t* rwlock) { uv_mutex_lock(&rwlock->fallback_.read_mutex_); if (--rwlock->fallback_.num_readers_ == 0) @@ -459,17 +460,17 @@ } -inline static void uv__rwlock_fallback_wrlock(uv_rwlock_t* rwlock) { +static void uv__rwlock_fallback_wrlock(uv_rwlock_t* rwlock) { uv_mutex_lock(&rwlock->fallback_.write_mutex_); } -inline static int uv__rwlock_fallback_trywrlock(uv_rwlock_t* rwlock) { +static int uv__rwlock_fallback_trywrlock(uv_rwlock_t* rwlock) { return uv_mutex_trylock(&rwlock->fallback_.write_mutex_); } -inline static void uv__rwlock_fallback_wrunlock(uv_rwlock_t* rwlock) { +static void uv__rwlock_fallback_wrunlock(uv_rwlock_t* rwlock) { uv_mutex_unlock(&rwlock->fallback_.write_mutex_); } @@ -482,7 +483,7 @@ * uv_cond_timedwait() to be HANDLEs, but we use CRITICAL_SECTIONs. */ -inline static int uv_cond_fallback_init(uv_cond_t* cond) { +static int uv_cond_fallback_init(uv_cond_t* cond) { int err; /* Initialize the count to 0. */ @@ -520,7 +521,7 @@ } -inline static int uv_cond_condvar_init(uv_cond_t* cond) { +static int uv_cond_condvar_init(uv_cond_t* cond) { pInitializeConditionVariable(&cond->cond_var); return 0; } @@ -536,7 +537,7 @@ } -inline static void uv_cond_fallback_destroy(uv_cond_t* cond) { +static void uv_cond_fallback_destroy(uv_cond_t* cond) { if (!CloseHandle(cond->fallback.broadcast_event)) abort(); if (!CloseHandle(cond->fallback.signal_event)) @@ -545,7 +546,7 @@ } -inline static void uv_cond_condvar_destroy(uv_cond_t* cond) { +static void uv_cond_condvar_destroy(uv_cond_t* cond) { /* nothing to do */ } @@ -558,7 +559,7 @@ } -inline static void uv_cond_fallback_signal(uv_cond_t* cond) { +static void uv_cond_fallback_signal(uv_cond_t* cond) { int have_waiters; /* Avoid race conditions. */ @@ -571,7 +572,7 @@ } -inline static void uv_cond_condvar_signal(uv_cond_t* cond) { +static void uv_cond_condvar_signal(uv_cond_t* cond) { pWakeConditionVariable(&cond->cond_var); } @@ -584,7 +585,7 @@ } -inline static void uv_cond_fallback_broadcast(uv_cond_t* cond) { +static void uv_cond_fallback_broadcast(uv_cond_t* cond) { int have_waiters; /* Avoid race conditions. */ @@ -597,7 +598,7 @@ } -inline static void uv_cond_condvar_broadcast(uv_cond_t* cond) { +static void uv_cond_condvar_broadcast(uv_cond_t* cond) { pWakeAllConditionVariable(&cond->cond_var); } @@ -610,7 +611,7 @@ } -inline int uv_cond_wait_helper(uv_cond_t* cond, uv_mutex_t* mutex, +static int uv_cond_wait_helper(uv_cond_t* cond, uv_mutex_t* mutex, DWORD dwMilliseconds) { DWORD result; int last_waiter; @@ -660,13 +661,13 @@ } -inline static void uv_cond_fallback_wait(uv_cond_t* cond, uv_mutex_t* mutex) { +static void uv_cond_fallback_wait(uv_cond_t* cond, uv_mutex_t* mutex) { if (uv_cond_wait_helper(cond, mutex, INFINITE)) abort(); } -inline static void uv_cond_condvar_wait(uv_cond_t* cond, uv_mutex_t* mutex) { +static void uv_cond_condvar_wait(uv_cond_t* cond, uv_mutex_t* mutex) { if (!pSleepConditionVariableCS(&cond->cond_var, mutex, INFINITE)) abort(); } @@ -680,13 +681,13 @@ } -inline static int uv_cond_fallback_timedwait(uv_cond_t* cond, +static int uv_cond_fallback_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) { return uv_cond_wait_helper(cond, mutex, (DWORD)(timeout / 1e6)); } -inline static int uv_cond_condvar_timedwait(uv_cond_t* cond, +static int uv_cond_condvar_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) { if (pSleepConditionVariableCS(&cond->cond_var, mutex, (DWORD)(timeout / 1e6))) return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/test/test-fs.c new/libuv-1.4.2/test/test-fs.c --- old/libuv-1.4.0/test/test-fs.c 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/test/test-fs.c 2015-02-26 11:20:00.000000000 +0100 @@ -436,7 +436,11 @@ while (UV_EOF != uv_fs_scandir_next(req, &dent)) { ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0); - ASSERT(dent.type == UV_DIRENT_FILE || dent.type == UV_DIRENT_UNKNOWN); +#ifdef HAVE_DIRENT_TYPES + ASSERT(dent.type == UV_DIRENT_FILE); +#else + ASSERT(dent.type == UV_DIRENT_UNKNOWN); +#endif } scandir_cb_count++; ASSERT(req->path); @@ -875,7 +879,11 @@ ASSERT(scandir_req.ptr); while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) { ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0); - ASSERT(dent.type == UV_DIRENT_FILE || dent.type == UV_DIRENT_UNKNOWN); +#ifdef HAVE_DIRENT_TYPES + ASSERT(dent.type == UV_DIRENT_FILE); +#else + ASSERT(dent.type == UV_DIRENT_UNKNOWN); +#endif } uv_fs_req_cleanup(&scandir_req); ASSERT(!scandir_req.ptr); @@ -1695,7 +1703,11 @@ ASSERT(scandir_req.ptr); while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) { ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0); - ASSERT(dent.type == UV_DIRENT_FILE || dent.type == UV_DIRENT_UNKNOWN); +#ifdef HAVE_DIRENT_TYPES + ASSERT(dent.type == UV_DIRENT_FILE); +#else + ASSERT(dent.type == UV_DIRENT_UNKNOWN); +#endif } uv_fs_req_cleanup(&scandir_req); ASSERT(!scandir_req.ptr); @@ -1715,7 +1727,11 @@ ASSERT(scandir_req.ptr); while (UV_EOF != uv_fs_scandir_next(&scandir_req, &dent)) { ASSERT(strcmp(dent.name, "file1") == 0 || strcmp(dent.name, "file2") == 0); - ASSERT(dent.type == UV_DIRENT_FILE || dent.type == UV_DIRENT_UNKNOWN); +#ifdef HAVE_DIRENT_TYPES + ASSERT(dent.type == UV_DIRENT_FILE); +#else + ASSERT(dent.type == UV_DIRENT_UNKNOWN); +#endif } uv_fs_req_cleanup(&scandir_req); ASSERT(!scandir_req.ptr); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/test/test-list.h new/libuv-1.4.2/test/test-list.h --- old/libuv-1.4.0/test/test-list.h 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/test/test-list.h 2015-02-26 11:20:00.000000000 +0100 @@ -80,6 +80,7 @@ TEST_DECLARE (tcp_close) #ifndef _WIN32 TEST_DECLARE (tcp_close_accept) +TEST_DECLARE (tcp_oob) #endif TEST_DECLARE (tcp_flags) TEST_DECLARE (tcp_write_to_half_open_connection) @@ -396,6 +397,7 @@ TEST_ENTRY (tcp_close) #ifndef _WIN32 TEST_ENTRY (tcp_close_accept) + TEST_ENTRY (tcp_oob) #endif TEST_ENTRY (tcp_flags) TEST_ENTRY (tcp_write_to_half_open_connection) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/test/test-tcp-oob.c new/libuv-1.4.2/test/test-tcp-oob.c --- old/libuv-1.4.0/test/test-tcp-oob.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libuv-1.4.2/test/test-tcp-oob.c 2015-02-26 11:20:00.000000000 +0100 @@ -0,0 +1,128 @@ +/* Copyright Fedor Indutny. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#if !defined(_WIN32) + +#include "uv.h" +#include "task.h" + +#include <errno.h> +#include <sys/socket.h> +#include <unistd.h> + +static uv_tcp_t server_handle; +static uv_tcp_t client_handle; +static uv_tcp_t peer_handle; +static uv_idle_t idle; +static uv_connect_t connect_req; +static int ticks; +static const int kMaxTicks = 10; + +static void alloc_cb(uv_handle_t* handle, + size_t suggested_size, + uv_buf_t* buf) { + static char storage[1024]; + *buf = uv_buf_init(storage, sizeof(storage)); +} + + +static void idle_cb(uv_idle_t* idle) { + if (++ticks < kMaxTicks) + return; + + uv_close((uv_handle_t*) &server_handle, NULL); + uv_close((uv_handle_t*) &client_handle, NULL); + uv_close((uv_handle_t*) &peer_handle, NULL); + uv_close((uv_handle_t*) idle, NULL); +} + + +static void read_cb(uv_stream_t* handle, ssize_t nread, const uv_buf_t* buf) { + ASSERT(nread > 0); + ASSERT(0 == uv_idle_start(&idle, idle_cb)); +} + + +static void connect_cb(uv_connect_t* req, int status) { + ASSERT(req->handle == (uv_stream_t*) &client_handle); + ASSERT(0 == status); +} + + +static void connection_cb(uv_stream_t* handle, int status) { + int r; + uv_os_fd_t fd; + + ASSERT(0 == status); + ASSERT(0 == uv_accept(handle, (uv_stream_t*) &peer_handle)); + ASSERT(0 == uv_read_start((uv_stream_t*) &peer_handle, alloc_cb, read_cb)); + + /* Send some OOB data */ + ASSERT(0 == uv_fileno((uv_handle_t*) &client_handle, &fd)); + + ASSERT(0 == uv_stream_set_blocking((uv_stream_t*) &client_handle, 1)); + + /* The problem triggers only on a second message, it seem that xnu is not + * triggering `kevent()` for the first one + */ + do { + r = send(fd, "hello", 5, MSG_OOB); + } while (r < 0 && errno == EINTR); + ASSERT(5 == r); + + do { + r = send(fd, "hello", 5, MSG_OOB); + } while (r < 0 && errno == EINTR); + ASSERT(5 == r); + + ASSERT(0 == uv_stream_set_blocking((uv_stream_t*) &client_handle, 0)); +} + + +TEST_IMPL(tcp_oob) { + struct sockaddr_in addr; + uv_loop_t* loop; + + ASSERT(0 == uv_ip4_addr("127.0.0.1", TEST_PORT, &addr)); + loop = uv_default_loop(); + + ASSERT(0 == uv_tcp_init(loop, &server_handle)); + ASSERT(0 == uv_tcp_init(loop, &client_handle)); + ASSERT(0 == uv_tcp_init(loop, &peer_handle)); + ASSERT(0 == uv_idle_init(loop, &idle)); + ASSERT(0 == uv_tcp_bind(&server_handle, (const struct sockaddr*) &addr, 0)); + ASSERT(0 == uv_listen((uv_stream_t*) &server_handle, 1, connection_cb)); + + /* Ensure two separate packets */ + ASSERT(0 == uv_tcp_nodelay(&client_handle, 1)); + + ASSERT(0 == uv_tcp_connect(&connect_req, + &client_handle, + (const struct sockaddr*) &addr, + connect_cb)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + + ASSERT(ticks == kMaxTicks); + + MAKE_VALGRIND_HAPPY(); + return 0; +} +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libuv-1.4.0/uv.gyp new/libuv-1.4.2/uv.gyp --- old/libuv-1.4.0/uv.gyp 2015-02-09 21:06:37.000000000 +0100 +++ new/libuv-1.4.2/uv.gyp 2015-02-26 11:20:00.000000000 +0100 @@ -366,6 +366,7 @@ 'test/test-tcp-writealot.c', 'test/test-tcp-try-write.c', 'test/test-tcp-unexpected-read.c', + 'test/test-tcp-oob.c', 'test/test-tcp-read-stop.c', 'test/test-tcp-write-queue-order.c', 'test/test-threadpool.c', -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
