Skip to content

Commit 739fda1

Browse files
bnoordhuisrvagg
authored andcommitted
deps: update libuv to 1.4.1
PR-URL: #940 Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Rod Vagg <[email protected]>
1 parent 06ee782 commit 739fda1

22 files changed

+313
-140
lines changed

deps/uv/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,6 @@ ipch
6767

6868
*.xcodeproj
6969
*.xcworkspace
70+
71+
# make dist output
72+
libuv-*.tar.*

deps/uv/.mailmap

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Isaac Z. Schlueter <[email protected]>
1414
1515
1616
17+
1718
1819
1920

deps/uv/AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -180,3 +180,4 @@ Alexey Melnichuk <[email protected]>
180180
Johan Bergström <[email protected]>
181181
182182
Luis Martinez de Bartolome <[email protected]>
183+
Michael Penick <[email protected]>

deps/uv/ChangeLog

+20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
2015.02.25, Version 1.4.1 (Stable)
2+
3+
Changes since version 1.4.0:
4+
5+
* win: don't use inline keyword in thread.c (Ben Noordhuis)
6+
7+
* windows: fix setting dirent types on uv_fs_scandir_next (Saúl Ibarra
8+
Corretgé)
9+
10+
* unix,windows: make uv_thread_create() return errno (Ben Noordhuis)
11+
12+
* tty: fix build for SmartOS (Julien Gilli)
13+
14+
* unix: fix for uv_async data race (Michael Penick)
15+
16+
* unix, windows: map EHOSTDOWN errno (Ben Noordhuis)
17+
18+
* stream: use SO_OOBINLINE on OS X (Fedor Indutny)
19+
20+
121
2015.02.10, Version 1.4.0 (Stable), 19fb8a90648f3763240db004b77ab984264409be
222

323
Changes since version 1.3.0:

deps/uv/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
222222
test/test-tcp-read-stop.c \
223223
test/test-tcp-shutdown-after-write.c \
224224
test/test-tcp-unexpected-read.c \
225+
test/test-tcp-oob.c \
225226
test/test-tcp-write-to-half-open-connection.c \
226227
test/test-tcp-write-after-connect.c \
227228
test/test-tcp-writealot.c \

deps/uv/checksparse.sh

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ test/test-tcp-open.c
145145
test/test-tcp-read-stop.c
146146
test/test-tcp-shutdown-after-write.c
147147
test/test-tcp-unexpected-read.c
148+
test/test-tcp-oob.c
148149
test/test-tcp-write-error.c
149150
test/test-tcp-write-to-half-open-connection.c
150151
test/test-tcp-writealot.c

deps/uv/configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1414

1515
AC_PREREQ(2.57)
16-
AC_INIT([libuv], [1.4.0], [https://github.com/libuv/libuv/issues])
16+
AC_INIT([libuv], [1.4.1], [https://github.com/libuv/libuv/issues])
1717
AC_CONFIG_MACRO_DIR([m4])
1818
m4_include([m4/libuv-extra-automake-flags.m4])
1919
m4_include([m4/as_case.m4])

deps/uv/docs/src/threading.rst

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ Threads
5656
^^^^^^^
5757

5858
.. c:function:: int uv_thread_create(uv_thread_t* tid, uv_thread_cb entry, void* arg)
59+
60+
.. versionchanged:: 1.4.1 returns a UV_E* error code on failure
61+
5962
.. c:function:: uv_thread_t uv_thread_self(void)
6063
.. c:function:: int uv_thread_join(uv_thread_t *tid)
6164
.. c:function:: int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2)

deps/uv/include/uv-errno.h

+16
Original file line numberDiff line numberDiff line change
@@ -399,4 +399,20 @@
399399
# define UV__EMLINK (-4032)
400400
#endif
401401

402+
/* EHOSTDOWN is not visible on BSD-like systems when _POSIX_C_SOURCE is
403+
* defined. Fortunately, its value is always 64 so it's possible albeit
404+
* icky to hard-code it.
405+
*/
406+
#if defined(EHOSTDOWN) && !defined(_WIN32)
407+
# define UV__EHOSTDOWN (-EHOSTDOWN)
408+
#elif defined(__APPLE__) || \
409+
defined(__DragonFly__) || \
410+
defined(__FreeBSD__) || \
411+
defined(__NetBSD__) || \
412+
defined(__OpenBSD__)
413+
# define UV__EHOSTDOWN (-64)
414+
#else
415+
# define UV__EHOSTDOWN (-4031)
416+
#endif
417+
402418
#endif /* UV_ERRNO_H_ */

deps/uv/include/uv-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
#define UV_VERSION_MAJOR 1
3434
#define UV_VERSION_MINOR 4
35-
#define UV_VERSION_PATCH 0
35+
#define UV_VERSION_PATCH 1
3636
#define UV_VERSION_IS_RELEASE 1
3737
#define UV_VERSION_SUFFIX ""
3838

deps/uv/include/uv-win.h

+1
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ typedef struct uv__dirent_s {
294294
char d_name[1];
295295
} uv__dirent_t;
296296

297+
#define HAVE_DIRENT_TYPES
297298
#define UV__DT_DIR UV_DIRENT_DIR
298299
#define UV__DT_FILE UV_DIRENT_FILE
299300
#define UV__DT_LINK UV_DIRENT_LINK

deps/uv/include/uv.h

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ extern "C" {
138138
XX(EOF, "end of file") \
139139
XX(ENXIO, "no such device or address") \
140140
XX(EMLINK, "too many links") \
141+
XX(EHOSTDOWN, "host is down") \
141142

142143
#define UV_HANDLE_TYPE_MAP(XX) \
143144
XX(ASYNC, async) \

deps/uv/src/unix/async.c

+7-35
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include "uv.h"
2626
#include "internal.h"
27+
#include "atomic-ops.h"
2728

2829
#include <errno.h>
2930
#include <stdio.h> /* snprintf() */
@@ -35,7 +36,6 @@
3536
static void uv__async_event(uv_loop_t* loop,
3637
struct uv__async* w,
3738
unsigned int nevents);
38-
static int uv__async_make_pending(int* pending);
3939
static int uv__async_eventfd(void);
4040

4141

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

5959

6060
int uv_async_send(uv_async_t* handle) {
61-
if (uv__async_make_pending(&handle->pending) == 0)
61+
/* Do a cheap read first. */
62+
if (ACCESS_ONCE(int, handle->pending) != 0)
63+
return 0;
64+
65+
if (cmpxchgi(&handle->pending, 0, 1) == 0)
6266
uv__async_send(&handle->loop->async_watcher);
6367

6468
return 0;
@@ -80,9 +84,8 @@ static void uv__async_event(uv_loop_t* loop,
8084
QUEUE_FOREACH(q, &loop->async_handles) {
8185
h = QUEUE_DATA(q, uv_async_t, queue);
8286

83-
if (h->pending == 0)
87+
if (cmpxchgi(&h->pending, 1, 0) == 0)
8488
continue;
85-
h->pending = 0;
8689

8790
if (h->async_cb == NULL)
8891
continue;
@@ -91,37 +94,6 @@ static void uv__async_event(uv_loop_t* loop,
9194
}
9295

9396

94-
static int uv__async_make_pending(int* pending) {
95-
/* Do a cheap read first. */
96-
if (ACCESS_ONCE(int, *pending) != 0)
97-
return 1;
98-
99-
/* Micro-optimization: use atomic memory operations to detect if we've been
100-
* preempted by another thread and don't have to make an expensive syscall.
101-
* This speeds up the heavily contended case by about 1-2% and has little
102-
* if any impact on the non-contended case.
103-
*
104-
* Use XCHG instead of the CMPXCHG that __sync_val_compare_and_swap() emits
105-
* on x86, it's about 4x faster. It probably makes zero difference in the
106-
* grand scheme of things but I'm OCD enough not to let this one pass.
107-
*/
108-
#if defined(__i386__) || defined(__x86_64__)
109-
{
110-
unsigned int val = 1;
111-
__asm__ __volatile__ ("xchgl %0, %1"
112-
: "+r" (val)
113-
: "m" (*pending));
114-
return val != 0;
115-
}
116-
#elif defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 0)
117-
return __sync_val_compare_and_swap(pending, 0, 1) != 0;
118-
#else
119-
ACCESS_ONCE(int, *pending) = 1;
120-
return 0;
121-
#endif
122-
}
123-
124-
12597
static void uv__async_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
12698
struct uv__async* wa;
12799
char buf[1024];

deps/uv/src/unix/stream.c

+12
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,10 @@ int uv__stream_try_select(uv_stream_t* stream, int* fd) {
375375

376376

377377
int uv__stream_open(uv_stream_t* stream, int fd, int flags) {
378+
#if defined(__APPLE__)
379+
int enable;
380+
#endif
381+
378382
assert(fd >= 0);
379383
stream->flags |= flags;
380384

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

394+
#if defined(__APPLE__)
395+
enable = 1;
396+
if (setsockopt(fd, SOL_SOCKET, SO_OOBINLINE, &enable, sizeof(enable)) &&
397+
errno != ENOTSOCK) {
398+
return -errno;
399+
}
400+
#endif
401+
390402
stream->io_watcher.fd = fd;
391403

392404
return 0;

deps/uv/src/unix/thread.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
6868
if (err)
6969
free(ctx);
7070

71-
return err ? -1 : 0;
71+
return -err;
7272
}
7373

7474

deps/uv/src/unix/tty.c

+19-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,24 @@ int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) {
103103
return 0;
104104
}
105105

106+
static void uv__tty_make_raw(struct termios* tio) {
107+
assert(tio != NULL);
108+
109+
#ifdef __sun
110+
/*
111+
* This implementation of cfmakeraw for Solaris and derivatives is taken from
112+
* http://www.perkin.org.uk/posts/solaris-portability-cfmakeraw.html.
113+
*/
114+
tio->c_iflag &= ~(IMAXBEL | IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR |
115+
IGNCR | ICRNL | IXON);
116+
tio->c_oflag &= ~OPOST;
117+
tio->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
118+
tio->c_cflag &= ~(CSIZE | PARENB);
119+
tio->c_cflag |= CS8;
120+
#else
121+
cfmakeraw(tio);
122+
#endif /* #ifdef __sun */
123+
}
106124

107125
int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) {
108126
struct termios tmp;
@@ -138,7 +156,7 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) {
138156
tmp.c_cc[VTIME] = 0;
139157
break;
140158
case UV_TTY_MODE_IO:
141-
cfmakeraw(&tmp);
159+
uv__tty_make_raw(&tmp);
142160
break;
143161
}
144162

deps/uv/src/unix/uv-dtrace.d

-25
This file was deleted.

0 commit comments

Comments
 (0)