Skip to content

Commit

Permalink
deps: update libuv to 1.2.1
Browse files Browse the repository at this point in the history
PR: nodejs#423
Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-by: Bert Belder <bertbelder@gmail.com>
  • Loading branch information
saghul authored and piscisaureus committed Jan 14, 2015
1 parent e177377 commit 07bd05b
Show file tree
Hide file tree
Showing 23 changed files with 163 additions and 38 deletions.
1 change: 1 addition & 0 deletions deps/uv/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,4 @@ Logan Rosen <loganrosen@gmail.com>
Kenneth Perry <thothonegan@gmail.com>
John Marino <marino@FreeBSD.org>
Alexey Melnichuk <mimir@newmail.ru>
Johan Bergström <bugs@bergstroem.nu>
30 changes: 29 additions & 1 deletion deps/uv/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
2015.01.06, Version 1.2.0 (Stable)
2015.01.15, Version 1.2.1 (Stable), 4ca78e989062a1099dc4b9ad182a98e8374134b1

Changes since version 1.2.0:

* unix: remove unused dtrace file (Saúl Ibarra Corretgé)

* test: skip TTY select test if /dev/tty can't be opened (Saúl Ibarra Corretgé)

* doc: clarify the behavior of uv_tty_init (Saúl Ibarra Corretgé)

* doc: clarify how uv_async_send behaves (Saúl Ibarra Corretgé)

* build: make dist now generates a full tarball (Johan Bergström)

* freebsd: make uv_exepath more resilient (Saúl Ibarra Corretgé)

* unix: make setting the tty mode to the same value a no-op (Saúl Ibarra
Corretgé)

* win,tcp: support uv_try_write (Bert Belder)

* test: enable test-tcp-try-write on windows (Bert Belder)

* win,tty: support uv_try_write (Bert Belder)

* unix: set non-block mode in uv_{pipe,tcp,udp}_open (Ben Noordhuis)


2015.01.06, Version 1.2.0 (Stable), 09f25b13cd149c7981108fc1a75611daf1277f83

Changes since version 1.1.0:

Expand Down
19 changes: 18 additions & 1 deletion deps/uv/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,24 @@ libuv_la_SOURCES += src/unix/async.c \
endif # WINNT

EXTRA_DIST = test/fixtures/empty_file \
test/fixtures/load_error.node
test/fixtures/load_error.node \
include \
test \
docs \
img \
samples \
android-configure \
CONTRIBUTING.md \
LICENSE \
README.md \
checksparse.sh \
vcbuild.bat \
Makefile.mingw \
common.gypi \
gyp_uv.py \
uv.gyp



TESTS = test/run-tests
check_PROGRAMS = test/run-tests
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.2.0], [https://github.com/libuv/libuv/issues])
AC_INIT([libuv], [1.2.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
7 changes: 4 additions & 3 deletions deps/uv/docs/src/async.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ API
.. warning::
libuv will coalesce calls to :c:func:`uv_async_send`, that is, not every call to it will
yield an execution of the callback, the only guarantee is that it will be called at least
once. Thus, calling this function may not wakeup the event loop if it was already called
previously within a short period of time.
yield an execution of the callback. For example: if :c:func:`uv_async_send` is called 5
times in a row before the callback is called, the callback will only be called once. If
:c:func:`uv_async_send` is called again after the callback was called, it will be called
again.
.. seealso::
The :c:type:`uv_handle_t` API functions also apply.
3 changes: 1 addition & 2 deletions deps/uv/docs/src/pipe.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ API
Open an existing file descriptor or HANDLE as a pipe.
.. note::
The user is responsible for setting the file descriptor in non-blocking mode.
.. versionchanged:: 1.2.1 the file descriptor is set to non-blocking mode.
.. c:function:: int uv_pipe_bind(uv_pipe_t* handle, const char* name)
Expand Down
4 changes: 1 addition & 3 deletions deps/uv/docs/src/tcp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ API
Open an existing file descriptor or SOCKET as a TCP handle.
.. note::
The user is responsible for setting the file descriptor in
non-blocking mode.
.. versionchanged:: 1.2.1 the file descriptor is set to non-blocking mode.
.. c:function:: int uv_tcp_nodelay(uv_tcp_t* handle, int enable)
Expand Down
7 changes: 6 additions & 1 deletion deps/uv/docs/src/tty.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ API
`readable`, specifies if you plan on calling :c:func:`uv_read_start` with
this stream. stdin is readable, stdout is not.
On Unix this function will try to open ``/dev/tty`` and use it if the passed file
descriptor refers to a TTY. This lets libuv put the tty in non-blocking mode
without affecting other processes that share the tty.
.. note::
TTY streams which are not readable have blocking writes.
If opening ``/dev/tty`` fails, libuv falls back to blocking writes for non-readable
TTY streams.
.. c:function:: int uv_tty_set_mode(uv_tty_t*, uv_tty_mode_t mode)
Expand Down
2 changes: 2 additions & 0 deletions deps/uv/docs/src/udp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ API
In other words, other datagram-type sockets like raw sockets or netlink
sockets can also be passed to this function.
.. versionchanged:: 1.2.1 the file descriptor is set to non-blocking mode.
.. c:function:: int uv_udp_bind(uv_udp_t* handle, const struct sockaddr* addr, unsigned int flags)
Bind the UDP handle to an IP address and port.
Expand Down
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 2
#define UV_VERSION_PATCH 0
#define UV_VERSION_PATCH 1
#define UV_VERSION_IS_RELEASE 1
#define UV_VERSION_SUFFIX ""

Expand Down
18 changes: 14 additions & 4 deletions deps/uv/src/unix/freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ uint64_t uv__hrtime(uv_clocktype_t type) {


int uv_exepath(char* buffer, size_t* size) {
char abspath[PATH_MAX * 2 + 1];
int mib[4];
size_t cb;
size_t abspath_size;

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

cb = *size;
if (sysctl(mib, 4, buffer, &cb, NULL, 0))
abspath_size = sizeof abspath;;
if (sysctl(mib, 4, abspath, &abspath_size, NULL, 0))
return -errno;
*size = strlen(buffer);

assert(abspath_size > 0);
abspath_size -= 1;
*size -= 1;

if (*size > abspath_size)
*size = abspath_size;

memcpy(buffer, abspath, *size);
buffer[*size] = '\0';

return 0;
}
Expand Down
6 changes: 5 additions & 1 deletion deps/uv/src/unix/pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,13 @@ void uv__pipe_close(uv_pipe_t* handle) {


int uv_pipe_open(uv_pipe_t* handle, uv_file fd) {
#if defined(__APPLE__)
int err;

err = uv__nonblock(fd, 1);
if (err)
return err;

#if defined(__APPLE__)
err = uv__stream_try_select((uv_stream_t*) handle, &fd);
if (err)
return err;
Expand Down
6 changes: 6 additions & 0 deletions deps/uv/src/unix/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ int uv__tcp_connect(uv_connect_t* req,


int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock) {
int err;

err = uv__nonblock(sock, 1);
if (err)
return err;

return uv__stream_open((uv_stream_t*)handle,
sock,
UV_STREAM_READABLE | UV_STREAM_WRITABLE);
Expand Down
4 changes: 3 additions & 1 deletion deps/uv/src/unix/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) {
struct termios tmp;
int fd;

fd = uv__stream_fd(tty);
if (tty->mode == (int) mode)
return 0;

fd = uv__stream_fd(tty);
if (tty->mode == UV_TTY_MODE_NORMAL && mode != UV_TTY_MODE_NORMAL) {
if (tcgetattr(fd, &tty->orig_termios))
return -errno;
Expand Down
4 changes: 4 additions & 0 deletions deps/uv/src/unix/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,10 @@ int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) {
if (handle->io_watcher.fd != -1)
return -EALREADY; /* FIXME(bnoordhuis) Should be -EBUSY. */

err = uv__nonblock(sock, 1);
if (err)
return err;

err = uv__set_reuse(sock);
if (err)
return err;
Expand Down
4 changes: 4 additions & 0 deletions deps/uv/src/win/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ int uv_tcp_read_start(uv_tcp_t* handle, uv_alloc_cb alloc_cb,
uv_read_cb read_cb);
int uv_tcp_write(uv_loop_t* loop, uv_write_t* req, uv_tcp_t* handle,
const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb);
int uv__tcp_try_write(uv_tcp_t* handle, const uv_buf_t bufs[],
unsigned int nbufs);

void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle, uv_req_t* req);
void uv_process_tcp_write_req(uv_loop_t* loop, uv_tcp_t* handle,
Expand Down Expand Up @@ -211,6 +213,8 @@ int uv_tty_read_start(uv_tty_t* handle, uv_alloc_cb alloc_cb,
int uv_tty_read_stop(uv_tty_t* handle);
int uv_tty_write(uv_loop_t* loop, uv_write_t* req, uv_tty_t* handle,
const uv_buf_t bufs[], unsigned int nbufs, uv_write_cb cb);
int uv__tty_try_write(uv_tty_t* handle, const uv_buf_t bufs[],
unsigned int nbufs);
void uv_tty_close(uv_tty_t* handle);

void uv_process_tty_read_req(uv_loop_t* loop, uv_tty_t* handle,
Expand Down
18 changes: 16 additions & 2 deletions deps/uv/src/win/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,22 @@ int uv_write2(uv_write_t* req,
int uv_try_write(uv_stream_t* stream,
const uv_buf_t bufs[],
unsigned int nbufs) {
/* NOTE: Won't work with overlapped writes */
return UV_ENOSYS;
if (stream->flags & UV__HANDLE_CLOSING)
return UV_EBADF;
if (!(stream->flags & UV_HANDLE_WRITABLE))
return UV_EPIPE;

switch (stream->type) {
case UV_TCP:
return uv__tcp_try_write((uv_tcp_t*) stream, bufs, nbufs);
case UV_TTY:
return uv__tty_try_write((uv_tty_t*) stream, bufs, nbufs);
case UV_NAMED_PIPE:
return UV_EAGAIN;
default:
assert(0);
return UV_ENOSYS;
}
}


Expand Down
24 changes: 24 additions & 0 deletions deps/uv/src/win/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,30 @@ int uv_tcp_write(uv_loop_t* loop,
}


int uv__tcp_try_write(uv_tcp_t* handle,
const uv_buf_t bufs[],
unsigned int nbufs) {
int result;
DWORD bytes;

if (handle->write_reqs_pending > 0)
return UV_EAGAIN;

result = WSASend(handle->socket,
(WSABUF*) bufs,
nbufs,
&bytes,
0,
NULL,
NULL);

if (result == SOCKET_ERROR)
return uv_translate_sys_error(WSAGetLastError());
else
return bytes;
}


void uv_process_tcp_read_req(uv_loop_t* loop, uv_tcp_t* handle,
uv_req_t* req) {
DWORD bytes, flags, err;
Expand Down
15 changes: 15 additions & 0 deletions deps/uv/src/win/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -1878,6 +1878,21 @@ int uv_tty_write(uv_loop_t* loop,
}


int uv__tty_try_write(uv_tty_t* handle,
const uv_buf_t bufs[],
unsigned int nbufs) {
DWORD error;

if (handle->write_reqs_pending > 0)
return UV_EAGAIN;

if (uv_tty_write_bufs(handle, bufs, nbufs, &error))
return uv_translate_sys_error(error);

return uv__count_bufs(bufs, nbufs);
}


void uv_process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle,
uv_write_t* req) {
int err;
Expand Down
1 change: 0 additions & 1 deletion deps/uv/test/test-close-fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ TEST_IMPL(close_fd) {
int fd[2];

ASSERT(0 == pipe(fd));
ASSERT(0 == fcntl(fd[0], F_SETFL, O_NONBLOCK));
ASSERT(0 == uv_pipe_init(uv_default_loop(), &pipe_handle, 0));
ASSERT(0 == uv_pipe_open(&pipe_handle, fd[0]));
fd[0] = -1; /* uv_pipe_open() takes ownership of the file descriptor. */
Expand Down
11 changes: 8 additions & 3 deletions deps/uv/test/test-osx-select.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ TEST_IMPL(osx_select) {
uv_tty_t tty;

fd = open("/dev/tty", O_RDONLY);

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

r = uv_tty_init(uv_default_loop(), &tty, fd, 1);
ASSERT(r == 0);
Expand Down Expand Up @@ -104,7 +106,10 @@ TEST_IMPL(osx_select_many_fds) {
}

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

r = uv_tty_init(uv_default_loop(), &tty, fd, 1);
ASSERT(r == 0);
Expand Down
1 change: 0 additions & 1 deletion deps/uv/test/test-spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,6 @@ TEST_IMPL(closed_fd_events) {

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

/* spawn_helper4 blocks indefinitely. */
init_process_options("spawn_helper4", exit_cb);
Expand Down
12 changes: 0 additions & 12 deletions deps/uv/test/test-tcp-try-write.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@

#define MAX_BYTES 1024 * 1024

#ifdef _WIN32

TEST_IMPL(tcp_try_write) {

MAKE_VALGRIND_HAPPY();
return 0;
}

#else /* !_WIN32 */

static uv_tcp_t server;
static uv_tcp_t client;
static uv_tcp_t incoming;
Expand Down Expand Up @@ -138,5 +128,3 @@ TEST_IMPL(tcp_try_write) {
MAKE_VALGRIND_HAPPY();
return 0;
}

#endif /* !_WIN32 */

0 comments on commit 07bd05b

Please sign in to comment.