diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-09-23 11:07:57 -0700 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-09-23 11:10:18 -0700 |
commit | 94bedc60f4ea429c9051422916014835374c51d5 (patch) | |
tree | eea30f9fdb0e0c7b720b153d303c2f0b8a3c51ac /deps/uv | |
parent | 1e37efb08bbd1ebd82437b417329b6f8f1639fd0 (diff) | |
download | nodejs-94bedc60f4ea429c9051422916014835374c51d5.tar.gz nodejs-94bedc60f4ea429c9051422916014835374c51d5.tar.bz2 nodejs-94bedc60f4ea429c9051422916014835374c51d5.zip |
Upgrade libuv to f20297f
Diffstat (limited to 'deps/uv')
-rw-r--r-- | deps/uv/README.md (renamed from deps/uv/README) | 49 | ||||
-rw-r--r-- | deps/uv/include/uv.h | 14 | ||||
-rw-r--r-- | deps/uv/src/unix/core.c | 7 | ||||
-rw-r--r-- | deps/uv/src/unix/darwin.c | 1 | ||||
-rw-r--r-- | deps/uv/src/unix/tty.c | 6 | ||||
-rw-r--r-- | deps/uv/src/win/getaddrinfo.c | 9 | ||||
-rw-r--r-- | deps/uv/src/win/tty.c | 11 | ||||
-rw-r--r-- | deps/uv/test/benchmark-getaddrinfo.c | 2 | ||||
-rw-r--r-- | deps/uv/test/test-getaddrinfo.c | 2 | ||||
-rw-r--r-- | deps/uv/test/test-tty.c | 4 |
10 files changed, 78 insertions, 27 deletions
diff --git a/deps/uv/README b/deps/uv/README.md index c808c976b..9bf05992b 100644 --- a/deps/uv/README +++ b/deps/uv/README.md @@ -1,10 +1,49 @@ -This is the new networking layer for Node. Its purpose is to abstract -IOCP on windows and libev on Unix systems. We intend to eventually contain -all platform differences in this library. +# libuv + +libuv is a new platform layer for Node. Its purpose is to abstract IOCP on +windows and libev on Unix systems. We intend to eventually contain all +platform differences in this library. http://nodejs.org/ -= Build Instructions +## Features + +Implemented Features: + + * Non-blocking sockets and pipes + + * Timers + + * UDP + + * Child process spawning + + * Asynchronous DNS via c-ares or getaddrinfo. + + * Asynchronous file system APIs (uv_fs_*) + + * High resolution time (uv_hrtime) + + * Current executable path look up (uv_exepath) + + * Thread pool scheduling (uv_queue_work) + +Work in progress: + + * File system events (Currently supports inotify, ReadDirectoryChangesW and + will support kqueue and event ports in the near future.) + + * TTY support (with VT100 emulation on Windows - work in progress) + + * Socket sharing between processes + + +## Documentation + +See `include/uv.h`. + + +## Build Instructions For GCC (including MinGW) there are two methods building: via normal makefiles or via GYP. GYP is a meta-build system which can generate MSVS, @@ -38,7 +77,7 @@ Macintosh users run xcodebuild -project uv.xcodeproj -configuration Release -target All -= Supported Platforms +## Supported Platforms Microsoft Windows operating systems since Windows XP SP2. It can be built with either Visual Studio or MinGW. diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index c9c5c9ab3..b8bdc0930 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -612,11 +612,6 @@ struct uv_tty_s { UV_TTY_PRIVATE_FIELDS }; -/* - * Returns 1 if file is associated with a Console/TTY 0 otherwise. - */ -int uv_is_tty(uv_file file); - int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd); /* @@ -633,6 +628,7 @@ int uv_tty_get_winsize(uv_tty_t*, int* width, int* height); * Used to detect what type of stream should be used with a given file * descriptor. Usually this will be used during initialization to guess the * type of the stdio streams. + * For isatty() functionality use this function and test for UV_TTY. */ uv_handle_type uv_guess_handle(uv_file file); @@ -807,8 +803,10 @@ struct uv_getaddrinfo_s { * * Return code 0 means that request is accepted and callback will be called * with result. Other return codes mean that there will not be a callback. - * Input arguments may be released after return from this call. Callback - * must not call freeaddrinfo. + * Input arguments may be released after return from this call. + * + * uv_freeaddrinfo() must be called after completion to free the addrinfo + * structure. */ int uv_getaddrinfo(uv_loop_t*, uv_getaddrinfo_t* handle, @@ -817,6 +815,8 @@ struct uv_getaddrinfo_s { const char* service, const struct addrinfo* hints); +void uv_freeaddrinfo(struct addrinfo* ai); + /* uv_spawn() options */ typedef struct uv_process_options_s { uv_exit_cb exit_cb; /* Called after the process exits. */ diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c index 39d5641fc..80b3bf6ed 100644 --- a/deps/uv/src/unix/core.c +++ b/deps/uv/src/unix/core.c @@ -600,8 +600,6 @@ static int uv_getaddrinfo_done(eio_req* req) { handle->cb(handle, handle->retcode, res); - freeaddrinfo(res); - return 0; } @@ -668,6 +666,11 @@ int uv_getaddrinfo(uv_loop_t* loop, } +void uv_freeaddrinfo(struct addrinfo* ai) { + freeaddrinfo(ai); +} + + /* Open a socket in non-blocking close-on-exec mode, atomically if possible. */ int uv__socket(int domain, int type, int protocol) { #if defined(SOCK_NONBLOCK) && defined(SOCK_CLOEXEC) diff --git a/deps/uv/src/unix/darwin.c b/deps/uv/src/unix/darwin.c index 6bc122cc6..af72b4b0e 100644 --- a/deps/uv/src/unix/darwin.c +++ b/deps/uv/src/unix/darwin.c @@ -19,6 +19,7 @@ */ #include "uv.h" +#include "internal.h" #include <assert.h> #include <stdint.h> diff --git a/deps/uv/src/unix/tty.c b/deps/uv/src/unix/tty.c index 88ce52a24..989c09d1b 100644 --- a/deps/uv/src/unix/tty.c +++ b/deps/uv/src/unix/tty.c @@ -26,6 +26,7 @@ #include <unistd.h> #include <termios.h> #include <errno.h> +#include <sys/ioctl.h> int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd) { @@ -69,11 +70,6 @@ fatal: } -int uv_is_tty(uv_file file) { - return isatty(file); -} - - int uv_tty_get_winsize(uv_tty_t* tty, int* width, int* height) { struct winsize ws; diff --git a/deps/uv/src/win/getaddrinfo.c b/deps/uv/src/win/getaddrinfo.c index 3d313420a..1416f04d6 100644 --- a/deps/uv/src/win/getaddrinfo.c +++ b/deps/uv/src/win/getaddrinfo.c @@ -216,12 +216,17 @@ complete: /* finally do callback with converted result */ handle->getaddrinfo_cb(handle, uv_ret, (struct addrinfo*)alloc_ptr); + uv_unref(loop); +} + + +void uv_freeaddrinfo(struct addrinfo* ai) { + char* alloc_ptr = (char*)ai; + /* release copied result memory */ if (alloc_ptr != NULL) { free(alloc_ptr); } - - uv_unref(loop); } diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c index dc477c76c..a4a468296 100644 --- a/deps/uv/src/win/tty.c +++ b/deps/uv/src/win/tty.c @@ -38,9 +38,6 @@ int uv_tty_set_mode(uv_tty_t* tty, int mode) { int uv_is_tty(uv_file file) { - DWORD result; - int r = GetConsoleMode((HANDLE)_get_osfhandle(file), &result); - return r ? 1 : 0; } @@ -51,6 +48,14 @@ int uv_tty_get_winsize(uv_tty_t* tty, int* width, int* height) { uv_handle_type uv_guess_handle(uv_file file) { + DWORD result; + int r = GetConsoleMode((HANDLE)_get_osfhandle(file), &result); + + if (r) { + return UV_TTY; + } + assert(0 && "implement me"); + return UV_UNKNOWN_HANDLE; } diff --git a/deps/uv/test/benchmark-getaddrinfo.c b/deps/uv/test/benchmark-getaddrinfo.c index c2a887973..892c14d1e 100644 --- a/deps/uv/test/benchmark-getaddrinfo.c +++ b/deps/uv/test/benchmark-getaddrinfo.c @@ -52,6 +52,8 @@ static void getaddrinfo_cb(uv_getaddrinfo_t* handle, int status, if (calls_initiated < TOTAL_CALLS) { getaddrinfo_initiate(handle); } + + uv_freeaddrinfo(res); } diff --git a/deps/uv/test/test-getaddrinfo.c b/deps/uv/test/test-getaddrinfo.c index 4f0514f57..2a8c94e75 100644 --- a/deps/uv/test/test-getaddrinfo.c +++ b/deps/uv/test/test-getaddrinfo.c @@ -45,6 +45,7 @@ static void getaddrinfo_basic_cb(uv_getaddrinfo_t* handle, ASSERT(handle == getaddrinfo_handle); getaddrinfo_cbs++; free(handle); + uv_freeaddrinfo(res); } @@ -65,6 +66,7 @@ static void getaddrinfo_cuncurrent_cb(uv_getaddrinfo_t* handle, ASSERT (i < CONCURRENT_COUNT); free(data); + uv_freeaddrinfo(res); getaddrinfo_cbs++; } diff --git a/deps/uv/test/test-tty.c b/deps/uv/test/test-tty.c index f41c5e543..11816156f 100644 --- a/deps/uv/test/test-tty.c +++ b/deps/uv/test/test-tty.c @@ -31,13 +31,11 @@ TEST_IMPL(tty) { * Not necessarally a problem if this assert goes off. E.G you are piping * this test to a file. 0 == stdin. */ - ASSERT(uv_is_tty(0) == 1); + ASSERT(UV_TTY == uv_guess_handle(0)); r = uv_tty_init(uv_default_loop(), &tty, 0); ASSERT(r == 0); - ASSERT(UV_TTY == uv_guess_handle(0)); - r = uv_tty_get_winsize(&tty, &width, &height); ASSERT(r == 0); |