diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-03-17 02:32:42 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-03-17 02:32:42 +0400 |
commit | f5a337e09ca971b5d9675aaef4cc3afe66e7196c (patch) | |
tree | 5abb6e7d46f7c3e4c09d9238f78a1df2041763f4 /deps | |
parent | 2b5bc8e0d60209679d6b17de97e1f8ef29434aa4 (diff) |
deps: upgrade libuv to b45a74f
Diffstat (limited to 'deps')
-rw-r--r-- | deps/uv/src/unix/internal.h | 3 | ||||
-rw-r--r-- | deps/uv/src/unix/pipe.c | 5 | ||||
-rw-r--r-- | deps/uv/src/unix/stream.c | 22 | ||||
-rw-r--r-- | deps/uv/src/unix/tty.c | 5 |
4 files changed, 17 insertions, 18 deletions
diff --git a/deps/uv/src/unix/internal.h b/deps/uv/src/unix/internal.h index 35b3b8caa8e..4053d424309 100644 --- a/deps/uv/src/unix/internal.h +++ b/deps/uv/src/unix/internal.h @@ -148,6 +148,9 @@ void uv__stream_init(uv_loop_t* loop, uv_stream_t* stream, uv_handle_type type); int uv__stream_open(uv_stream_t*, int fd, int flags); void uv__stream_destroy(uv_stream_t* stream); +#if defined(__APPLE__) +int uv__stream_try_select(uv_stream_t* stream, int* fd); +#endif /* defined(__APPLE__) */ void uv__server_io(uv_loop_t* loop, uv__io_t* w, unsigned int events); int uv__accept(int sockfd); diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c index 1185b91a1b4..4b7f966bcbd 100644 --- a/deps/uv/src/unix/pipe.c +++ b/deps/uv/src/unix/pipe.c @@ -155,6 +155,11 @@ void uv__pipe_close(uv_pipe_t* handle) { int uv_pipe_open(uv_pipe_t* handle, uv_file fd) { +#if defined(__APPLE__) + if (uv__stream_try_select((uv_stream_t*) handle, &fd)) + return -1; +#endif /* defined(__APPLE__) */ + return uv__stream_open((uv_stream_t*)handle, fd, UV_STREAM_READABLE | UV_STREAM_WRITABLE); diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c index 8137d24eee7..d00fe23cb50 100644 --- a/deps/uv/src/unix/stream.c +++ b/deps/uv/src/unix/stream.c @@ -268,7 +268,7 @@ static void uv__stream_osx_cb_close(uv_handle_t* async) { } -static int uv__stream_try_select(uv_stream_t* stream, int fd) { +int uv__stream_try_select(uv_stream_t* stream, int* fd) { /* * kqueue doesn't work with some files from /dev mount on osx. * select(2) in separate thread for those fds @@ -288,7 +288,7 @@ static int uv__stream_try_select(uv_stream_t* stream, int fd) { return uv__set_sys_error(stream->loop, errno); } - EV_SET(&filter[0], fd, EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, 0); + EV_SET(&filter[0], *fd, EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, 0); /* Use small timeout, because we only want to capture EINVALs */ timeout.tv_sec = 0; @@ -308,7 +308,7 @@ static int uv__stream_try_select(uv_stream_t* stream, int fd) { if (s == NULL) return uv__set_artificial_error(stream->loop, UV_ENOMEM); - s->fd = fd; + s->fd = *fd; if (uv_async_init(stream->loop, &s->async, uv__stream_osx_select_cb)) { SAVE_ERRNO(free(s)); @@ -336,6 +336,7 @@ static int uv__stream_try_select(uv_stream_t* stream, int fd) { s->stream = stream; stream->select = s; + *fd = s->fake_fd; return 0; @@ -368,21 +369,6 @@ int uv__stream_open(uv_stream_t* stream, int fd, int flags) { return uv__set_sys_error(stream->loop, errno); } -#if defined(__APPLE__) - { - uv__stream_select_t* s; - int r; - - r = uv__stream_try_select(stream, fd); - if (r == -1) - return r; - - s = stream->select; - if (s != NULL) - fd = s->fake_fd; - } -#endif /* defined(__APPLE__) */ - stream->io_watcher.fd = fd; return 0; diff --git a/deps/uv/src/unix/tty.c b/deps/uv/src/unix/tty.c index df32e67345d..a2b76add671 100644 --- a/deps/uv/src/unix/tty.c +++ b/deps/uv/src/unix/tty.c @@ -36,6 +36,11 @@ static struct termios orig_termios; int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) { uv__stream_init(loop, (uv_stream_t*)tty, UV_TTY); +#if defined(__APPLE__) + if (uv__stream_try_select((uv_stream_t*) tty, &fd)) + return -1; +#endif /* defined(__APPLE__) */ + if (readable) { uv__nonblock(fd, 1); uv__stream_open((uv_stream_t*)tty, fd, UV_STREAM_READABLE); |