From a7803c58e4969db90f6960160f364ce2fb5239c1 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 30 Oct 2011 02:56:51 +0100 Subject: [PATCH] uv: upgrade to 70381ce --- deps/uv/src/unix/core.c | 31 +++++++++++++++++++++++++------ deps/uv/src/win/tcp.c | 2 +- deps/uv/src/win/winsock.h | 4 ++++ 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c index 88e9bfc83e0..461d26fc6c7 100644 --- a/deps/uv/src/unix/core.c +++ b/deps/uv/src/unix/core.c @@ -38,18 +38,22 @@ #include /* PATH_MAX */ #include /* writev */ +#ifdef __linux__ +# include +#endif + #ifdef __sun # include # include #endif -#if defined(__APPLE__) -#include /* _NSGetExecutablePath */ +#ifdef __APPLE__ +# include /* _NSGetExecutablePath */ #endif -#if defined(__FreeBSD__) -#include -#include +#ifdef __FreeBSD__ +# include +# include #endif static uv_loop_t default_loop_struct; @@ -593,7 +597,11 @@ static int uv_getaddrinfo_done(eio_req* req) { free(handle->service); free(handle->hostname); - if (handle->retcode != 0) { + if (handle->retcode == 0) { + /* OK */ + } else if (handle->retcode == EAI_NONAME || handle->retcode == EAI_NODATA) { + uv__set_sys_error(handle->loop, ENOENT); /* FIXME compatibility hack */ + } else { handle->loop->last_err.code = UV_EADDRINFO; handle->loop->last_err.sys_errno_ = handle->retcode; } @@ -734,6 +742,9 @@ int uv__close(int fd) { int uv__nonblock(int fd, int set) { +#if FIONBIO + return ioctl(fd, FIONBIO, &set); +#else int flags; if ((flags = fcntl(fd, F_GETFL)) == -1) { @@ -751,10 +762,17 @@ int uv__nonblock(int fd, int set) { } return 0; +#endif } int uv__cloexec(int fd, int set) { +#if __linux__ + /* Linux knows only FD_CLOEXEC so we can safely omit the fcntl(F_GETFD) + * syscall. CHECKME: That's probably true for other Unices as well. + */ + return fcntl(fd, F_SETFD, set ? FD_CLOEXEC : 0); +#else int flags; if ((flags = fcntl(fd, F_GETFD)) == -1) { @@ -772,6 +790,7 @@ int uv__cloexec(int fd, int set) { } return 0; +#endif } diff --git a/deps/uv/src/win/tcp.c b/deps/uv/src/win/tcp.c index 1d18cdab60a..662090d0b27 100644 --- a/deps/uv/src/win/tcp.c +++ b/deps/uv/src/win/tcp.c @@ -1068,4 +1068,4 @@ int uv_tcp_duplicate_socket(uv_tcp_t* handle, int pid, } return 0; -} \ No newline at end of file +} diff --git a/deps/uv/src/win/winsock.h b/deps/uv/src/win/winsock.h index beee032137c..433ce476701 100644 --- a/deps/uv/src/win/winsock.h +++ b/deps/uv/src/win/winsock.h @@ -37,6 +37,10 @@ # define SO_UPDATE_CONNECT_CONTEXT 0x7010 #endif +#ifndef TCP_KEEPALIVE +# define TCP_KEEPALIVE 3 +#endif + #ifndef IPV6_V6ONLY #define IPV6_V6ONLY 27 #endif