Skip to content

Commit f09d84f

Browse files
saghulpiscisaureus
authored andcommitted
deps: update libuv to 1.2.1
PR: nodejs#423 Reviewed-by: Bert Belder <bertbelder@gmail.com>
1 parent e9443f4 commit f09d84f

23 files changed

+163
-38
lines changed

deps/uv/AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,4 @@ Logan Rosen <loganrosen@gmail.com>
177177
Kenneth Perry <thothonegan@gmail.com>
178178
John Marino <marino@FreeBSD.org>
179179
Alexey Melnichuk <mimir@newmail.ru>
180+
Johan Bergström <bugs@bergstroem.nu>

deps/uv/ChangeLog

+29-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
1-
2015.01.06, Version 1.2.0 (Stable)
1+
2015.01.15, Version 1.2.1 (Stable), 4ca78e989062a1099dc4b9ad182a98e8374134b1
2+
3+
Changes since version 1.2.0:
4+
5+
* unix: remove unused dtrace file (Saúl Ibarra Corretgé)
6+
7+
* test: skip TTY select test if /dev/tty can't be opened (Saúl Ibarra Corretgé)
8+
9+
* doc: clarify the behavior of uv_tty_init (Saúl Ibarra Corretgé)
10+
11+
* doc: clarify how uv_async_send behaves (Saúl Ibarra Corretgé)
12+
13+
* build: make dist now generates a full tarball (Johan Bergström)
14+
15+
* freebsd: make uv_exepath more resilient (Saúl Ibarra Corretgé)
16+
17+
* unix: make setting the tty mode to the same value a no-op (Saúl Ibarra
18+
Corretgé)
19+
20+
* win,tcp: support uv_try_write (Bert Belder)
21+
22+
* test: enable test-tcp-try-write on windows (Bert Belder)
23+
24+
* win,tty: support uv_try_write (Bert Belder)
25+
26+
* unix: set non-block mode in uv_{pipe,tcp,udp}_open (Ben Noordhuis)
27+
28+
29+
2015.01.06, Version 1.2.0 (Stable), 09f25b13cd149c7981108fc1a75611daf1277f83
230

331
Changes since version 1.1.0:
432

deps/uv/Makefile.am

+18-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,24 @@ libuv_la_SOURCES += src/unix/async.c \
108108
endif # WINNT
109109

110110
EXTRA_DIST = test/fixtures/empty_file \
111-
test/fixtures/load_error.node
111+
test/fixtures/load_error.node \
112+
include \
113+
test \
114+
docs \
115+
img \
116+
samples \
117+
android-configure \
118+
CONTRIBUTING.md \
119+
LICENSE \
120+
README.md \
121+
checksparse.sh \
122+
vcbuild.bat \
123+
Makefile.mingw \
124+
common.gypi \
125+
gyp_uv.py \
126+
uv.gyp
127+
128+
112129

113130
TESTS = test/run-tests
114131
check_PROGRAMS = test/run-tests

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.2.0], [https://github.com/libuv/libuv/issues])
16+
AC_INIT([libuv], [1.2.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/async.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ API
4848
4949
.. warning::
5050
libuv will coalesce calls to :c:func:`uv_async_send`, that is, not every call to it will
51-
yield an execution of the callback, the only guarantee is that it will be called at least
52-
once. Thus, calling this function may not wakeup the event loop if it was already called
53-
previously within a short period of time.
51+
yield an execution of the callback. For example: if :c:func:`uv_async_send` is called 5
52+
times in a row before the callback is called, the callback will only be called once. If
53+
:c:func:`uv_async_send` is called again after the callback was called, it will be called
54+
again.
5455
5556
.. seealso::
5657
The :c:type:`uv_handle_t` API functions also apply.

deps/uv/docs/src/pipe.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ API
3838
3939
Open an existing file descriptor or HANDLE as a pipe.
4040
41-
.. note::
42-
The user is responsible for setting the file descriptor in non-blocking mode.
41+
.. versionchanged:: 1.2.1 the file descriptor is set to non-blocking mode.
4342
4443
.. c:function:: int uv_pipe_bind(uv_pipe_t* handle, const char* name)
4544

deps/uv/docs/src/tcp.rst

+1-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ API
3636
3737
Open an existing file descriptor or SOCKET as a TCP handle.
3838
39-
.. note::
40-
The user is responsible for setting the file descriptor in
41-
non-blocking mode.
39+
.. versionchanged:: 1.2.1 the file descriptor is set to non-blocking mode.
4240
4341
.. c:function:: int uv_tcp_nodelay(uv_tcp_t* handle, int enable)
4442

deps/uv/docs/src/tty.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,13 @@ API
5858
`readable`, specifies if you plan on calling :c:func:`uv_read_start` with
5959
this stream. stdin is readable, stdout is not.
6060
61+
On Unix this function will try to open ``/dev/tty`` and use it if the passed file
62+
descriptor refers to a TTY. This lets libuv put the tty in non-blocking mode
63+
without affecting other processes that share the tty.
64+
6165
.. note::
62-
TTY streams which are not readable have blocking writes.
66+
If opening ``/dev/tty`` fails, libuv falls back to blocking writes for non-readable
67+
TTY streams.
6368
6469
.. c:function:: int uv_tty_set_mode(uv_tty_t*, uv_tty_mode_t mode)
6570

deps/uv/docs/src/udp.rst

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ API
120120
In other words, other datagram-type sockets like raw sockets or netlink
121121
sockets can also be passed to this function.
122122
123+
.. versionchanged:: 1.2.1 the file descriptor is set to non-blocking mode.
124+
123125
.. c:function:: int uv_udp_bind(uv_udp_t* handle, const struct sockaddr* addr, unsigned int flags)
124126
125127
Bind the UDP handle to an IP address and port.

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 2
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/src/unix/freebsd.c

+14-4
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ uint64_t uv__hrtime(uv_clocktype_t type) {
7575

7676

7777
int uv_exepath(char* buffer, size_t* size) {
78+
char abspath[PATH_MAX * 2 + 1];
7879
int mib[4];
79-
size_t cb;
80+
size_t abspath_size;
8081

8182
if (buffer == NULL || size == NULL || *size == 0)
8283
return -EINVAL;
@@ -93,10 +94,19 @@ int uv_exepath(char* buffer, size_t* size) {
9394
mib[3] = -1;
9495
#endif
9596

96-
cb = *size;
97-
if (sysctl(mib, 4, buffer, &cb, NULL, 0))
97+
abspath_size = sizeof abspath;;
98+
if (sysctl(mib, 4, abspath, &abspath_size, NULL, 0))
9899
return -errno;
99-
*size = strlen(buffer);
100+
101+
assert(abspath_size > 0);
102+
abspath_size -= 1;
103+
*size -= 1;
104+
105+
if (*size > abspath_size)
106+
*size = abspath_size;
107+
108+
memcpy(buffer, abspath, *size);
109+
buffer[*size] = '\0';
100110

101111
return 0;
102112
}

deps/uv/src/unix/pipe.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,13 @@ void uv__pipe_close(uv_pipe_t* handle) {
125125

126126

127127
int uv_pipe_open(uv_pipe_t* handle, uv_file fd) {
128-
#if defined(__APPLE__)
129128
int err;
130129

130+
err = uv__nonblock(fd, 1);
131+
if (err)
132+
return err;
133+
134+
#if defined(__APPLE__)
131135
err = uv__stream_try_select((uv_stream_t*) handle, &fd);
132136
if (err)
133137
return err;

deps/uv/src/unix/tcp.c

+6
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,12 @@ int uv__tcp_connect(uv_connect_t* req,
156156

157157

158158
int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock) {
159+
int err;
160+
161+
err = uv__nonblock(sock, 1);
162+
if (err)
163+
return err;
164+
159165
return uv__stream_open((uv_stream_t*)handle,
160166
sock,
161167
UV_STREAM_READABLE | UV_STREAM_WRITABLE);

deps/uv/src/unix/tty.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) {
108108
struct termios tmp;
109109
int fd;
110110

111-
fd = uv__stream_fd(tty);
111+
if (tty->mode == (int) mode)
112+
return 0;
112113

114+
fd = uv__stream_fd(tty);
113115
if (tty->mode == UV_TTY_MODE_NORMAL && mode != UV_TTY_MODE_NORMAL) {
114116
if (tcgetattr(fd, &tty->orig_termios))
115117
return -errno;

deps/uv/src/unix/udp.c

+4
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,10 @@ int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) {
565565
if (handle->io_watcher.fd != -1)
566566
return -EALREADY; /* FIXME(bnoordhuis) Should be -EBUSY. */
567567

568+
err = uv__nonblock(sock, 1);
569+
if (err)
570+
return err;
571+
568572
err = uv__set_reuse(sock);
569573
if (err)
570574
return err;

deps/uv/src/win/internal.h

+4
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ int uv_tcp_read_start(uv_tcp_t* handle, uv_alloc_cb alloc_cb,
136136
uv_read_cb read_cb);
137137
int uv_tcp_write(uv_loop_t* loop, uv_write_t* req, uv_tcp_t* handle,
138138
const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb);
139+
int uv__tcp_try_write(uv_tcp_t* handle, const uv_buf_t bufs[],
140+
unsigned int nbufs);
139141

140142
void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, uv_req_t* req);
141143
void uv_process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle,
@@ -211,6 +213,8 @@ int uv_tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb,
211213
int uv_tty_read_stop(uv_tty_t* handle);
212214
int uv_tty_write(uv_loop_t* loop, uv_write_t* req, uv_tty_t* handle,
213215
const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb);
216+
int uv__tty_try_write(uv_tty_t* handle, const uv_buf_t bufs[],
217+
unsigned int nbufs);
214218
void uv_tty_close(uv_tty_t* handle);
215219

216220
void uv_process_tty_read_req(uv_loop_t* loop, uv_tty_t* handle,

deps/uv/src/win/stream.c

+16-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,22 @@ int uv_write2(uv_write_t* req,
184184
int uv_try_write(uv_stream_t* stream,
185185
const uv_buf_t bufs[],
186186
unsigned int nbufs) {
187-
/* NOTE: Won't work with overlapped writes */
188-
return UV_ENOSYS;
187+
if (stream->flags & UV__HANDLE_CLOSING)
188+
return UV_EBADF;
189+
if (!(stream->flags & UV_HANDLE_WRITABLE))
190+
return UV_EPIPE;
191+
192+
switch (stream->type) {
193+
case UV_TCP:
194+
return uv__tcp_try_write((uv_tcp_t*) stream, bufs, nbufs);
195+
case UV_TTY:
196+
return uv__tty_try_write((uv_tty_t*) stream, bufs, nbufs);
197+
case UV_NAMED_PIPE:
198+
return UV_EAGAIN;
199+
default:
200+
assert(0);
201+
return UV_ENOSYS;
202+
}
189203
}
190204

191205

deps/uv/src/win/tcp.c

+24
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,30 @@ int uv_tcp_write(uv_loop_t* loop,
876876
}
877877

878878

879+
int uv__tcp_try_write(uv_tcp_t* handle,
880+
const uv_buf_t bufs[],
881+
unsigned int nbufs) {
882+
int result;
883+
DWORD bytes;
884+
885+
if (handle->write_reqs_pending > 0)
886+
return UV_EAGAIN;
887+
888+
result = WSASend(handle->socket,
889+
(WSABUF*) bufs,
890+
nbufs,
891+
&bytes,
892+
0,
893+
NULL,
894+
NULL);
895+
896+
if (result == SOCKET_ERROR)
897+
return uv_translate_sys_error(WSAGetLastError());
898+
else
899+
return bytes;
900+
}
901+
902+
879903
void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
880904
uv_req_t* req) {
881905
DWORD bytes, flags, err;

deps/uv/src/win/tty.c

+15
Original file line numberDiff line numberDiff line change
@@ -1878,6 +1878,21 @@ int uv_tty_write(uv_loop_t* loop,
18781878
}
18791879

18801880

1881+
int uv__tty_try_write(uv_tty_t* handle,
1882+
const uv_buf_t bufs[],
1883+
unsigned int nbufs) {
1884+
DWORD error;
1885+
1886+
if (handle->write_reqs_pending > 0)
1887+
return UV_EAGAIN;
1888+
1889+
if (uv_tty_write_bufs(handle, bufs, nbufs, &error))
1890+
return uv_translate_sys_error(error);
1891+
1892+
return uv__count_bufs(bufs, nbufs);
1893+
}
1894+
1895+
18811896
void uv_process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle,
18821897
uv_write_t* req) {
18831898
int err;

deps/uv/test/test-close-fd.c

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ TEST_IMPL(close_fd) {
5454
int fd[2];
5555

5656
ASSERT(0 == pipe(fd));
57-
ASSERT(0 == fcntl(fd[0], F_SETFL, O_NONBLOCK));
5857
ASSERT(0 == uv_pipe_init(uv_default_loop(), &pipe_handle, 0));
5958
ASSERT(0 == uv_pipe_open(&pipe_handle, fd[0]));
6059
fd[0] = -1; /* uv_pipe_open() takes ownership of the file descriptor. */

deps/uv/test/test-osx-select.c

+8-3
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ TEST_IMPL(osx_select) {
5454
uv_tty_t tty;
5555

5656
fd = open("/dev/tty", O_RDONLY);
57-
58-
ASSERT(fd >= 0);
57+
if (fd < 0) {
58+
LOGF("Cannot open /dev/tty as read-only: %s\n", strerror(errno));
59+
return TEST_SKIP;
60+
}
5961

6062
r = uv_tty_init(uv_default_loop(), &tty, fd, 1);
6163
ASSERT(r == 0);
@@ -104,7 +106,10 @@ TEST_IMPL(osx_select_many_fds) {
104106
}
105107

106108
fd = open("/dev/tty", O_RDONLY);
107-
ASSERT(fd >= 0);
109+
if (fd < 0) {
110+
LOGF("Cannot open /dev/tty as read-only: %s\n", strerror(errno));
111+
return TEST_SKIP;
112+
}
108113

109114
r = uv_tty_init(uv_default_loop(), &tty, fd, 1);
110115
ASSERT(r == 0);

deps/uv/test/test-spawn.c

-1
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,6 @@ TEST_IMPL(closed_fd_events) {
12431243

12441244
/* create a pipe and share it with a child process */
12451245
ASSERT(0 == pipe(fd));
1246-
ASSERT(0 == fcntl(fd[0], F_SETFL, O_NONBLOCK));
12471246

12481247
/* spawn_helper4 blocks indefinitely. */
12491248
init_process_options("spawn_helper4", exit_cb);

deps/uv/test/test-tcp-try-write.c

-12
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@
2828

2929
#define MAX_BYTES 1024 * 1024
3030

31-
#ifdef _WIN32
32-
33-
TEST_IMPL(tcp_try_write) {
34-
35-
MAKE_VALGRIND_HAPPY();
36-
return 0;
37-
}
38-
39-
#else /* !_WIN32 */
40-
4131
static uv_tcp_t server;
4232
static uv_tcp_t client;
4333
static uv_tcp_t incoming;
@@ -138,5 +128,3 @@ TEST_IMPL(tcp_try_write) {
138128
MAKE_VALGRIND_HAPPY();
139129
return 0;
140130
}
141-
142-
#endif /* !_WIN32 */

0 commit comments

Comments
 (0)