Browse Source

uv: upgrade to 9bd8bd7

Ben Noordhuis 13 years ago
parent
commit
0d80040adf
  1. 3
      deps/uv/include/uv.h
  2. 20
      deps/uv/src/unix/core.c
  3. 26
      deps/uv/src/unix/pipe.c
  4. 40
      deps/uv/src/win/core.c
  5. 15
      deps/uv/src/win/internal.h
  6. 30
      deps/uv/src/win/timer.c
  7. 1
      deps/uv/test/benchmark-ares.c
  8. 1
      deps/uv/test/benchmark-getaddrinfo.c
  9. 1
      deps/uv/test/benchmark-ping-pongs.c
  10. 1
      deps/uv/test/benchmark-pound.c
  11. 4
      deps/uv/test/benchmark-pump.c
  12. 1
      deps/uv/test/benchmark-spawn.c
  13. 1
      deps/uv/test/benchmark-udp-packet-storm.c
  14. 1
      deps/uv/test/dns-server.c
  15. 3
      deps/uv/test/echo-server.c
  16. 2
      deps/uv/test/test-async.c
  17. 2
      deps/uv/test/test-callback-stack.c
  18. 5
      deps/uv/test/test-connection-fail.c
  19. 2
      deps/uv/test/test-delayed-accept.c
  20. 17
      deps/uv/test/test-fs.c
  21. 5
      deps/uv/test/test-getaddrinfo.c
  22. 2
      deps/uv/test/test-gethostbyname.c
  23. 2
      deps/uv/test/test-getsockname.c
  24. 3
      deps/uv/test/test-idle.c
  25. 3
      deps/uv/test/test-loop-handles.c
  26. 6
      deps/uv/test/test-ping-pong.c
  27. 12
      deps/uv/test/test-pipe-bind-error.c
  28. 7
      deps/uv/test/test-ref.c
  29. 2
      deps/uv/test/test-shutdown-eof.c
  30. 10
      deps/uv/test/test-spawn.c
  31. 19
      deps/uv/test/test-tcp-bind-error.c
  32. 15
      deps/uv/test/test-tcp-bind6-error.c
  33. 3
      deps/uv/test/test-tcp-writealot.c
  34. 2
      deps/uv/test/test-threadpool.c
  35. 3
      deps/uv/test/test-timer-again.c
  36. 2
      deps/uv/test/test-timer.c
  37. 2
      deps/uv/test/test-udp-dgram-too-big.c
  38. 2
      deps/uv/test/test-udp-ipv6.c
  39. 2
      deps/uv/test/test-udp-send-and-recv.c
  40. 15
      deps/uv/uv.gyp
  41. 2
      src/node.cc

3
deps/uv/include/uv.h

@ -81,11 +81,10 @@ typedef struct uv_work_s uv_work_t;
* All callbacks in libuv are made asynchronously. That is they are never * All callbacks in libuv are made asynchronously. That is they are never
* made by the function that takes them as a parameter. * made by the function that takes them as a parameter.
*/ */
void uv_init();
uv_loop_t* uv_loop_new(); uv_loop_t* uv_loop_new();
void uv_loop_delete(uv_loop_t*); void uv_loop_delete(uv_loop_t*);
/* /*
* Returns the default loop. * Returns the default loop.
*/ */

20
deps/uv/src/unix/core.c

@ -65,17 +65,6 @@ static void uv__finish_close(uv_handle_t* handle);
#endif #endif
void uv_init() {
default_loop_ptr = &default_loop_struct;
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
default_loop_struct.ev = ev_default_loop(EVBACKEND_KQUEUE);
#else
default_loop_struct.ev = ev_default_loop(EVFLAG_AUTO);
#endif
ev_set_userdata(default_loop_struct.ev, default_loop_ptr);
}
void uv_close(uv_handle_t* handle, uv_close_cb close_cb) { void uv_close(uv_handle_t* handle, uv_close_cb close_cb) {
uv_udp_t* udp; uv_udp_t* udp;
uv_async_t* async; uv_async_t* async;
@ -176,6 +165,15 @@ void uv_loop_delete(uv_loop_t* loop) {
uv_loop_t* uv_default_loop() { uv_loop_t* uv_default_loop() {
if (!default_loop_ptr) {
default_loop_ptr = &default_loop_struct;
#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
default_loop_struct.ev = ev_default_loop(EVBACKEND_KQUEUE);
#else
default_loop_struct.ev = ev_default_loop(EVFLAG_AUTO);
#endif
ev_set_userdata(default_loop_struct.ev, default_loop_ptr);
}
assert(default_loop_ptr->ev == EV_DEFAULT_UC); assert(default_loop_ptr->ev == EV_DEFAULT_UC);
return default_loop_ptr; return default_loop_ptr;
} }

26
deps/uv/src/unix/pipe.c

@ -38,7 +38,7 @@ int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle) {
int uv_pipe_bind(uv_pipe_t* handle, const char* name) { int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
struct sockaddr_un sun; struct sockaddr_un saddr;
const char* pipe_fname; const char* pipe_fname;
int saved_errno; int saved_errno;
int sockfd; int sockfd;
@ -71,11 +71,11 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
goto out; goto out;
} }
memset(&sun, 0, sizeof sun); memset(&saddr, 0, sizeof saddr);
uv__strlcpy(sun.sun_path, pipe_fname, sizeof(sun.sun_path)); uv__strlcpy(saddr.sun_path, pipe_fname, sizeof(saddr.sun_path));
sun.sun_family = AF_UNIX; saddr.sun_family = AF_UNIX;
if (bind(sockfd, (struct sockaddr*)&sun, sizeof sun) == -1) { if (bind(sockfd, (struct sockaddr*)&saddr, sizeof saddr) == -1) {
/* On EADDRINUSE: /* On EADDRINUSE:
* *
* We hold the file lock so there is no other process listening * We hold the file lock so there is no other process listening
@ -86,7 +86,7 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
*/ */
if (errno != EADDRINUSE if (errno != EADDRINUSE
|| unlink(pipe_fname) == -1 || unlink(pipe_fname) == -1
|| bind(sockfd, (struct sockaddr*)&sun, sizeof sun) == -1) { || bind(sockfd, (struct sockaddr*)&saddr, sizeof saddr) == -1) {
/* Convert ENOENT to EACCES for compatibility with Windows. */ /* Convert ENOENT to EACCES for compatibility with Windows. */
uv_err_new(handle->loop, (errno == ENOENT) ? EACCES : errno); uv_err_new(handle->loop, (errno == ENOENT) ? EACCES : errno);
goto out; goto out;
@ -174,7 +174,7 @@ int uv_pipe_connect(uv_connect_t* req,
uv_pipe_t* handle, uv_pipe_t* handle,
const char* name, const char* name,
uv_connect_cb cb) { uv_connect_cb cb) {
struct sockaddr_un sun; struct sockaddr_un saddr;
int saved_errno; int saved_errno;
int sockfd; int sockfd;
int status; int status;
@ -189,15 +189,15 @@ int uv_pipe_connect(uv_connect_t* req,
goto out; goto out;
} }
memset(&sun, 0, sizeof sun); memset(&saddr, 0, sizeof saddr);
uv__strlcpy(sun.sun_path, name, sizeof(sun.sun_path)); uv__strlcpy(saddr.sun_path, name, sizeof(saddr.sun_path));
sun.sun_family = AF_UNIX; saddr.sun_family = AF_UNIX;
/* We don't check for EINPROGRESS. Think about it: the socket /* We don't check for EINPROGRESS. Think about it: the socket
* is either there or not. * is either there or not.
*/ */
do { do {
r = connect(sockfd, (struct sockaddr*)&sun, sizeof sun); r = connect(sockfd, (struct sockaddr*)&saddr, sizeof saddr);
} }
while (r == -1 && errno == EINTR); while (r == -1 && errno == EINTR);
@ -236,7 +236,7 @@ out:
/* TODO merge with uv__server_io()? */ /* TODO merge with uv__server_io()? */
void uv__pipe_accept(EV_P_ ev_io* watcher, int revents) { void uv__pipe_accept(EV_P_ ev_io* watcher, int revents) {
struct sockaddr_un sun; struct sockaddr_un saddr;
uv_pipe_t* pipe; uv_pipe_t* pipe;
int saved_errno; int saved_errno;
int sockfd; int sockfd;
@ -247,7 +247,7 @@ void uv__pipe_accept(EV_P_ ev_io* watcher, int revents) {
assert(pipe->type == UV_NAMED_PIPE); assert(pipe->type == UV_NAMED_PIPE);
assert(pipe->pipe_fname != NULL); assert(pipe->pipe_fname != NULL);
sockfd = uv__accept(pipe->fd, (struct sockaddr *)&sun, sizeof sun); sockfd = uv__accept(pipe->fd, (struct sockaddr *)&saddr, sizeof saddr);
if (sockfd == -1) { if (sockfd == -1) {
if (errno == EAGAIN || errno == EWOULDBLOCK) { if (errno == EAGAIN || errno == EWOULDBLOCK) {
assert(0 && "EAGAIN on uv__accept(pipefd)"); assert(0 && "EAGAIN on uv__accept(pipefd)");

40
deps/uv/src/win/core.c

@ -33,7 +33,22 @@
/* The only event loop we support right now */ /* The only event loop we support right now */
static uv_loop_t uv_default_loop_; static uv_loop_t uv_default_loop_;
static int uv_default_loop_initialized_ = 0;
/* uv_once intialization guards */
static uv_once_t uv_init_guard_ = UV_ONCE_INIT;
static uv_once_t uv_default_loop_init_guard_ = UV_ONCE_INIT;
static void uv_init(void) {
/* Initialize winsock */
uv_winsock_init();
/* Fetch winapi function pointers */
uv_winapi_init();
/* Initialize FS */
uv_fs_init();
}
static void uv_loop_init(uv_loop_t* loop) { static void uv_loop_init(uv_loop_t* loop) {
@ -68,25 +83,18 @@ static void uv_loop_init(uv_loop_t* loop) {
} }
uv_loop_t* uv_default_loop() { static void uv_default_loop_init(void) {
if (!uv_default_loop_initialized_) { /* Intialize libuv itself first */
uv_loop_init(&uv_default_loop_); uv_once(&uv_init_guard_, uv_init);
uv_default_loop_initialized_ = 1;
}
return &uv_default_loop_; /* Initialize the main loop */
uv_loop_init(&uv_default_loop_);
} }
void uv_init() { uv_loop_t* uv_default_loop() {
/* Initialize winsock */ uv_once(&uv_default_loop_init_guard_, uv_default_loop_init);
uv_winsock_init(); return &uv_default_loop_;
/* Fetch winapi function pointers */
uv_winapi_init();
/* Initialize FS */
uv_fs_init();
} }

15
deps/uv/src/win/internal.h

@ -279,4 +279,19 @@ void uv_winsock_init();
int uv_ntstatus_to_winsock_error(NTSTATUS status); int uv_ntstatus_to_winsock_error(NTSTATUS status);
/* Threads and synchronization */
typedef struct uv_once_s {
unsigned char ran;
/* The actual event handle must be aligned to sizeof(HANDLE), so in */
/* practice it might overlap padding a little. */
HANDLE event;
HANDLE padding;
} uv_once_t;
#define UV_ONCE_INIT \
{ 0, NULL, NULL }
void uv_once(uv_once_t* guard, void (*callback)(void));
#endif /* UV_WIN_INTERNAL_H_ */ #endif /* UV_WIN_INTERNAL_H_ */

30
deps/uv/src/win/timer.c

@ -33,7 +33,7 @@
/* The resolution of the high-resolution clock. */ /* The resolution of the high-resolution clock. */
static int64_t uv_ticks_per_msec_ = 0; static int64_t uv_ticks_per_msec_ = 0;
static uint64_t uv_hrtime_frequency_ = 0; static uint64_t uv_hrtime_frequency_ = 0;
static char uv_hrtime_initialized_ = 0; static uv_once_t uv_hrtime_init_guard_ = UV_ONCE_INIT;
void uv_update_time(uv_loop_t* loop) { void uv_update_time(uv_loop_t* loop) {
@ -57,24 +57,24 @@ int64_t uv_now(uv_loop_t* loop) {
return loop->time; return loop->time;
} }
/* TODO: thread safety */
uint64_t uv_hrtime(void) {
LARGE_INTEGER counter;
/* When called for the first time, obtain the high-resolution clock */
/* frequency. */
if (!uv_hrtime_initialized_) {
uv_hrtime_initialized_ = 1;
if (!QueryPerformanceFrequency(&counter)) { static void uv_hrtime_init(void) {
uv_hrtime_frequency_ = 0; LARGE_INTEGER frequency;
/* uv_set_sys_error(loop, GetLastError()); */
return 0;
}
uv_hrtime_frequency_ = counter.QuadPart; if (!QueryPerformanceFrequency(&frequency)) {
uv_hrtime_frequency_ = 0;
return;
} }
uv_hrtime_frequency_ = frequency.QuadPart;
}
uint64_t uv_hrtime(void) {
LARGE_INTEGER counter;
uv_once(&uv_hrtime_init_guard_, uv_hrtime_init);
/* If the performance frequency is zero, there's no support. */ /* If the performance frequency is zero, there's no support. */
if (!uv_hrtime_frequency_) { if (!uv_hrtime_frequency_) {
/* uv_set_sys_error(loop, ERROR_NOT_SUPPORTED); */ /* uv_set_sys_error(loop, ERROR_NOT_SUPPORTED); */

1
deps/uv/test/benchmark-ares.c

@ -86,7 +86,6 @@ BENCHMARK_IMPL(gethostbyname) {
return 1; return 1;
} }
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
ares_callbacks = 0; ares_callbacks = 0;

1
deps/uv/test/benchmark-getaddrinfo.c

@ -68,7 +68,6 @@ static void getaddrinfo_initiate(uv_getaddrinfo_t* handle) {
BENCHMARK_IMPL(getaddrinfo) { BENCHMARK_IMPL(getaddrinfo) {
int i; int i;
uv_init(loop);
loop = uv_default_loop(); loop = uv_default_loop();
uv_update_time(loop); uv_update_time(loop);

1
deps/uv/test/benchmark-ping-pongs.c

@ -200,7 +200,6 @@ static void pinger_new() {
BENCHMARK_IMPL(ping_pongs) { BENCHMARK_IMPL(ping_pongs) {
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
start_time = uv_now(loop); start_time = uv_now(loop);

1
deps/uv/test/benchmark-pound.c

@ -277,7 +277,6 @@ static int pound_it(int concurrency,
uint64_t start_time; /* in ns */ uint64_t start_time; /* in ns */
uint64_t end_time; uint64_t end_time;
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
uv_update_time(loop); uv_update_time(loop);

4
deps/uv/test/benchmark-pump.c

@ -367,7 +367,6 @@ HELPER_IMPL(tcp_pump_server) {
int r; int r;
type = TCP; type = TCP;
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
listen_addr = uv_ip4_addr("0.0.0.0", TEST_PORT); listen_addr = uv_ip4_addr("0.0.0.0", TEST_PORT);
@ -391,7 +390,6 @@ HELPER_IMPL(pipe_pump_server) {
int r; int r;
type = PIPE; type = PIPE;
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
/* Server */ /* Server */
@ -414,7 +412,6 @@ void tcp_pump(int n) {
TARGET_CONNECTIONS = n; TARGET_CONNECTIONS = n;
type = TCP; type = TCP;
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
connect_addr = uv_ip4_addr("127.0.0.1", TEST_PORT); connect_addr = uv_ip4_addr("127.0.0.1", TEST_PORT);
@ -431,7 +428,6 @@ void pipe_pump(int n) {
TARGET_CONNECTIONS = n; TARGET_CONNECTIONS = n;
type = PIPE; type = PIPE;
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
/* Start making connections */ /* Start making connections */

1
deps/uv/test/benchmark-spawn.c

@ -132,7 +132,6 @@ BENCHMARK_IMPL(spawn) {
int r; int r;
static int64_t start_time, end_time; static int64_t start_time, end_time;
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
r = uv_exepath(exepath, &exepath_size); r = uv_exepath(exepath, &exepath_size);

1
deps/uv/test/benchmark-udp-packet-storm.c

@ -134,7 +134,6 @@ static int do_packet_storm(int n_senders, int n_receivers) {
ASSERT(n_senders <= MAX_SENDERS); ASSERT(n_senders <= MAX_SENDERS);
ASSERT(n_receivers <= MAX_RECEIVERS); ASSERT(n_receivers <= MAX_RECEIVERS);
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
n_senders_ = n_senders; n_senders_ = n_senders;

1
deps/uv/test/dns-server.c

@ -317,7 +317,6 @@ static int dns_start(int port) {
HELPER_IMPL(dns_server) { HELPER_IMPL(dns_server) {
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
if (dns_start(TEST_PORT_2)) if (dns_start(TEST_PORT_2))

3
deps/uv/test/echo-server.c

@ -272,7 +272,6 @@ static int pipe_echo_start(char* pipeName) {
HELPER_IMPL(tcp4_echo_server) { HELPER_IMPL(tcp4_echo_server) {
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
if (tcp4_echo_start(TEST_PORT)) if (tcp4_echo_start(TEST_PORT))
@ -284,7 +283,6 @@ HELPER_IMPL(tcp4_echo_server) {
HELPER_IMPL(tcp6_echo_server) { HELPER_IMPL(tcp6_echo_server) {
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
if (tcp6_echo_start(TEST_PORT)) if (tcp6_echo_start(TEST_PORT))
@ -296,7 +294,6 @@ HELPER_IMPL(tcp6_echo_server) {
HELPER_IMPL(pipe_echo_server) { HELPER_IMPL(pipe_echo_server) {
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
if (pipe_echo_start(TEST_PIPENAME)) if (pipe_echo_start(TEST_PIPENAME))

2
deps/uv/test/test-async.c

@ -182,8 +182,6 @@ static void prepare_cb(uv_prepare_t* handle, int status) {
TEST_IMPL(async) { TEST_IMPL(async) {
int r; int r;
uv_init();
r = uv_prepare_init(uv_default_loop(), &prepare_handle); r = uv_prepare_init(uv_default_loop(), &prepare_handle);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_prepare_start(&prepare_handle, prepare_cb); r = uv_prepare_start(&prepare_handle, prepare_cb);

2
deps/uv/test/test-callback-stack.c

@ -176,8 +176,6 @@ static void connect_cb(uv_connect_t* req, int status) {
TEST_IMPL(callback_stack) { TEST_IMPL(callback_stack) {
struct sockaddr_in addr = uv_ip4_addr("127.0.0.1", TEST_PORT); struct sockaddr_in addr = uv_ip4_addr("127.0.0.1", TEST_PORT);
uv_init();
if (uv_tcp_init(uv_default_loop(), &client)) { if (uv_tcp_init(uv_default_loop(), &client)) {
FATAL("uv_tcp_init failed"); FATAL("uv_tcp_init failed");
} }

5
deps/uv/test/test-connection-fail.c

@ -119,8 +119,6 @@ void connection_fail(uv_connect_cb connect_cb) {
* expect an error. * expect an error.
*/ */
TEST_IMPL(connection_fail) { TEST_IMPL(connection_fail) {
uv_init();
connection_fail(on_connect_with_close); connection_fail(on_connect_with_close);
ASSERT(timer_close_cb_calls == 0); ASSERT(timer_close_cb_calls == 0);
@ -136,9 +134,6 @@ TEST_IMPL(connection_fail) {
* attempt. * attempt.
*/ */
TEST_IMPL(connection_fail_doesnt_auto_close) { TEST_IMPL(connection_fail_doesnt_auto_close) {
uv_init();
uv_timer_init(uv_default_loop(), &timer); uv_timer_init(uv_default_loop(), &timer);
connection_fail(on_connect_without_close); connection_fail(on_connect_without_close);

2
deps/uv/test/test-delayed-accept.c

@ -180,8 +180,6 @@ static void client_connect() {
TEST_IMPL(delayed_accept) { TEST_IMPL(delayed_accept) {
uv_init();
start_server(); start_server();
client_connect(); client_connect();

17
deps/uv/test/test-fs.c

@ -387,7 +387,6 @@ TEST_IMPL(fs_file_noent) {
uv_fs_t req; uv_fs_t req;
int r; int r;
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
r = uv_fs_open(loop, &req, "does_not_exist", O_RDONLY, 0, NULL); r = uv_fs_open(loop, &req, "does_not_exist", O_RDONLY, 0, NULL);
@ -476,7 +475,6 @@ TEST_IMPL(fs_file_async) {
unlink("test_file"); unlink("test_file");
unlink("test_file2"); unlink("test_file2");
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT, r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT,
@ -539,7 +537,6 @@ TEST_IMPL(fs_file_sync) {
unlink("test_file"); unlink("test_file");
unlink("test_file2"); unlink("test_file2");
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT, r = uv_fs_open(loop, &open_req1, "test_file", O_WRONLY | O_CREAT,
@ -625,7 +622,6 @@ TEST_IMPL(fs_async_dir) {
unlink("test_dir/file2"); unlink("test_dir/file2");
rmdir("test_dir"); rmdir("test_dir");
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
r = uv_fs_mkdir(loop, &mkdir_req, "test_dir", 0755, mkdir_cb); r = uv_fs_mkdir(loop, &mkdir_req, "test_dir", 0755, mkdir_cb);
@ -713,7 +709,6 @@ TEST_IMPL(fs_async_sendfile) {
struct stat s1, s2; struct stat s1, s2;
/* Setup. */ /* Setup. */
uv_init();
unlink("test_file"); unlink("test_file");
unlink("test_file2"); unlink("test_file2");
@ -781,8 +776,6 @@ TEST_IMPL(fs_fstat) {
/* Setup. */ /* Setup. */
unlink("test_file"); unlink("test_file");
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT, r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
@ -837,8 +830,6 @@ TEST_IMPL(fs_chmod) {
/* Setup. */ /* Setup. */
unlink("test_file"); unlink("test_file");
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT, r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
@ -926,8 +917,6 @@ TEST_IMPL(fs_chown) {
/* Setup. */ /* Setup. */
unlink("test_file"); unlink("test_file");
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT, r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
@ -987,8 +976,6 @@ TEST_IMPL(fs_link) {
unlink("test_file_link"); unlink("test_file_link");
unlink("test_file_link2"); unlink("test_file_link2");
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT, r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
@ -1073,8 +1060,6 @@ TEST_IMPL(fs_symlink) {
unlink("test_file_symlink_symlink"); unlink("test_file_symlink_symlink");
unlink("test_file_symlink2_symlink"); unlink("test_file_symlink2_symlink");
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT, r = uv_fs_open(loop, &req, "test_file", O_RDWR | O_CREAT,
@ -1187,7 +1172,6 @@ TEST_IMPL(fs_utime) {
uv_fs_t req; uv_fs_t req;
int r; int r;
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
atime = mtime = 400497753; /* 1982-09-10 11:22:33 */ atime = mtime = 400497753; /* 1982-09-10 11:22:33 */
@ -1228,7 +1212,6 @@ TEST_IMPL(fs_futime) {
uv_fs_t req; uv_fs_t req;
int r; int r;
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
atime = mtime = 400497753; /* 1982-09-10 11:22:33 */ atime = mtime = 400497753; /* 1982-09-10 11:22:33 */

5
deps/uv/test/test-getaddrinfo.c

@ -72,9 +72,6 @@ static void getaddrinfo_cuncurrent_cb(uv_getaddrinfo_t* handle,
TEST_IMPL(getaddrinfo_basic) { TEST_IMPL(getaddrinfo_basic) {
int r; int r;
uv_init();
r = uv_getaddrinfo(uv_default_loop(), r = uv_getaddrinfo(uv_default_loop(),
&getaddrinfo_handle, &getaddrinfo_handle,
&getaddrinfo_basic_cb, &getaddrinfo_basic_cb,
@ -95,8 +92,6 @@ TEST_IMPL(getaddrinfo_concurrent) {
int i, r; int i, r;
int* data; int* data;
uv_init();
for (i = 0; i < CONCURRENT_COUNT; i++) { for (i = 0; i < CONCURRENT_COUNT; i++) {
callback_counts[i] = 0; callback_counts[i] = 0;

2
deps/uv/test/test-gethostbyname.c

@ -90,8 +90,6 @@ TEST_IMPL(gethostbyname) {
return 1; return 1;
} }
uv_init();
printf("Start basic gethostbyname test\n"); printf("Start basic gethostbyname test\n");
prep_tcploopback(); prep_tcploopback();

2
deps/uv/test/test-getsockname.c

@ -309,7 +309,6 @@ static void udp_sender(void) {
TEST_IMPL(getsockname_tcp) { TEST_IMPL(getsockname_tcp) {
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
if (tcp_listener()) if (tcp_listener())
@ -327,7 +326,6 @@ TEST_IMPL(getsockname_tcp) {
TEST_IMPL(getsockname_udp) { TEST_IMPL(getsockname_udp) {
uv_init();
loop = uv_default_loop(); loop = uv_default_loop();
if (udp_listener()) if (udp_listener())

3
deps/uv/test/test-idle.c

@ -60,9 +60,6 @@ static void idle_cb(uv_idle_t* handle, int status) {
TEST_IMPL(idle_starvation) { TEST_IMPL(idle_starvation) {
int r; int r;
uv_init();
r = uv_idle_init(uv_default_loop(), &idle_handle); r = uv_idle_init(uv_default_loop(), &idle_handle);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_idle_start(&idle_handle, idle_cb); r = uv_idle_start(&idle_handle, idle_cb);

3
deps/uv/test/test-loop-handles.c

@ -299,9 +299,6 @@ TEST_IMPL(loop_handles) {
int i; int i;
int r; int r;
uv_init();
r = uv_prepare_init(uv_default_loop(), &prepare_1_handle); r = uv_prepare_init(uv_default_loop(), &prepare_1_handle);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_prepare_start(&prepare_1_handle, prepare_1_cb); r = uv_prepare_start(&prepare_1_handle, prepare_1_cb);

6
deps/uv/test/test-ping-pong.c

@ -221,8 +221,6 @@ static void pipe_pinger_new() {
TEST_IMPL(tcp_ping_pong) { TEST_IMPL(tcp_ping_pong) {
uv_init();
tcp_pinger_new(); tcp_pinger_new();
uv_run(uv_default_loop()); uv_run(uv_default_loop());
@ -233,8 +231,6 @@ TEST_IMPL(tcp_ping_pong) {
TEST_IMPL(tcp_ping_pong_v6) { TEST_IMPL(tcp_ping_pong_v6) {
uv_init();
tcp_pinger_v6_new(); tcp_pinger_v6_new();
uv_run(uv_default_loop()); uv_run(uv_default_loop());
@ -245,8 +241,6 @@ TEST_IMPL(tcp_ping_pong_v6) {
TEST_IMPL(pipe_ping_pong) { TEST_IMPL(pipe_ping_pong) {
uv_init();
pipe_pinger_new(); pipe_pinger_new();
uv_run(uv_default_loop()); uv_run(uv_default_loop());

12
deps/uv/test/test-pipe-bind-error.c

@ -45,9 +45,6 @@ TEST_IMPL(pipe_bind_error_addrinuse) {
uv_pipe_t server1, server2; uv_pipe_t server1, server2;
int r; int r;
uv_init();
r = uv_pipe_init(uv_default_loop(), &server1); r = uv_pipe_init(uv_default_loop(), &server1);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_pipe_bind(&server1, TEST_PIPENAME); r = uv_pipe_bind(&server1, TEST_PIPENAME);
@ -82,9 +79,6 @@ TEST_IMPL(pipe_bind_error_addrnotavail) {
uv_pipe_t server; uv_pipe_t server;
int r; int r;
uv_init();
r = uv_pipe_init(uv_default_loop(), &server); r = uv_pipe_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_pipe_bind(&server, BAD_PIPENAME); r = uv_pipe_bind(&server, BAD_PIPENAME);
@ -106,9 +100,6 @@ TEST_IMPL(pipe_bind_error_inval) {
uv_pipe_t server; uv_pipe_t server;
int r; int r;
uv_init();
r = uv_pipe_init(uv_default_loop(), &server); r = uv_pipe_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_pipe_bind(&server, TEST_PIPENAME); r = uv_pipe_bind(&server, TEST_PIPENAME);
@ -132,9 +123,6 @@ TEST_IMPL(pipe_listen_without_bind) {
uv_pipe_t server; uv_pipe_t server;
int r; int r;
uv_init();
r = uv_pipe_init(uv_default_loop(), &server); r = uv_pipe_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_listen((uv_stream_t*)&server, SOMAXCONN, NULL); r = uv_listen((uv_stream_t*)&server, SOMAXCONN, NULL);

7
deps/uv/test/test-ref.c

@ -24,7 +24,6 @@
TEST_IMPL(ref) { TEST_IMPL(ref) {
uv_init();
uv_run(uv_default_loop()); uv_run(uv_default_loop());
return 0; return 0;
} }
@ -32,7 +31,6 @@ TEST_IMPL(ref) {
TEST_IMPL(idle_ref) { TEST_IMPL(idle_ref) {
uv_idle_t h; uv_idle_t h;
uv_init();
uv_idle_init(uv_default_loop(), &h); uv_idle_init(uv_default_loop(), &h);
uv_idle_start(&h, NULL); uv_idle_start(&h, NULL);
uv_unref(uv_default_loop()); uv_unref(uv_default_loop());
@ -43,7 +41,6 @@ TEST_IMPL(idle_ref) {
TEST_IMPL(async_ref) { TEST_IMPL(async_ref) {
uv_async_t h; uv_async_t h;
uv_init();
uv_async_init(uv_default_loop(), &h, NULL); uv_async_init(uv_default_loop(), &h, NULL);
uv_unref(uv_default_loop()); uv_unref(uv_default_loop());
uv_run(uv_default_loop()); uv_run(uv_default_loop());
@ -53,7 +50,6 @@ TEST_IMPL(async_ref) {
TEST_IMPL(prepare_ref) { TEST_IMPL(prepare_ref) {
uv_prepare_t h; uv_prepare_t h;
uv_init();
uv_prepare_init(uv_default_loop(), &h); uv_prepare_init(uv_default_loop(), &h);
uv_prepare_start(&h, NULL); uv_prepare_start(&h, NULL);
uv_unref(uv_default_loop()); uv_unref(uv_default_loop());
@ -64,7 +60,6 @@ TEST_IMPL(prepare_ref) {
TEST_IMPL(check_ref) { TEST_IMPL(check_ref) {
uv_check_t h; uv_check_t h;
uv_init();
uv_check_init(uv_default_loop(), &h); uv_check_init(uv_default_loop(), &h);
uv_check_start(&h, NULL); uv_check_start(&h, NULL);
uv_unref(uv_default_loop()); uv_unref(uv_default_loop());
@ -83,8 +78,6 @@ static void prepare_cb(uv_prepare_t* handle, int status) {
TEST_IMPL(unref_in_prepare_cb) { TEST_IMPL(unref_in_prepare_cb) {
uv_prepare_t h; uv_prepare_t h;
uv_init();
uv_prepare_init(uv_default_loop(), &h); uv_prepare_init(uv_default_loop(), &h);
uv_prepare_start(&h, prepare_cb); uv_prepare_start(&h, prepare_cb);
uv_run(uv_default_loop()); uv_run(uv_default_loop());

2
deps/uv/test/test-shutdown-eof.c

@ -153,8 +153,6 @@ TEST_IMPL(shutdown_eof) {
struct sockaddr_in server_addr; struct sockaddr_in server_addr;
int r; int r;
uv_init();
qbuf.base = "Q"; qbuf.base = "Q";
qbuf.len = 1; qbuf.len = 1;

10
deps/uv/test/test-spawn.c

@ -117,8 +117,6 @@ static void timer_cb(uv_timer_t* handle, int status) {
TEST_IMPL(spawn_exit_code) { TEST_IMPL(spawn_exit_code) {
int r; int r;
uv_init();
init_process_options("spawn_helper1", exit_cb); init_process_options("spawn_helper1", exit_cb);
r = uv_spawn(uv_default_loop(), &process, options); r = uv_spawn(uv_default_loop(), &process, options);
@ -138,8 +136,6 @@ TEST_IMPL(spawn_stdout) {
int r; int r;
uv_pipe_t out; uv_pipe_t out;
uv_init();
init_process_options("spawn_helper2", exit_cb); init_process_options("spawn_helper2", exit_cb);
uv_pipe_init(uv_default_loop(), &out); uv_pipe_init(uv_default_loop(), &out);
@ -171,8 +167,6 @@ int r;
uv_buf_t buf; uv_buf_t buf;
char buffer[] = "hello-from-spawn_stdin"; char buffer[] = "hello-from-spawn_stdin";
uv_init();
init_process_options("spawn_helper3", exit_cb); init_process_options("spawn_helper3", exit_cb);
uv_pipe_init(uv_default_loop(), &out); uv_pipe_init(uv_default_loop(), &out);
@ -205,8 +199,6 @@ int r;
TEST_IMPL(spawn_and_kill) { TEST_IMPL(spawn_and_kill) {
int r; int r;
uv_init();
init_process_options("spawn_helper4", kill_cb); init_process_options("spawn_helper4", kill_cb);
r = uv_spawn(uv_default_loop(), &process, options); r = uv_spawn(uv_default_loop(), &process, options);
@ -235,8 +227,6 @@ TEST_IMPL(spawn_detect_pipe_name_collisions_on_windows) {
char name[64]; char name[64];
HANDLE pipe_handle; HANDLE pipe_handle;
uv_init();
init_process_options("spawn_helper2", exit_cb); init_process_options("spawn_helper2", exit_cb);
uv_pipe_init(uv_default_loop(), &out); uv_pipe_init(uv_default_loop(), &out);

19
deps/uv/test/test-tcp-bind-error.c

@ -39,9 +39,6 @@ TEST_IMPL(tcp_bind_error_addrinuse) {
uv_tcp_t server1, server2; uv_tcp_t server1, server2;
int r; int r;
uv_init();
r = uv_tcp_init(uv_default_loop(), &server1); r = uv_tcp_init(uv_default_loop(), &server1);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_tcp_bind(&server1, addr); r = uv_tcp_bind(&server1, addr);
@ -75,9 +72,6 @@ TEST_IMPL(tcp_bind_error_addrnotavail_1) {
uv_tcp_t server; uv_tcp_t server;
int r; int r;
uv_init();
r = uv_tcp_init(uv_default_loop(), &server); r = uv_tcp_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_tcp_bind(&server, addr); r = uv_tcp_bind(&server, addr);
@ -102,8 +96,6 @@ TEST_IMPL(tcp_bind_error_addrnotavail_2) {
uv_tcp_t server; uv_tcp_t server;
int r; int r;
uv_init();
r = uv_tcp_init(uv_default_loop(), &server); r = uv_tcp_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_tcp_bind(&server, addr); r = uv_tcp_bind(&server, addr);
@ -128,9 +120,6 @@ TEST_IMPL(tcp_bind_error_fault) {
garbage_addr = (struct sockaddr_in*) &garbage; garbage_addr = (struct sockaddr_in*) &garbage;
uv_init();
r = uv_tcp_init(uv_default_loop(), &server); r = uv_tcp_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_tcp_bind(&server, *garbage_addr); r = uv_tcp_bind(&server, *garbage_addr);
@ -155,9 +144,6 @@ TEST_IMPL(tcp_bind_error_inval) {
uv_tcp_t server; uv_tcp_t server;
int r; int r;
uv_init();
r = uv_tcp_init(uv_default_loop(), &server); r = uv_tcp_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_tcp_bind(&server, addr1); r = uv_tcp_bind(&server, addr1);
@ -183,9 +169,6 @@ TEST_IMPL(tcp_bind_localhost_ok) {
uv_tcp_t server; uv_tcp_t server;
int r; int r;
uv_init();
r = uv_tcp_init(uv_default_loop(), &server); r = uv_tcp_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_tcp_bind(&server, addr); r = uv_tcp_bind(&server, addr);
@ -199,8 +182,6 @@ TEST_IMPL(tcp_listen_without_bind) {
int r; int r;
uv_tcp_t server; uv_tcp_t server;
uv_init();
r = uv_tcp_init(uv_default_loop(), &server); r = uv_tcp_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_listen((uv_stream_t*)&server, 128, NULL); r = uv_listen((uv_stream_t*)&server, 128, NULL);

15
deps/uv/test/test-tcp-bind6-error.c

@ -39,9 +39,6 @@ TEST_IMPL(tcp_bind6_error_addrinuse) {
uv_tcp_t server1, server2; uv_tcp_t server1, server2;
int r; int r;
uv_init();
r = uv_tcp_init(uv_default_loop(), &server1); r = uv_tcp_init(uv_default_loop(), &server1);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_tcp_bind6(&server1, addr); r = uv_tcp_bind6(&server1, addr);
@ -75,9 +72,6 @@ TEST_IMPL(tcp_bind6_error_addrnotavail) {
uv_tcp_t server; uv_tcp_t server;
int r; int r;
uv_init();
r = uv_tcp_init(uv_default_loop(), &server); r = uv_tcp_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_tcp_bind6(&server, addr); r = uv_tcp_bind6(&server, addr);
@ -102,9 +96,6 @@ TEST_IMPL(tcp_bind6_error_fault) {
garbage_addr = (struct sockaddr_in6*) &garbage; garbage_addr = (struct sockaddr_in6*) &garbage;
uv_init();
r = uv_tcp_init(uv_default_loop(), &server); r = uv_tcp_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_tcp_bind6(&server, *garbage_addr); r = uv_tcp_bind6(&server, *garbage_addr);
@ -129,9 +120,6 @@ TEST_IMPL(tcp_bind6_error_inval) {
uv_tcp_t server; uv_tcp_t server;
int r; int r;
uv_init();
r = uv_tcp_init(uv_default_loop(), &server); r = uv_tcp_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_tcp_bind6(&server, addr1); r = uv_tcp_bind6(&server, addr1);
@ -157,9 +145,6 @@ TEST_IMPL(tcp_bind6_localhost_ok) {
uv_tcp_t server; uv_tcp_t server;
int r; int r;
uv_init();
r = uv_tcp_init(uv_default_loop(), &server); r = uv_tcp_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);
r = uv_tcp_bind6(&server, addr); r = uv_tcp_bind6(&server, addr);

3
deps/uv/test/test-tcp-writealot.c

@ -176,9 +176,6 @@ TEST_IMPL(tcp_writealot) {
ASSERT(send_buffer != NULL); ASSERT(send_buffer != NULL);
uv_init();
r = uv_tcp_init(uv_default_loop(), client); r = uv_tcp_init(uv_default_loop(), client);
ASSERT(r == 0); ASSERT(r == 0);

2
deps/uv/test/test-threadpool.c

@ -45,8 +45,6 @@ static void after_work_cb(uv_work_t* req) {
TEST_IMPL(threadpool_queue_work_simple) { TEST_IMPL(threadpool_queue_work_simple) {
int r; int r;
uv_init();
work_req.data = &data; work_req.data = &data;
r = uv_queue_work(uv_default_loop(), &work_req, work_cb, after_work_cb); r = uv_queue_work(uv_default_loop(), &work_req, work_cb, after_work_cb);
ASSERT(r == 0); ASSERT(r == 0);

3
deps/uv/test/test-timer-again.c

@ -95,9 +95,6 @@ static void repeat_2_cb(uv_timer_t* handle, int status) {
TEST_IMPL(timer_again) { TEST_IMPL(timer_again) {
int r; int r;
uv_init();
start_time = uv_now(uv_default_loop()); start_time = uv_now(uv_default_loop());
ASSERT(0 < start_time); ASSERT(0 < start_time);

2
deps/uv/test/test-timer.c

@ -90,8 +90,6 @@ TEST_IMPL(timer) {
uv_timer_t repeat, never; uv_timer_t repeat, never;
int i, r; int i, r;
uv_init();
start_time = uv_now(uv_default_loop()); start_time = uv_now(uv_default_loop());
ASSERT(0 < start_time); ASSERT(0 < start_time);

2
deps/uv/test/test-udp-dgram-too-big.c

@ -65,8 +65,6 @@ TEST_IMPL(udp_dgram_too_big) {
memset(dgram, 42, sizeof dgram); /* silence valgrind */ memset(dgram, 42, sizeof dgram); /* silence valgrind */
uv_init();
r = uv_udp_init(uv_default_loop(), &handle_); r = uv_udp_init(uv_default_loop(), &handle_);
ASSERT(r == 0); ASSERT(r == 0);

2
deps/uv/test/test-udp-ipv6.c

@ -100,8 +100,6 @@ static void do_test(uv_udp_recv_cb recv_cb, int bind_flags) {
uv_buf_t buf; uv_buf_t buf;
int r; int r;
uv_init();
addr6 = uv_ip6_addr("::0", TEST_PORT); addr6 = uv_ip6_addr("::0", TEST_PORT);
r = uv_udp_init(uv_default_loop(), &server); r = uv_udp_init(uv_default_loop(), &server);

2
deps/uv/test/test-udp-send-and-recv.c

@ -170,8 +170,6 @@ TEST_IMPL(udp_send_and_recv) {
addr = uv_ip4_addr("0.0.0.0", TEST_PORT); addr = uv_ip4_addr("0.0.0.0", TEST_PORT);
uv_init();
r = uv_udp_init(uv_default_loop(), &server); r = uv_udp_init(uv_default_loop(), &server);
ASSERT(r == 0); ASSERT(r == 0);

15
deps/uv/uv.gyp

@ -114,6 +114,7 @@
'src/win/stream.c', 'src/win/stream.c',
'src/win/tcp.c', 'src/win/tcp.c',
'src/win/threadpool.c', 'src/win/threadpool.c',
'src/win/threads.c',
'src/win/timer.c', 'src/win/timer.c',
'src/win/udp.c', 'src/win/udp.c',
'src/win/util.c', 'src/win/util.c',
@ -209,7 +210,19 @@
'libraries': [ '-lrt' ], 'libraries': [ '-lrt' ],
}, },
}], }],
# TODO add OS=='sun' [ 'OS=="solaris"', {
'include_dirs': [ 'src/ares/config_sunos' ],
'sources': [ 'src/unix/sunos.c' ],
'defines': [
'__EXTENSIONS__',
'_XOPEN_SOURCE=500',
'EV_CONFIG_H="config_sunos.h"',
'EIO_CONFIG_H="config_sunos.h"',
],
'direct_dependent_settings': {
'libraries': [ '-lrt' ],
},
}],
] ]
}, },

2
src/node.cc

@ -2506,8 +2506,6 @@ int Start(int argc, char *argv[]) {
pthread_win32_process_attach_np(); pthread_win32_process_attach_np();
#endif #endif
uv_init();
// This needs to run *before* V8::Initialize() // This needs to run *before* V8::Initialize()
argv = Init(argc, argv); argv = Init(argc, argv);

Loading…
Cancel
Save