Skip to content

Commit

Permalink
deps: update libuv to 1.4.1
Browse files Browse the repository at this point in the history
PR-URL: #940
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
  • Loading branch information
bnoordhuis authored and rvagg committed Feb 25, 2015
1 parent 06ee782 commit 739fda1
Show file tree
Hide file tree
Showing 22 changed files with 313 additions and 140 deletions.
3 changes: 3 additions & 0 deletions deps/uv/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ ipch

*.xcodeproj
*.xcworkspace

# make dist output
libuv-*.tar.*
1 change: 1 addition & 0 deletions deps/uv/.mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Isaac Z. Schlueter <i@izs.me>
Justin Venus <justin.venus@gmail.com> <justin.venus@orbitz.com>
Keno Fischer <kenof@stanford.edu> <kfischer+github@college.harvard.edu>
Keno Fischer <kenof@stanford.edu> <kfischer@college.harvard.edu>
Leith Bade <leith@leithalweapon.geek.nz> <leith@mapbox.com>
Leonard Hecker <leonard.hecker91@gmail.com> <leonard@hecker.io>
Maciej Małecki <maciej.malecki@notimplemented.org> <me@mmalecki.com>
Marc Schlaich <marc.schlaich@googlemail.com> <marc.schlaich@gmail.com>
Expand Down
1 change: 1 addition & 0 deletions deps/uv/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,4 @@ Alexey Melnichuk <mimir@newmail.ru>
Johan Bergström <bugs@bergstroem.nu>
Alex Mo <almosnow@gmail.com>
Luis Martinez de Bartolome <lasote@gmail.com>
Michael Penick <michael.penick@datastax.com>
20 changes: 20 additions & 0 deletions deps/uv/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
2015.02.25, Version 1.4.1 (Stable)

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:
Expand Down
1 change: 1 addition & 0 deletions deps/uv/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
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 \
Expand Down
1 change: 1 addition & 0 deletions deps/uv/checksparse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ test/test-tcp-open.c
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
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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.1], [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])
Expand Down
3 changes: 3 additions & 0 deletions deps/uv/docs/src/threading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ Threads
^^^^^^^

.. 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)
Expand Down
16 changes: 16 additions & 0 deletions deps/uv/include/uv-errno.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_ */
2 changes: 1 addition & 1 deletion deps/uv/include/uv-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#define UV_VERSION_MAJOR 1
#define UV_VERSION_MINOR 4
#define UV_VERSION_PATCH 0
#define UV_VERSION_PATCH 1
#define UV_VERSION_IS_RELEASE 1
#define UV_VERSION_SUFFIX ""

Expand Down
1 change: 1 addition & 0 deletions deps/uv/include/uv-win.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ typedef struct uv__dirent_s {
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
Expand Down
1 change: 1 addition & 0 deletions deps/uv/include/uv.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ extern "C" {
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) \
Expand Down
42 changes: 7 additions & 35 deletions deps/uv/src/unix/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "uv.h"
#include "internal.h"
#include "atomic-ops.h"

#include <errno.h>
#include <stdio.h> /* snprintf() */
Expand All @@ -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);


Expand All @@ -58,7 +58,11 @@ int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) {


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;
Expand All @@ -80,9 +84,8 @@ static void uv__async_event(uv_loop_t* loop,
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;
Expand All @@ -91,37 +94,6 @@ static void uv__async_event(uv_loop_t* loop,
}


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];
Expand Down
12 changes: 12 additions & 0 deletions deps/uv/src/unix/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,10 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) {


int uv__stream_open(uv_stream_t* stream, int fd, int flags) {
#if defined(__APPLE__)
int enable;
#endif

assert(fd >= 0);
stream->flags |= flags;

Expand All @@ -387,6 +391,14 @@ int uv__stream_open(uv_stream_t* stream, int fd, int flags) {
return -errno;
}

#if defined(__APPLE__)
enable = 1;
if (setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &enable, sizeof(enable)) &&
errno != ENOTSOCK) {
return -errno;
}
#endif

stream->io_watcher.fd = fd;

return 0;
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/src/unix/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
if (err)
free(ctx);

return err ? -1 : 0;
return -err;
}


Expand Down
20 changes: 19 additions & 1 deletion deps/uv/src/unix/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,24 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) {
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;
Expand Down Expand Up @@ -138,7 +156,7 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) {
tmp.c_cc[VTIME] = 0;
break;
case UV_TTY_MODE_IO:
cfmakeraw(&tmp);
uv__tty_make_raw(&tmp);
break;
}

Expand Down
25 changes: 0 additions & 25 deletions deps/uv/src/unix/uv-dtrace.d

This file was deleted.

Loading

0 comments on commit 739fda1

Please sign in to comment.