summaryrefslogtreecommitdiff
path: root/deps/uv
diff options
context:
space:
mode:
Diffstat (limited to 'deps/uv')
-rw-r--r--deps/uv/LICENSE2
-rw-r--r--deps/uv/config-unix.mk3
-rw-r--r--deps/uv/include/uv-private/ngx-queue.h129
-rw-r--r--deps/uv/include/uv-private/uv-darwin.h4
-rw-r--r--deps/uv/include/uv-private/uv-linux.h2
-rw-r--r--deps/uv/include/uv-private/uv-unix.h48
-rw-r--r--deps/uv/include/uv-private/uv-win.h1
-rw-r--r--deps/uv/include/uv.h13
-rw-r--r--deps/uv/src/queue.h92
-rw-r--r--deps/uv/src/unix/async.c10
-rw-r--r--deps/uv/src/unix/core.c44
-rw-r--r--deps/uv/src/unix/darwin.c36
-rw-r--r--deps/uv/src/unix/fsevents.c32
-rw-r--r--deps/uv/src/unix/getaddrinfo.c60
-rw-r--r--deps/uv/src/unix/kqueue.c14
-rw-r--r--deps/uv/src/unix/linux-core.c14
-rw-r--r--deps/uv/src/unix/linux-inotify.c16
-rw-r--r--deps/uv/src/unix/loop-watcher.c10
-rw-r--r--deps/uv/src/unix/loop.c26
-rw-r--r--deps/uv/src/unix/pipe.c2
-rw-r--r--deps/uv/src/unix/process.c18
-rw-r--r--deps/uv/src/unix/signal.c6
-rw-r--r--deps/uv/src/unix/stream.c54
-rw-r--r--deps/uv/src/unix/sunos.c18
-rw-r--r--deps/uv/src/unix/tcp.c2
-rw-r--r--deps/uv/src/unix/threadpool.c48
-rw-r--r--deps/uv/src/unix/udp.c46
-rw-r--r--deps/uv/src/uv-common.c12
-rw-r--r--deps/uv/src/uv-common.h9
-rw-r--r--deps/uv/src/version.c6
-rw-r--r--deps/uv/src/win/core.c8
-rw-r--r--deps/uv/src/win/handle-inl.h2
-rw-r--r--deps/uv/test/test-getaddrinfo.c29
-rw-r--r--deps/uv/test/test-list.h2
-rw-r--r--deps/uv/test/test-threadpool-cancel.c4
-rw-r--r--deps/uv/uv.gyp2
36 files changed, 409 insertions, 415 deletions
diff --git a/deps/uv/LICENSE b/deps/uv/LICENSE
index 51c382cfb..4718e345f 100644
--- a/deps/uv/LICENSE
+++ b/deps/uv/LICENSE
@@ -31,8 +31,6 @@ The externally maintained libraries used by libuv are:
- tree.h (from FreeBSD), copyright Niels Provos. Two clause BSD license.
- - ngx_queue.h (from Nginx), copyright Igor Sysoev. Two clause BSD license.
-
- inet_pton and inet_ntop implementations, contained in src/inet.c, are
copyright the Internet Systems Consortium, Inc., and licensed under the ISC
license.
diff --git a/deps/uv/config-unix.mk b/deps/uv/config-unix.mk
index f9f2c15ed..caa3fb28c 100644
--- a/deps/uv/config-unix.mk
+++ b/deps/uv/config-unix.mk
@@ -145,7 +145,8 @@ include/uv-private/uv-unix.h: \
include/uv-private/uv-linux.h \
include/uv-private/uv-sunos.h
-src/unix/internal.h: src/unix/linux-syscalls.h
+src/unix/internal.h: src/unix/linux-syscalls.h src/uv-common.h
+src/uv-common.h: src/queue.h
src/.buildstamp src/unix/.buildstamp test/.buildstamp:
mkdir -p $(@D)
diff --git a/deps/uv/include/uv-private/ngx-queue.h b/deps/uv/include/uv-private/ngx-queue.h
deleted file mode 100644
index 3c3ed1b03..000000000
--- a/deps/uv/include/uv-private/ngx-queue.h
+++ /dev/null
@@ -1,129 +0,0 @@
-
-/*
- * Copyright (C) Igor Sysoev
- */
-
-
-#ifndef NGX_QUEUE_H_INCLUDED_
-#define NGX_QUEUE_H_INCLUDED_
-
-
-typedef struct ngx_queue_s ngx_queue_t;
-
-struct ngx_queue_s {
- ngx_queue_t *prev;
- ngx_queue_t *next;
-};
-
-
-#define ngx_queue_init(q) \
- do { \
- (q)->prev = q; \
- (q)->next = q; \
- } \
- while (0)
-
-
-#define ngx_queue_empty(h) \
- (h == (h)->prev)
-
-
-#define ngx_queue_insert_head(h, x) \
- do { \
- (x)->next = (h)->next; \
- (x)->next->prev = x; \
- (x)->prev = h; \
- (h)->next = x; \
- } \
- while (0)
-
-
-#define ngx_queue_insert_after ngx_queue_insert_head
-
-
-#define ngx_queue_insert_tail(h, x) \
- do { \
- (x)->prev = (h)->prev; \
- (x)->prev->next = x; \
- (x)->next = h; \
- (h)->prev = x; \
- } \
- while (0)
-
-
-#define ngx_queue_head(h) \
- (h)->next
-
-
-#define ngx_queue_last(h) \
- (h)->prev
-
-
-#define ngx_queue_sentinel(h) \
- (h)
-
-
-#define ngx_queue_next(q) \
- (q)->next
-
-
-#define ngx_queue_prev(q) \
- (q)->prev
-
-
-#if defined(NGX_DEBUG)
-
-#define ngx_queue_remove(x) \
- do { \
- (x)->next->prev = (x)->prev; \
- (x)->prev->next = (x)->next; \
- (x)->prev = NULL; \
- (x)->next = NULL; \
- } \
- while (0)
-
-#else
-
-#define ngx_queue_remove(x) \
- do { \
- (x)->next->prev = (x)->prev; \
- (x)->prev->next = (x)->next; \
- } \
- while (0)
-
-#endif
-
-
-#define ngx_queue_split(h, q, n) \
- do { \
- (n)->prev = (h)->prev; \
- (n)->prev->next = n; \
- (n)->next = q; \
- (h)->prev = (q)->prev; \
- (h)->prev->next = h; \
- (q)->prev = n; \
- } \
- while (0)
-
-
-#define ngx_queue_add(h, n) \
- do { \
- (h)->prev->next = (n)->next; \
- (n)->next->prev = (h)->prev; \
- (h)->prev = (n)->prev; \
- (h)->prev->next = h; \
- } \
- while (0)
-
-
-#define ngx_queue_data(q, type, link) \
- ((type *) ((unsigned char *) q - offsetof(type, link)))
-
-
-#define ngx_queue_foreach(q, h) \
- for ((q) = ngx_queue_head(h); \
- (q) != ngx_queue_sentinel(h) && !ngx_queue_empty(h); \
- (q) = ngx_queue_next(q))
-
-
-#endif /* NGX_QUEUE_H_INCLUDED_ */
diff --git a/deps/uv/include/uv-private/uv-darwin.h b/deps/uv/include/uv-private/uv-darwin.h
index e861cbab9..110115cd0 100644
--- a/deps/uv/include/uv-private/uv-darwin.h
+++ b/deps/uv/include/uv-private/uv-darwin.h
@@ -40,7 +40,7 @@
void* cf_loop; \
uv_mutex_t cf_mutex; \
uv_sem_t cf_sem; \
- ngx_queue_t cf_signals; \
+ void* cf_signals[2]; \
#define UV_PLATFORM_FS_EVENT_FIELDS \
uv__io_t event_watcher; \
@@ -49,7 +49,7 @@
int cf_flags; \
void* cf_eventstream; \
uv_async_t* cf_cb; \
- ngx_queue_t cf_events; \
+ void* cf_events[2]; \
uv_sem_t cf_sem; \
uv_mutex_t cf_mutex; \
diff --git a/deps/uv/include/uv-private/uv-linux.h b/deps/uv/include/uv-private/uv-linux.h
index 0d50123e3..9b38405a1 100644
--- a/deps/uv/include/uv-private/uv-linux.h
+++ b/deps/uv/include/uv-private/uv-linux.h
@@ -28,7 +28,7 @@
int inotify_fd; \
#define UV_PLATFORM_FS_EVENT_FIELDS \
- ngx_queue_t watchers; \
+ void* watchers[2]; \
int wd; \
#endif /* UV_LINUX_H */
diff --git a/deps/uv/include/uv-private/uv-unix.h b/deps/uv/include/uv-private/uv-unix.h
index 61f5d18b1..385c32a31 100644
--- a/deps/uv/include/uv-private/uv-unix.h
+++ b/deps/uv/include/uv-private/uv-unix.h
@@ -22,8 +22,6 @@
#ifndef UV_UNIX_H
#define UV_UNIX_H
-#include "ngx-queue.h"
-
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -72,8 +70,8 @@ typedef struct uv__io_s uv__io_t;
struct uv__io_s {
uv__io_cb cb;
- ngx_queue_t pending_queue;
- ngx_queue_t watcher_queue;
+ void* pending_queue[2];
+ void* watcher_queue[2];
unsigned int pevents; /* Pending event mask i.e. mask at next tick. */
unsigned int events; /* Current event mask. */
int fd;
@@ -94,7 +92,7 @@ struct uv__work {
void (*work)(struct uv__work *w);
void (*done)(struct uv__work *w, int status);
struct uv_loop_s* loop;
- ngx_queue_t wq;
+ void* wq[2];
};
#ifndef UV_PLATFORM_SEM_T
@@ -163,20 +161,20 @@ typedef struct {
#define UV_LOOP_PRIVATE_FIELDS \
unsigned long flags; \
int backend_fd; \
- ngx_queue_t pending_queue; \
- ngx_queue_t watcher_queue; \
+ void* pending_queue[2]; \
+ void* watcher_queue[2]; \
uv__io_t** watchers; \
unsigned int nwatchers; \
unsigned int nfds; \
- ngx_queue_t wq; \
+ void* wq[2]; \
uv_mutex_t wq_mutex; \
uv_async_t wq_async; \
uv_handle_t* closing_handles; \
- ngx_queue_t process_handles[1]; \
- ngx_queue_t prepare_handles; \
- ngx_queue_t check_handles; \
- ngx_queue_t idle_handles; \
- ngx_queue_t async_handles; \
+ void* process_handles[1][2]; \
+ void* prepare_handles[2]; \
+ void* check_handles[2]; \
+ void* idle_handles[2]; \
+ void* async_handles[2]; \
struct uv__async async_watcher; \
/* RB_HEAD(uv__timers, uv_timer_s) */ \
struct uv__timers { \
@@ -197,7 +195,7 @@ typedef struct {
#define UV_PRIVATE_REQ_TYPES /* empty */
#define UV_WRITE_PRIVATE_FIELDS \
- ngx_queue_t queue; \
+ void* queue[2]; \
int write_index; \
uv_buf_t* bufs; \
int bufcnt; \
@@ -205,12 +203,12 @@ typedef struct {
uv_buf_t bufsml[4]; \
#define UV_CONNECT_PRIVATE_FIELDS \
- ngx_queue_t queue; \
+ void* queue[2]; \
#define UV_SHUTDOWN_PRIVATE_FIELDS /* empty */
#define UV_UDP_SEND_PRIVATE_FIELDS \
- ngx_queue_t queue; \
+ void* queue[2]; \
struct sockaddr_in6 addr; \
int bufcnt; \
uv_buf_t* bufs; \
@@ -226,8 +224,8 @@ typedef struct {
uv_connect_t *connect_req; \
uv_shutdown_t *shutdown_req; \
uv__io_t io_watcher; \
- ngx_queue_t write_queue; \
- ngx_queue_t write_completed_queue; \
+ void* write_queue[2]; \
+ void* write_completed_queue[2]; \
uv_connection_cb connection_cb; \
int delayed_error; \
int accepted_fd; \
@@ -239,8 +237,8 @@ typedef struct {
uv_alloc_cb alloc_cb; \
uv_udp_recv_cb recv_cb; \
uv__io_t io_watcher; \
- ngx_queue_t write_queue; \
- ngx_queue_t write_completed_queue; \
+ void* write_queue[2]; \
+ void* write_completed_queue[2]; \
#define UV_PIPE_PRIVATE_FIELDS \
const char* pipe_fname; /* strdup'ed */
@@ -250,19 +248,19 @@ typedef struct {
#define UV_PREPARE_PRIVATE_FIELDS \
uv_prepare_cb prepare_cb; \
- ngx_queue_t queue;
+ void* queue[2]; \
#define UV_CHECK_PRIVATE_FIELDS \
uv_check_cb check_cb; \
- ngx_queue_t queue;
+ void* queue[2]; \
#define UV_IDLE_PRIVATE_FIELDS \
uv_idle_cb idle_cb; \
- ngx_queue_t queue;
+ void* queue[2]; \
#define UV_ASYNC_PRIVATE_FIELDS \
uv_async_cb async_cb; \
- ngx_queue_t queue; \
+ void* queue[2]; \
int pending; \
#define UV_TIMER_PRIVATE_FIELDS \
@@ -288,7 +286,7 @@ typedef struct {
int retcode;
#define UV_PROCESS_PRIVATE_FIELDS \
- ngx_queue_t queue; \
+ void* queue[2]; \
int errorno; \
#define UV_FS_PRIVATE_FIELDS \
diff --git a/deps/uv/include/uv-private/uv-win.h b/deps/uv/include/uv-private/uv-win.h
index b1c4179c8..4f0b7b1aa 100644
--- a/deps/uv/include/uv-private/uv-win.h
+++ b/deps/uv/include/uv-private/uv-win.h
@@ -45,7 +45,6 @@ typedef intptr_t ssize_t;
#endif
#include "tree.h"
-#include "ngx-queue.h"
#define MAX_PIPENAME_LEN 256
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
index 454783ff2..39db4f499 100644
--- a/deps/uv/include/uv.h
+++ b/deps/uv/include/uv.h
@@ -45,11 +45,6 @@ extern "C" {
# define UV_EXTERN /* nothing */
#endif
-
-#define UV_VERSION_MAJOR 0
-#define UV_VERSION_MINOR 10
-
-
#if defined(_MSC_VER) && _MSC_VER < 1600
# include "uv-private/stdint-msvc2008.h"
#else
@@ -434,7 +429,7 @@ UV_EXTERN const char* uv_err_name(uv_err_t err);
/* read-only */ \
uv_req_type type; \
/* private */ \
- ngx_queue_t active_queue; \
+ void* active_queue[2]; \
UV_REQ_PRIVATE_FIELDS \
/* Abstract base class of all requests. */
@@ -474,7 +469,7 @@ struct uv_shutdown_s {
uv_loop_t* loop; \
uv_handle_type type; \
/* private */ \
- ngx_queue_t handle_queue; \
+ void* handle_queue[2]; \
UV_HANDLE_PRIVATE_FIELDS \
/* The abstract base class of all handles. */
@@ -1958,8 +1953,8 @@ struct uv_loop_s {
uv_err_t last_err;
/* Loop reference counting */
unsigned int active_handles;
- ngx_queue_t handle_queue;
- ngx_queue_t active_reqs;
+ void* handle_queue[2];
+ void* active_reqs[2];
/* Internal flag to signal loop stop */
unsigned int stop_flag;
UV_LOOP_PRIVATE_FIELDS
diff --git a/deps/uv/src/queue.h b/deps/uv/src/queue.h
new file mode 100644
index 000000000..a88ce9a47
--- /dev/null
+++ b/deps/uv/src/queue.h
@@ -0,0 +1,92 @@
+/* Copyright (c) 2013, Ben Noordhuis <info@bnoordhuis.nl>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef QUEUE_H_
+#define QUEUE_H_
+
+typedef void *QUEUE[2];
+
+/* Private macros. */
+#define QUEUE_NEXT(q) ((*(q))[0])
+#define QUEUE_PREV(q) ((*(q))[1])
+#define QUEUE_PREV_NEXT(q) (QUEUE_NEXT((QUEUE *) QUEUE_PREV(q)))
+#define QUEUE_NEXT_PREV(q) (QUEUE_PREV((QUEUE *) QUEUE_NEXT(q)))
+
+/* Public macros. */
+#define QUEUE_DATA(ptr, type, field) \
+ ((type *) ((char *) (ptr) - ((long) &((type *) 0)->field)))
+
+#define QUEUE_FOREACH(q, h) \
+ for ((q) = (*(h))[0]; (q) != (h); (q) = (*(q))[0])
+
+#define QUEUE_EMPTY(q) \
+ (QUEUE_NEXT(q) == (q))
+
+#define QUEUE_HEAD(q) \
+ (QUEUE_NEXT(q))
+
+#define QUEUE_INIT(q) \
+ do { \
+ QUEUE_NEXT(q) = (q); \
+ QUEUE_PREV(q) = (q); \
+ } \
+ while (0)
+
+#define QUEUE_ADD(h, n) \
+ do { \
+ QUEUE_PREV_NEXT(h) = QUEUE_NEXT(n); \
+ QUEUE_NEXT_PREV(n) = QUEUE_PREV(h); \
+ QUEUE_PREV(h) = QUEUE_PREV(n); \
+ QUEUE_PREV_NEXT(h) = (h); \
+ } \
+ while (0)
+
+#define QUEUE_SPLIT(h, q, n) \
+ do { \
+ QUEUE_PREV(n) = QUEUE_PREV(h); \
+ QUEUE_PREV_NEXT(n) = (n); \
+ QUEUE_NEXT(n) = (q); \
+ QUEUE_PREV(h) = QUEUE_PREV(q); \
+ QUEUE_PREV_NEXT(h) = (h); \
+ QUEUE_PREV(q) = (n); \
+ } \
+ while (0)
+
+#define QUEUE_INSERT_HEAD(h, q) \
+ do { \
+ QUEUE_NEXT(q) = QUEUE_NEXT(h); \
+ QUEUE_PREV(q) = (h); \
+ QUEUE_NEXT_PREV(q) = (q); \
+ QUEUE_NEXT(h) = (q); \
+ } \
+ while (0)
+
+#define QUEUE_INSERT_TAIL(h, q) \
+ do { \
+ QUEUE_NEXT(q) = (h); \
+ QUEUE_PREV(q) = QUEUE_PREV(h); \
+ QUEUE_PREV_NEXT(q) = (q); \
+ QUEUE_PREV(h) = (q); \
+ } \
+ while (0)
+
+#define QUEUE_REMOVE(q) \
+ do { \
+ QUEUE_PREV_NEXT(q) = QUEUE_NEXT(q); \
+ QUEUE_NEXT_PREV(q) = QUEUE_PREV(q); \
+ } \
+ while (0)
+
+#endif /* QUEUE_H_ */
diff --git a/deps/uv/src/unix/async.c b/deps/uv/src/unix/async.c
index 43f54ed4b..68d1a1ed1 100644
--- a/deps/uv/src/unix/async.c
+++ b/deps/uv/src/unix/async.c
@@ -46,7 +46,7 @@ int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) {
handle->async_cb = async_cb;
handle->pending = 0;
- ngx_queue_insert_tail(&loop->async_handles, &handle->queue);
+ QUEUE_INSERT_TAIL(&loop->async_handles, &handle->queue);
uv__handle_start(handle);
return 0;
@@ -62,7 +62,7 @@ int uv_async_send(uv_async_t* handle) {
void uv__async_close(uv_async_t* handle) {
- ngx_queue_remove(&handle->queue);
+ QUEUE_REMOVE(&handle->queue);
uv__handle_stop(handle);
}
@@ -70,11 +70,11 @@ void uv__async_close(uv_async_t* handle) {
static void uv__async_event(uv_loop_t* loop,
struct uv__async* w,
unsigned int nevents) {
- ngx_queue_t* q;
+ QUEUE* q;
uv_async_t* h;
- ngx_queue_foreach(q, &loop->async_handles) {
- h = ngx_queue_data(q, uv_async_t, queue);
+ QUEUE_FOREACH(q, &loop->async_handles) {
+ h = QUEUE_DATA(q, uv_async_t, queue);
if (!h->pending) continue;
h->pending = 0;
h->async_cb(h, 0);
diff --git a/deps/uv/src/unix/core.c b/deps/uv/src/unix/core.c
index 9b471ec7e..3854cd8ec 100644
--- a/deps/uv/src/unix/core.c
+++ b/deps/uv/src/unix/core.c
@@ -198,7 +198,7 @@ static void uv__finish_close(uv_handle_t* handle) {
}
uv__handle_unref(handle);
- ngx_queue_remove(&handle->handle_queue);
+ QUEUE_REMOVE(&handle->handle_queue);
if (handle->close_cb) {
handle->close_cb(handle);
@@ -276,7 +276,7 @@ int uv_backend_timeout(const uv_loop_t* loop) {
if (!uv__has_active_handles(loop) && !uv__has_active_reqs(loop))
return 0;
- if (!ngx_queue_empty(&loop->idle_handles))
+ if (!QUEUE_EMPTY(&loop->idle_handles))
return 0;
if (loop->closing_handles)
@@ -566,15 +566,15 @@ void uv_disable_stdio_inheritance(void) {
static void uv__run_pending(uv_loop_t* loop) {
- ngx_queue_t* q;
+ QUEUE* q;
uv__io_t* w;
- while (!ngx_queue_empty(&loop->pending_queue)) {
- q = ngx_queue_head(&loop->pending_queue);
- ngx_queue_remove(q);
- ngx_queue_init(q);
+ while (!QUEUE_EMPTY(&loop->pending_queue)) {
+ q = QUEUE_HEAD(&loop->pending_queue);
+ QUEUE_REMOVE(q);
+ QUEUE_INIT(q);
- w = ngx_queue_data(q, uv__io_t, pending_queue);
+ w = QUEUE_DATA(q, uv__io_t, pending_queue);
w->cb(loop, w, UV__POLLOUT);
}
}
@@ -616,8 +616,8 @@ static void maybe_resize(uv_loop_t* loop, unsigned int len) {
void uv__io_init(uv__io_t* w, uv__io_cb cb, int fd) {
assert(cb != NULL);
assert(fd >= -1);
- ngx_queue_init(&w->pending_queue);
- ngx_queue_init(&w->watcher_queue);
+ QUEUE_INIT(&w->pending_queue);
+ QUEUE_INIT(&w->watcher_queue);
w->cb = cb;
w->fd = fd;
w->events = 0;
@@ -645,16 +645,16 @@ void uv__io_start(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
* short-circuit here if the event mask is unchanged.
*/
if (w->events == w->pevents) {
- if (w->events == 0 && !ngx_queue_empty(&w->watcher_queue)) {
- ngx_queue_remove(&w->watcher_queue);
- ngx_queue_init(&w->watcher_queue);
+ if (w->events == 0 && !QUEUE_EMPTY(&w->watcher_queue)) {
+ QUEUE_REMOVE(&w->watcher_queue);
+ QUEUE_INIT(&w->watcher_queue);
}
return;
}
#endif
- if (ngx_queue_empty(&w->watcher_queue))
- ngx_queue_insert_tail(&loop->watcher_queue, &w->watcher_queue);
+ if (QUEUE_EMPTY(&w->watcher_queue))
+ QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue);
if (loop->watchers[w->fd] == NULL) {
loop->watchers[w->fd] = w;
@@ -679,8 +679,8 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
w->pevents &= ~events;
if (w->pevents == 0) {
- ngx_queue_remove(&w->watcher_queue);
- ngx_queue_init(&w->watcher_queue);
+ QUEUE_REMOVE(&w->watcher_queue);
+ QUEUE_INIT(&w->watcher_queue);
if (loop->watchers[w->fd] != NULL) {
assert(loop->watchers[w->fd] == w);
@@ -690,20 +690,20 @@ void uv__io_stop(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
w->events = 0;
}
}
- else if (ngx_queue_empty(&w->watcher_queue))
- ngx_queue_insert_tail(&loop->watcher_queue, &w->watcher_queue);
+ else if (QUEUE_EMPTY(&w->watcher_queue))
+ QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue);
}
void uv__io_close(uv_loop_t* loop, uv__io_t* w) {
uv__io_stop(loop, w, UV__POLLIN | UV__POLLOUT);
- ngx_queue_remove(&w->pending_queue);
+ QUEUE_REMOVE(&w->pending_queue);
}
void uv__io_feed(uv_loop_t* loop, uv__io_t* w) {
- if (ngx_queue_empty(&w->pending_queue))
- ngx_queue_insert_tail(&loop->pending_queue, &w->pending_queue);
+ if (QUEUE_EMPTY(&w->pending_queue))
+ QUEUE_INSERT_TAIL(&loop->pending_queue, &w->pending_queue);
}
diff --git a/deps/uv/src/unix/darwin.c b/deps/uv/src/unix/darwin.c
index cfbfed23f..85a1d9ad2 100644
--- a/deps/uv/src/unix/darwin.c
+++ b/deps/uv/src/unix/darwin.c
@@ -45,7 +45,7 @@ typedef struct uv__cf_loop_signal_s uv__cf_loop_signal_t;
struct uv__cf_loop_signal_s {
void* arg;
cf_loop_signal_cb cb;
- ngx_queue_t member;
+ QUEUE member;
};
@@ -61,7 +61,7 @@ int uv__platform_loop_init(uv_loop_t* loop, int default_loop) {
return r;
if ((r = uv_sem_init(&loop->cf_sem, 0)))
return r;
- ngx_queue_init(&loop->cf_signals);
+ QUEUE_INIT(&loop->cf_signals);
memset(&ctx, 0, sizeof(ctx));
ctx.info = loop;
@@ -80,7 +80,7 @@ int uv__platform_loop_init(uv_loop_t* loop, int default_loop) {
void uv__platform_loop_delete(uv_loop_t* loop) {
- ngx_queue_t* item;
+ QUEUE* item;
uv__cf_loop_signal_t* s;
assert(loop->cf_loop != NULL);
@@ -92,12 +92,12 @@ void uv__platform_loop_delete(uv_loop_t* loop) {
uv_mutex_destroy(&loop->cf_mutex);
/* Free any remaining data */
- while (!ngx_queue_empty(&loop->cf_signals)) {
- item = ngx_queue_head(&loop->cf_signals);
+ while (!QUEUE_EMPTY(&loop->cf_signals)) {
+ item = QUEUE_HEAD(&loop->cf_signals);
- s = ngx_queue_data(item, uv__cf_loop_signal_t, member);
+ s = QUEUE_DATA(item, uv__cf_loop_signal_t, member);
- ngx_queue_remove(item);
+ QUEUE_REMOVE(item);
free(s);
}
}
@@ -127,27 +127,27 @@ void uv__cf_loop_runner(void* arg) {
void uv__cf_loop_cb(void* arg) {
uv_loop_t* loop;
- ngx_queue_t* item;
- ngx_queue_t split_head;
+ QUEUE* item;
+ QUEUE split_head;
uv__cf_loop_signal_t* s;
loop = arg;
uv_mutex_lock(&loop->cf_mutex);
- ngx_queue_init(&split_head);
- if (!ngx_queue_empty(&loop->cf_signals)) {
- ngx_queue_t* split_pos = ngx_queue_next(&loop->cf_signals);
- ngx_queue_split(&loop->cf_signals, split_pos, &split_head);
+ QUEUE_INIT(&split_head);
+ if (!QUEUE_EMPTY(&loop->cf_signals)) {
+ QUEUE* split_pos = QUEUE_HEAD(&loop->cf_signals);
+ QUEUE_SPLIT(&loop->cf_signals, split_pos, &split_head);
}
uv_mutex_unlock(&loop->cf_mutex);
- while (!ngx_queue_empty(&split_head)) {
- item = ngx_queue_head(&split_head);
+ while (!QUEUE_EMPTY(&split_head)) {
+ item = QUEUE_HEAD(&split_head);
- s = ngx_queue_data(item, uv__cf_loop_signal_t, member);
+ s = QUEUE_DATA(item, uv__cf_loop_signal_t, member);
s->cb(s->arg);
- ngx_queue_remove(item);
+ QUEUE_REMOVE(item);
free(s);
}
}
@@ -165,7 +165,7 @@ void uv__cf_loop_signal(uv_loop_t* loop, cf_loop_signal_cb cb, void* arg) {
item->cb = cb;
uv_mutex_lock(&loop->cf_mutex);
- ngx_queue_insert_tail(&loop->cf_signals, &item->member);
+ QUEUE_INSERT_TAIL(&loop->cf_signals, &item->member);
uv_mutex_unlock(&loop->cf_mutex);
assert(loop->cf_loop != NULL);
diff --git a/deps/uv/src/unix/fsevents.c b/deps/uv/src/unix/fsevents.c
index b6d274675..e33015d32 100644
--- a/deps/uv/src/unix/fsevents.c
+++ b/deps/uv/src/unix/fsevents.c
@@ -44,28 +44,28 @@ typedef struct uv__fsevents_event_s uv__fsevents_event_t;
struct uv__fsevents_event_s {
int events;
- ngx_queue_t member;
+ QUEUE member;
char path[1];
};
#define UV__FSEVENTS_WALK(handle, block) \
{ \
- ngx_queue_t* curr; \
- ngx_queue_t split_head; \
+ QUEUE* curr; \
+ QUEUE split_head; \
uv__fsevents_event_t* event; \
uv_mutex_lock(&(handle)->cf_mutex); \
- ngx_queue_init(&split_head); \
- if (!ngx_queue_empty(&(handle)->cf_events)) { \
- ngx_queue_t* split_pos = ngx_queue_next(&(handle)->cf_events); \
- ngx_queue_split(&(handle)->cf_events, split_pos, &split_head); \
+ QUEUE_INIT(&split_head); \
+ if (!QUEUE_EMPTY(&(handle)->cf_events)) { \
+ QUEUE* split_pos = QUEUE_HEAD(&(handle)->cf_events); \
+ QUEUE_SPLIT(&(handle)->cf_events, split_pos, &split_head); \
} \
uv_mutex_unlock(&(handle)->cf_mutex); \
- while (!ngx_queue_empty(&split_head)) { \
- curr = ngx_queue_head(&split_head); \
+ while (!QUEUE_EMPTY(&split_head)) { \
+ curr = QUEUE_HEAD(&split_head); \
/* Invoke callback */ \
- event = ngx_queue_data(curr, uv__fsevents_event_t, member); \
- ngx_queue_remove(curr); \
+ event = QUEUE_DATA(curr, uv__fsevents_event_t, member); \
+ QUEUE_REMOVE(curr); \
/* Invoke block code, but only if handle wasn't closed */ \
if (((handle)->flags & (UV_CLOSING | UV_CLOSED)) == 0) \
block \
@@ -105,7 +105,7 @@ void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef,
char* pos;
uv_fs_event_t* handle;
uv__fsevents_event_t* event;
- ngx_queue_t add_list;
+ QUEUE add_list;
int kFSEventsModified;
int kFSEventsRenamed;
@@ -120,7 +120,7 @@ void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef,
handle = info;
paths = eventPaths;
- ngx_queue_init(&add_list);
+ QUEUE_INIT(&add_list);
for (i = 0; i < numEvents; i++) {
/* Ignore system events */
@@ -180,10 +180,10 @@ void uv__fsevents_event_cb(ConstFSEventStreamRef streamRef,
else
event->events = UV_RENAME;
- ngx_queue_insert_tail(&add_list, &event->member);
+ QUEUE_INSERT_TAIL(&add_list, &event->member);
}
uv_mutex_lock(&handle->cf_mutex);
- ngx_queue_add(&handle->cf_events, &add_list);
+ QUEUE_ADD(&handle->cf_events, &add_list);
uv_mutex_unlock(&handle->cf_mutex);
uv_async_send(handle->cf_cb);
@@ -257,7 +257,7 @@ int uv__fsevents_init(uv_fs_event_t* handle) {
uv_mutex_init(&handle->cf_mutex);
uv_sem_init(&handle->cf_sem, 0);
- ngx_queue_init(&handle->cf_events);
+ QUEUE_INIT(&handle->cf_events);
uv__cf_loop_signal(handle->loop, uv__fsevents_schedule, handle);
diff --git a/deps/uv/src/unix/getaddrinfo.c b/deps/uv/src/unix/getaddrinfo.c
index 283d295f5..0e50faa02 100644
--- a/deps/uv/src/unix/getaddrinfo.c
+++ b/deps/uv/src/unix/getaddrinfo.c
@@ -38,22 +38,24 @@ static void uv__getaddrinfo_work(struct uv__work* w) {
static void uv__getaddrinfo_done(struct uv__work* w, int status) {
- uv_getaddrinfo_t* req = container_of(w, uv_getaddrinfo_t, work_req);
- struct addrinfo *res = req->res;
-#if defined(__sun)
+ uv_getaddrinfo_t* req;
+ struct addrinfo *res;
size_t hostlen;
- if (req->hostname)
- hostlen = strlen(req->hostname);
- else
- hostlen = 0;
-#endif
+ req = container_of(w, uv_getaddrinfo_t, work_req);
+ uv__req_unregister(req->loop, req);
+ res = req->res;
req->res = NULL;
- uv__req_unregister(req->loop, req);
+ (void) &hostlen; /* Silence unused variable warning. */
+ hostlen = 0;
+#if defined(__sun)
+ if (req->hostname != NULL)
+ hostlen = strlen(req->hostname);
+#endif
- /* see initialization in uv_getaddrinfo() */
+ /* See initialization in uv_getaddrinfo(). */
if (req->hints)
free(req->hints);
else if (req->service)
@@ -67,30 +69,34 @@ static void uv__getaddrinfo_done(struct uv__work* w, int status) {
req->service = NULL;
req->hostname = NULL;
+ if (status == -UV_ECANCELED) {
+ assert(req->retcode == 0);
+ req->retcode = UV_ECANCELED;
+ uv__set_artificial_error(req->loop, UV_ECANCELED);
+ req->cb(req, -1, NULL);
+ return;
+ }
+
if (req->retcode == 0) {
- /* OK */
-#if defined(EAI_NODATA) /* FreeBSD deprecated EAI_NODATA */
- } else if (req->retcode == EAI_NONAME || req->retcode == EAI_NODATA) {
-#else
- } else if (req->retcode == EAI_NONAME) {
-#endif
- uv__set_sys_error(req->loop, ENOENT); /* FIXME compatibility hack */
-#if defined(__sun)
- } else if (req->retcode == EAI_MEMORY && hostlen >= MAXHOSTNAMELEN) {
+ req->cb(req, 0, res);
+ return;
+ }
+
+ if (req->retcode == EAI_NONAME)
+ uv__set_sys_error(req->loop, ENOENT);
+#if defined(EAI_NODATA) /* Newer FreeBSDs don't have EAI_NODATA. */
+ else if (req->retcode == EAI_NODATA)
+ uv__set_sys_error(req->loop, ENOENT);
+#elif defined(__sun)
+ if (req->retcode == EAI_MEMORY && hostlen >= MAXHOSTNAMELEN) {
uv__set_sys_error(req->loop, ENOENT);
#endif
- } else {
+ else {
req->loop->last_err.code = UV_EADDRINFO;
req->loop->last_err.sys_errno_ = req->retcode;
}
- if (status == -UV_ECANCELED) {
- assert(req->retcode == 0);
- req->retcode = UV_ECANCELED;
- uv__set_artificial_error(req->loop, UV_ECANCELED);
- }
-
- req->cb(req, req->retcode, res);
+ req->cb(req, -1, res);
}
diff --git a/deps/uv/src/unix/kqueue.c b/deps/uv/src/unix/kqueue.c
index 378903a62..9ad06da4c 100644
--- a/deps/uv/src/unix/kqueue.c
+++ b/deps/uv/src/unix/kqueue.c
@@ -55,7 +55,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
struct timespec spec;
unsigned int nevents;
unsigned int revents;
- ngx_queue_t* q;
+ QUEUE* q;
uint64_t base;
uint64_t diff;
uv__io_t* w;
@@ -68,18 +68,18 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
int i;
if (loop->nfds == 0) {
- assert(ngx_queue_empty(&loop->watcher_queue));
+ assert(QUEUE_EMPTY(&loop->watcher_queue));
return;
}
nevents = 0;
- while (!ngx_queue_empty(&loop->watcher_queue)) {
- q = ngx_queue_head(&loop->watcher_queue);
- ngx_queue_remove(q);
- ngx_queue_init(q);
+ while (!QUEUE_EMPTY(&loop->watcher_queue)) {
+ q = QUEUE_HEAD(&loop->watcher_queue);
+ QUEUE_REMOVE(q);
+ QUEUE_INIT(q);
- w = ngx_queue_data(q, uv__io_t, watcher_queue);
+ w = QUEUE_DATA(q, uv__io_t, watcher_queue);
assert(w->pevents != 0);
assert(w->fd >= 0);
assert(w->fd < (int) loop->nwatchers);
diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c
index daab6f196..23a597727 100644
--- a/deps/uv/src/unix/linux-core.c
+++ b/deps/uv/src/unix/linux-core.c
@@ -101,7 +101,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
struct uv__epoll_event events[1024];
struct uv__epoll_event* pe;
struct uv__epoll_event e;
- ngx_queue_t* q;
+ QUEUE* q;
uv__io_t* w;
uint64_t base;
uint64_t diff;
@@ -113,16 +113,16 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
int i;
if (loop->nfds == 0) {
- assert(ngx_queue_empty(&loop->watcher_queue));
+ assert(QUEUE_EMPTY(&loop->watcher_queue));
return;
}
- while (!ngx_queue_empty(&loop->watcher_queue)) {
- q = ngx_queue_head(&loop->watcher_queue);
- ngx_queue_remove(q);
- ngx_queue_init(q);
+ while (!QUEUE_EMPTY(&loop->watcher_queue)) {
+ q = QUEUE_HEAD(&loop->watcher_queue);
+ QUEUE_REMOVE(q);
+ QUEUE_INIT(q);
- w = ngx_queue_data(q, uv__io_t, watcher_queue);
+ w = QUEUE_DATA(q, uv__io_t, watcher_queue);
assert(w->pevents != 0);
assert(w->fd >= 0);
assert(w->fd < (int) loop->nwatchers);
diff --git a/deps/uv/src/unix/linux-inotify.c b/deps/uv/src/unix/linux-inotify.c
index 108345aa8..76b9dfa45 100644
--- a/deps/uv/src/unix/linux-inotify.c
+++ b/deps/uv/src/unix/linux-inotify.c
@@ -34,7 +34,7 @@
struct watcher_list {
RB_ENTRY(watcher_list) entry;
- ngx_queue_t watchers;
+ QUEUE watchers;
char* path;
int wd;
};
@@ -119,7 +119,7 @@ static void uv__inotify_read(uv_loop_t* loop,
const struct uv__inotify_event* e;
struct watcher_list* w;
uv_fs_event_t* h;
- ngx_queue_t* q;
+ QUEUE* q;
const char* path;
ssize_t size;
const char *p;
@@ -158,8 +158,8 @@ static void uv__inotify_read(uv_loop_t* loop,
*/
path = e->len ? (const char*) (e + 1) : basename_r(w->path);
- ngx_queue_foreach(q, &w->watchers) {
- h = ngx_queue_data(q, uv_fs_event_t, watchers);
+ QUEUE_FOREACH(q, &w->watchers) {
+ h = QUEUE_DATA(q, uv_fs_event_t, watchers);
h->cb(h, path, events, 0);
}
}
@@ -201,13 +201,13 @@ int uv_fs_event_init(uv_loop_t* loop,
w->wd = wd;
w->path = strcpy((char*)(w + 1), path);
- ngx_queue_init(&w->watchers);
+ QUEUE_INIT(&w->watchers);
RB_INSERT(watcher_root, CAST(&loop->inotify_watchers), w);
no_insert:
uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT);
uv__handle_start(handle); /* FIXME shouldn't start automatically */
- ngx_queue_insert_tail(&w->watchers, &handle->watchers);
+ QUEUE_INSERT_TAIL(&w->watchers, &handle->watchers);
handle->filename = w->path;
handle->cb = cb;
handle->wd = wd;
@@ -225,9 +225,9 @@ void uv__fs_event_close(uv_fs_event_t* handle) {
handle->wd = -1;
handle->filename = NULL;
uv__handle_stop(handle);
- ngx_queue_remove(&handle->watchers);
+ QUEUE_REMOVE(&handle->watchers);
- if (ngx_queue_empty(&w->watchers)) {
+ if (QUEUE_EMPTY(&w->watchers)) {
/* No watchers left for this path. Clean up. */
RB_REMOVE(watcher_root, CAST(&handle->loop->inotify_watchers), w);
uv__inotify_rm_watch(handle->loop->inotify_fd, w->wd);
diff --git a/deps/uv/src/unix/loop-watcher.c b/deps/uv/src/unix/loop-watcher.c
index a07569e40..4681beb61 100644
--- a/deps/uv/src/unix/loop-watcher.c
+++ b/deps/uv/src/unix/loop-watcher.c
@@ -33,7 +33,7 @@
if (uv__is_active(handle)) return 0; \
if (cb == NULL) \
return uv__set_artificial_error(handle->loop, UV_EINVAL); \
- ngx_queue_insert_head(&handle->loop->name##_handles, &handle->queue); \
+ QUEUE_INSERT_HEAD(&handle->loop->name##_handles, &handle->queue); \
handle->name##_cb = cb; \
uv__handle_start(handle); \
return 0; \
@@ -41,16 +41,16 @@
\
int uv_##name##_stop(uv_##name##_t* handle) { \
if (!uv__is_active(handle)) return 0; \
- ngx_queue_remove(&handle->queue); \
+ QUEUE_REMOVE(&handle->queue); \
uv__handle_stop(handle); \
return 0; \
} \
\
void uv__run_##name(uv_loop_t* loop) { \
uv_##name##_t* h; \
- ngx_queue_t* q; \
- ngx_queue_foreach(q, &loop->name##_handles) { \
- h = ngx_queue_data(q, uv_##name##_t, queue); \
+ QUEUE* q; \
+ QUEUE_FOREACH(q, &loop->name##_handles) { \
+ h = QUEUE_DATA(q, uv_##name##_t, queue); \
h->name##_cb(h, 0); \
} \
} \
diff --git a/deps/uv/src/unix/loop.c b/deps/uv/src/unix/loop.c
index 75b0702a3..a28cd280a 100644
--- a/deps/uv/src/unix/loop.c
+++ b/deps/uv/src/unix/loop.c
@@ -34,19 +34,19 @@ int uv__loop_init(uv_loop_t* loop, int default_loop) {
memset(loop, 0, sizeof(*loop));
RB_INIT(&loop->timer_handles);
- ngx_queue_init(&loop->wq);
- ngx_queue_init(&loop->active_reqs);
- ngx_queue_init(&loop->idle_handles);
- ngx_queue_init(&loop->async_handles);
- ngx_queue_init(&loop->check_handles);
- ngx_queue_init(&loop->prepare_handles);
- ngx_queue_init(&loop->handle_queue);
+ QUEUE_INIT(&loop->wq);
+ QUEUE_INIT(&loop->active_reqs);
+ QUEUE_INIT(&loop->idle_handles);
+ QUEUE_INIT(&loop->async_handles);
+ QUEUE_INIT(&loop->check_handles);
+ QUEUE_INIT(&loop->prepare_handles);
+ QUEUE_INIT(&loop->handle_queue);
loop->nfds = 0;
loop->watchers = NULL;
loop->nwatchers = 0;
- ngx_queue_init(&loop->pending_queue);
- ngx_queue_init(&loop->watcher_queue);
+ QUEUE_INIT(&loop->pending_queue);
+ QUEUE_INIT(&loop->watcher_queue);
loop->closing_handles = NULL;
loop->time = uv__hrtime() / 1000000;
@@ -67,7 +67,7 @@ int uv__loop_init(uv_loop_t* loop, int default_loop) {
loop->child_watcher.flags |= UV__HANDLE_INTERNAL;
for (i = 0; i < ARRAY_SIZE(loop->process_handles); i++)
- ngx_queue_init(loop->process_handles + i);
+ QUEUE_INIT(loop->process_handles + i);
if (uv_mutex_init(&loop->wq_mutex))
abort();
@@ -98,13 +98,13 @@ void uv__loop_delete(uv_loop_t* loop) {
}
uv_mutex_lock(&loop->wq_mutex);
- assert(ngx_queue_empty(&loop->wq) && "thread pool work queue not empty!");
+ assert(QUEUE_EMPTY(&loop->wq) && "thread pool work queue not empty!");
uv_mutex_unlock(&loop->wq_mutex);
uv_mutex_destroy(&loop->wq_mutex);
#if 0
- assert(ngx_queue_empty(&loop->pending_queue));
- assert(ngx_queue_empty(&loop->watcher_queue));
+ assert(QUEUE_EMPTY(&loop->pending_queue));
+ assert(QUEUE_EMPTY(&loop->watcher_queue));
assert(loop->nfds == 0);
#endif
diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c
index 4b7f966bc..a6145790a 100644
--- a/deps/uv/src/unix/pipe.c
+++ b/deps/uv/src/unix/pipe.c
@@ -214,7 +214,7 @@ out:
uv__req_init(handle->loop, req, UV_CONNECT);
req->handle = (uv_stream_t*)handle;
req->cb = cb;
- ngx_queue_init(&req->queue);
+ QUEUE_INIT(&req->queue);
/* Force callback to run on next tick in case of error. */
if (err != 0)
diff --git a/deps/uv/src/unix/process.c b/deps/uv/src/unix/process.c
index 267ecb64c..008c032f0 100644
--- a/deps/uv/src/unix/process.c
+++ b/deps/uv/src/unix/process.c
@@ -41,7 +41,7 @@ extern char **environ;
#endif
-static ngx_queue_t* uv__process_queue(uv_loop_t* loop, int pid) {
+static QUEUE* uv__process_queue(uv_loop_t* loop, int pid) {
assert(pid > 0);
return loop->process_handles + pid % ARRAY_SIZE(loop->process_handles);
}
@@ -49,13 +49,13 @@ static ngx_queue_t* uv__process_queue(uv_loop_t* loop, int pid) {
static uv_process_t* uv__process_find(uv_loop_t* loop, int pid) {
uv_process_t* handle;
- ngx_queue_t* h;
- ngx_queue_t* q;
+ QUEUE* h;
+ QUEUE* q;
h = uv__process_queue(loop, pid);
- ngx_queue_foreach(q, h) {
- handle = ngx_queue_data(q, uv_process_t, queue);
+ QUEUE_FOREACH(q, h) {
+ handle = QUEUE_DATA(q, uv_process_t, queue);
if (handle->pid == pid) return handle;
}
@@ -351,7 +351,7 @@ int uv_spawn(uv_loop_t* loop,
int signal_pipe[2] = { -1, -1 };
int (*pipes)[2];
int stdio_count;
- ngx_queue_t* q;
+ QUEUE* q;
ssize_t r;
pid_t pid;
int i;
@@ -364,7 +364,7 @@ int uv_spawn(uv_loop_t* loop,
UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS)));
uv__handle_init(loop, (uv_handle_t*)process, UV_PROCESS);
- ngx_queue_init(&process->queue);
+ QUEUE_INIT(&process->queue);
stdio_count = options.stdio_count;
if (stdio_count < 3)
@@ -449,7 +449,7 @@ int uv_spawn(uv_loop_t* loop,
}
q = uv__process_queue(loop, pid);
- ngx_queue_insert_tail(q, &process->queue);
+ QUEUE_INSERT_TAIL(q, &process->queue);
process->pid = pid;
process->exit_cb = options.exit_cb;
@@ -496,6 +496,6 @@ uv_err_t uv_kill(int pid, int signum) {
void uv__process_close(uv_process_t* handle) {
/* TODO stop signal watcher when this is the last handle */
- ngx_queue_remove(&handle->queue);
+ QUEUE_REMOVE(&handle->queue);
uv__handle_stop(handle);
}
diff --git a/deps/uv/src/unix/signal.c b/deps/uv/src/unix/signal.c
index f7fd2e5e4..78a631825 100644
--- a/deps/uv/src/unix/signal.c
+++ b/deps/uv/src/unix/signal.c
@@ -223,14 +223,14 @@ static int uv__signal_loop_once_init(uv_loop_t* loop) {
void uv__signal_loop_cleanup(uv_loop_t* loop) {
- ngx_queue_t* q;
+ QUEUE* q;
/* Stop all the signal watchers that are still attached to this loop. This
* ensures that the (shared) signal tree doesn't contain any invalid entries
* entries, and that signal handlers are removed when appropriate.
*/
- ngx_queue_foreach(q, &loop->handle_queue) {
- uv_handle_t* handle = ngx_queue_data(q, uv_handle_t, handle_queue);
+ QUEUE_FOREACH(q, &loop->handle_queue) {
+ uv_handle_t* handle = QUEUE_DATA(q, uv_handle_t, handle_queue);
if (handle->type == UV_SIGNAL)
uv__signal_stop((uv_signal_t*) handle);
diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c
index d95fa0dbe..ad1845826 100644
--- a/deps/uv/src/unix/stream.c
+++ b/deps/uv/src/unix/stream.c
@@ -109,8 +109,8 @@ void uv__stream_init(uv_loop_t* loop,
stream->shutdown_req = NULL;
stream->accepted_fd = -1;
stream->delayed_error = 0;
- ngx_queue_init(&stream->write_queue);
- ngx_queue_init(&stream->write_completed_queue);
+ QUEUE_INIT(&stream->write_queue);
+ QUEUE_INIT(&stream->write_completed_queue);
stream->write_queue_size = 0;
if (loop->emfile_fd == -1)
@@ -373,7 +373,7 @@ int uv__stream_open(uv_stream_t* stream, int fd, int flags) {
void uv__stream_destroy(uv_stream_t* stream) {
uv_write_t* req;
- ngx_queue_t* q;
+ QUEUE* q;
assert(!uv__io_active(&stream->io_watcher, UV__POLLIN | UV__POLLOUT));
assert(stream->flags & UV_CLOSED);
@@ -385,11 +385,11 @@ void uv__stream_destroy(uv_stream_t* stream) {
stream->connect_req = NULL;
}
- while (!ngx_queue_empty(&stream->write_queue)) {
- q = ngx_queue_head(&stream->write_queue);
- ngx_queue_remove(q);
+ while (!QUEUE_EMPTY(&stream->write_queue)) {
+ q = QUEUE_HEAD(&stream->write_queue);
+ QUEUE_REMOVE(q);
- req = ngx_queue_data(q, uv_write_t, queue);
+ req = QUEUE_DATA(q, uv_write_t, queue);
uv__req_unregister(stream->loop, req);
if (req->bufs != req->bufsml)
@@ -401,11 +401,11 @@ void uv__stream_destroy(uv_stream_t* stream) {
}
}
- while (!ngx_queue_empty(&stream->write_completed_queue)) {
- q = ngx_queue_head(&stream->write_completed_queue);
- ngx_queue_remove(q);
+ while (!QUEUE_EMPTY(&stream->write_completed_queue)) {
+ q = QUEUE_HEAD(&stream->write_completed_queue);
+ QUEUE_REMOVE(q);
- req = ngx_queue_data(q, uv_write_t, queue);
+ req = QUEUE_DATA(q, uv_write_t, queue);
uv__req_unregister(stream->loop, req);
if (req->cb) {
@@ -638,7 +638,7 @@ int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb) {
static void uv__drain(uv_stream_t* stream) {
uv_shutdown_t* req;
- assert(ngx_queue_empty(&stream->write_queue));
+ assert(QUEUE_EMPTY(&stream->write_queue));
assert(stream->write_queue_size == 0);
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT);
@@ -685,7 +685,7 @@ static void uv__write_req_finish(uv_write_t* req) {
uv_stream_t* stream = req->handle;
/* Pop the req off tcp->write_queue. */
- ngx_queue_remove(&req->queue);
+ QUEUE_REMOVE(&req->queue);
if (req->bufs != req->bufsml) {
free(req->bufs);
}
@@ -694,7 +694,7 @@ static void uv__write_req_finish(uv_write_t* req) {
/* Add it to the write_completed_queue where it will have its
* callback called in the near future.
*/
- ngx_queue_insert_tail(&stream->write_completed_queue, &req->queue);
+ QUEUE_INSERT_TAIL(&stream->write_completed_queue, &req->queue);
uv__io_feed(stream->loop, &stream->io_watcher);
}
@@ -716,7 +716,7 @@ static int uv__handle_fd(uv_handle_t* handle) {
static void uv__write(uv_stream_t* stream) {
struct iovec* iov;
- ngx_queue_t* q;
+ QUEUE* q;
uv_write_t* req;
int iovcnt;
ssize_t n;
@@ -725,13 +725,13 @@ start:
assert(uv__stream_fd(stream) >= 0);
- if (ngx_queue_empty(&stream->write_queue)) {
+ if (QUEUE_EMPTY(&stream->write_queue)) {
assert(stream->write_queue_size == 0);
return;
}
- q = ngx_queue_head(&stream->write_queue);
- req = ngx_queue_data(q, uv_write_t, queue);
+ q = QUEUE_HEAD(&stream->write_queue);
+ req = QUEUE_DATA(q, uv_write_t, queue);
assert(req->handle == stream);
/*
@@ -863,13 +863,13 @@ start:
static void uv__write_callbacks(uv_stream_t* stream) {
uv_write_t* req;
- ngx_queue_t* q;
+ QUEUE* q;
- while (!ngx_queue_empty(&stream->write_completed_queue)) {
+ while (!QUEUE_EMPTY(&stream->write_completed_queue)) {
/* Pop a req off write_completed_queue. */
- q = ngx_queue_head(&stream->write_completed_queue);
- req = ngx_queue_data(q, uv_write_t, queue);
- ngx_queue_remove(q);
+ q = QUEUE_HEAD(&stream->write_completed_queue);
+ req = QUEUE_DATA(q, uv_write_t, queue);
+ QUEUE_REMOVE(q);
uv__req_unregister(stream->loop, req);
/* NOTE: call callback AFTER freeing the request data. */
@@ -879,10 +879,10 @@ static void uv__write_callbacks(uv_stream_t* stream) {
}
}
- assert(ngx_queue_empty(&stream->write_completed_queue));
+ assert(QUEUE_EMPTY(&stream->write_completed_queue));
/* Write queue drained. */
- if (ngx_queue_empty(&stream->write_queue))
+ if (QUEUE_EMPTY(&stream->write_queue))
uv__drain(stream);
}
@@ -1200,7 +1200,7 @@ int uv_write2(uv_write_t* req,
req->handle = stream;
req->error = 0;
req->send_handle = send_handle;
- ngx_queue_init(&req->queue);
+ QUEUE_INIT(&req->queue);
if (bufcnt <= (int) ARRAY_SIZE(req->bufsml))
req->bufs = req->bufsml;
@@ -1213,7 +1213,7 @@ int uv_write2(uv_write_t* req,
stream->write_queue_size += uv__buf_count(bufs, bufcnt);
/* Append the request to write_queue. */
- ngx_queue_insert_tail(&stream->write_queue, &req->queue);
+ QUEUE_INSERT_TAIL(&stream->write_queue, &req->queue);
/* If the queue was empty when this function began, we should attempt to
* do the write immediately. Otherwise start the write_watcher and wait
diff --git a/deps/uv/src/unix/sunos.c b/deps/uv/src/unix/sunos.c
index 3fbb50c9b..ff5044cf0 100644
--- a/deps/uv/src/unix/sunos.c
+++ b/deps/uv/src/unix/sunos.c
@@ -91,7 +91,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
struct port_event events[1024];
struct port_event* pe;
struct timespec spec;
- ngx_queue_t* q;
+ QUEUE* q;
uv__io_t* w;
uint64_t base;
uint64_t diff;
@@ -103,16 +103,16 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
int fd;
if (loop->nfds == 0) {
- assert(ngx_queue_empty(&loop->watcher_queue));
+ assert(QUEUE_EMPTY(&loop->watcher_queue));
return;
}
- while (!ngx_queue_empty(&loop->watcher_queue)) {
- q = ngx_queue_head(&loop->watcher_queue);
- ngx_queue_remove(q);
- ngx_queue_init(q);
+ while (!QUEUE_EMPTY(&loop->watcher_queue)) {
+ q = QUEUE_HEAD(&loop->watcher_queue);
+ QUEUE_REMOVE(q);
+ QUEUE_INIT(q);
- w = ngx_queue_data(q, uv__io_t, watcher_queue);
+ w = QUEUE_DATA(q, uv__io_t, watcher_queue);
assert(w->pevents != 0);
if (port_associate(loop->backend_fd, PORT_SOURCE_FD, w->fd, w->pevents, 0))
@@ -190,8 +190,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
nevents++;
/* Events Ports operates in oneshot mode, rearm timer on next run. */
- if (w->pevents != 0 && ngx_queue_empty(&w->watcher_queue))
- ngx_queue_insert_tail(&loop->watcher_queue, &w->watcher_queue);
+ if (w->pevents != 0 && QUEUE_EMPTY(&w->watcher_queue))
+ QUEUE_INSERT_TAIL(&loop->watcher_queue, &w->watcher_queue);
}
if (nevents != 0) {
diff --git a/deps/uv/src/unix/tcp.c b/deps/uv/src/unix/tcp.c
index 26ab53dbb..1ed69d63c 100644
--- a/deps/uv/src/unix/tcp.c
+++ b/deps/uv/src/unix/tcp.c
@@ -116,7 +116,7 @@ static int uv__connect(uv_connect_t* req,
uv__req_init(handle->loop, req, UV_CONNECT);
req->cb = cb;
req->handle = (uv_stream_t*) handle;
- ngx_queue_init(&req->queue);
+ QUEUE_INIT(&req->queue);
handle->connect_req = req;
uv__io_start(handle->loop, &handle->io_watcher, UV__POLLOUT);
diff --git a/deps/uv/src/unix/threadpool.c b/deps/uv/src/unix/threadpool.c
index 6e5adc403..835db312d 100644
--- a/deps/uv/src/unix/threadpool.c
+++ b/deps/uv/src/unix/threadpool.c
@@ -30,8 +30,8 @@ static uv_mutex_t mutex;
static unsigned int nthreads;
static uv_thread_t* threads;
static uv_thread_t default_threads[4];
-static ngx_queue_t exit_message;
-static ngx_queue_t wq;
+static QUEUE exit_message;
+static QUEUE wq;
static volatile int initialized;
@@ -45,23 +45,23 @@ static void uv__cancelled(struct uv__work* w) {
*/
static void worker(void* arg) {
struct uv__work* w;
- ngx_queue_t* q;
+ QUEUE* q;
(void) arg;
for (;;) {
uv_mutex_lock(&mutex);
- while (ngx_queue_empty(&wq))
+ while (QUEUE_EMPTY(&wq))
uv_cond_wait(&cond, &mutex);
- q = ngx_queue_head(&wq);
+ q = QUEUE_HEAD(&wq);
if (q == &exit_message)
uv_cond_signal(&cond);
else {
- ngx_queue_remove(q);
- ngx_queue_init(q); /* Signal uv_cancel() that the work req is
+ QUEUE_REMOVE(q);
+ QUEUE_INIT(q); /* Signal uv_cancel() that the work req is
executing. */
}
@@ -70,22 +70,22 @@ static void worker(void* arg) {
if (q == &exit_message)
break;
- w = ngx_queue_data(q, struct uv__work, wq);
+ w = QUEUE_DATA(q, struct uv__work, wq);
w->work(w);
uv_mutex_lock(&w->loop->wq_mutex);
w->work = NULL; /* Signal uv_cancel() that the work req is done
executing. */
- ngx_queue_insert_tail(&w->loop->wq, &w->wq);
+ QUEUE_INSERT_TAIL(&w->loop->wq, &w->wq);
uv_async_send(&w->loop->wq_async);
uv_mutex_unlock(&w->loop->wq_mutex);
}
}
-static void post(ngx_queue_t* q) {
+static void post(QUEUE* q) {
uv_mutex_lock(&mutex);
- ngx_queue_insert_tail(&wq, q);
+ QUEUE_INSERT_TAIL(&wq, q);
uv_cond_signal(&cond);
uv_mutex_unlock(&mutex);
}
@@ -119,7 +119,7 @@ static void init_once(void) {
if (uv_mutex_init(&mutex))
abort();
- ngx_queue_init(&wq);
+ QUEUE_INIT(&wq);
for (i = 0; i < nthreads; i++)
if (uv_thread_create(threads + i, worker, NULL))
@@ -174,9 +174,9 @@ static int uv__work_cancel(uv_loop_t* loop, uv_req_t* req, struct uv__work* w) {
uv_mutex_lock(&mutex);
uv_mutex_lock(&w->loop->wq_mutex);
- cancelled = !ngx_queue_empty(&w->wq) && w->work != NULL;
+ cancelled = !QUEUE_EMPTY(&w->wq) && w->work != NULL;
if (cancelled)
- ngx_queue_remove(&w->wq);
+ QUEUE_REMOVE(&w->wq);
uv_mutex_unlock(&w->loop->wq_mutex);
uv_mutex_unlock(&mutex);
@@ -186,7 +186,7 @@ static int uv__work_cancel(uv_loop_t* loop, uv_req_t* req, struct uv__work* w) {
w->work = uv__cancelled;
uv_mutex_lock(&loop->wq_mutex);
- ngx_queue_insert_tail(&loop->wq, &w->wq);
+ QUEUE_INSERT_TAIL(&loop->wq, &w->wq);
uv_async_send(&loop->wq_async);
uv_mutex_unlock(&loop->wq_mutex);
@@ -197,23 +197,23 @@ static int uv__work_cancel(uv_loop_t* loop, uv_req_t* req, struct uv__work* w) {
void uv__work_done(uv_async_t* handle, int status) {
struct uv__work* w;
uv_loop_t* loop;
- ngx_queue_t* q;
- ngx_queue_t wq;
+ QUEUE* q;
+ QUEUE wq;
int err;
loop = container_of(handle, uv_loop_t, wq_async);
- ngx_queue_init(&wq);
+ QUEUE_INIT(&wq);
uv_mutex_lock(&loop->wq_mutex);
- if (!ngx_queue_empty(&loop->wq)) {
- q = ngx_queue_head(&loop->wq);
- ngx_queue_split(&loop->wq, q, &wq);
+ if (!QUEUE_EMPTY(&loop->wq)) {
+ q = QUEUE_HEAD(&loop->wq);
+ QUEUE_SPLIT(&loop->wq, q, &wq);
}
uv_mutex_unlock(&loop->wq_mutex);
- while (!ngx_queue_empty(&wq)) {
- q = ngx_queue_head(&wq);
- ngx_queue_remove(q);
+ while (!QUEUE_EMPTY(&wq)) {
+ q = QUEUE_HEAD(&wq);
+ QUEUE_REMOVE(q);
w = container_of(q, struct uv__work, wq);
err = (w->work == uv__cancelled) ? -UV_ECANCELED : 0;
diff --git a/deps/uv/src/unix/udp.c b/deps/uv/src/unix/udp.c
index 3fb8af932..994cdf21a 100644
--- a/deps/uv/src/unix/udp.c
+++ b/deps/uv/src/unix/udp.c
@@ -54,18 +54,18 @@ void uv__udp_close(uv_udp_t* handle) {
void uv__udp_finish_close(uv_udp_t* handle) {
uv_udp_send_t* req;
- ngx_queue_t* q;
+ QUEUE* q;
assert(!uv__io_active(&handle->io_watcher, UV__POLLIN | UV__POLLOUT));
assert(handle->io_watcher.fd == -1);
uv__udp_run_completed(handle);
- while (!ngx_queue_empty(&handle->write_queue)) {
- q = ngx_queue_head(&handle->write_queue);
- ngx_queue_remove(q);
+ while (!QUEUE_EMPTY(&handle->write_queue)) {
+ q = QUEUE_HEAD(&handle->write_queue);
+ QUEUE_REMOVE(q);
- req = ngx_queue_data(q, uv_udp_send_t, queue);
+ req = QUEUE_DATA(q, uv_udp_send_t, queue);
uv__req_unregister(handle->loop, req);
if (req->bufs != req->bufsml)
@@ -87,15 +87,15 @@ void uv__udp_finish_close(uv_udp_t* handle) {
static void uv__udp_run_pending(uv_udp_t* handle) {
uv_udp_send_t* req;
- ngx_queue_t* q;
+ QUEUE* q;
struct msghdr h;
ssize_t size;
- while (!ngx_queue_empty(&handle->write_queue)) {
- q = ngx_queue_head(&handle->write_queue);
+ while (!QUEUE_EMPTY(&handle->write_queue)) {
+ q = QUEUE_HEAD(&handle->write_queue);
assert(q != NULL);
- req = ngx_queue_data(q, uv_udp_send_t, queue);
+ req = QUEUE_DATA(q, uv_udp_send_t, queue);
assert(req != NULL);
memset(&h, 0, sizeof h);
@@ -136,21 +136,21 @@ static void uv__udp_run_pending(uv_udp_t* handle) {
* why we don't handle partial writes. Just pop the request
* off the write queue and onto the completed queue, done.
*/
- ngx_queue_remove(&req->queue);
- ngx_queue_insert_tail(&handle->write_completed_queue, &req->queue);
+ QUEUE_REMOVE(&req->queue);
+ QUEUE_INSERT_TAIL(&handle->write_completed_queue, &req->queue);
}
}
static void uv__udp_run_completed(uv_udp_t* handle) {
uv_udp_send_t* req;
- ngx_queue_t* q;
+ QUEUE* q;
- while (!ngx_queue_empty(&handle->write_completed_queue)) {
- q = ngx_queue_head(&handle->write_completed_queue);
- ngx_queue_remove(q);
+ while (!QUEUE_EMPTY(&handle->write_completed_queue)) {
+ q = QUEUE_HEAD(&handle->write_completed_queue);
+ QUEUE_REMOVE(q);
- req = ngx_queue_data(q, uv_udp_send_t, queue);
+ req = QUEUE_DATA(q, uv_udp_send_t, queue);
uv__req_unregister(handle->loop, req);
if (req->bufs != req->bufsml)
@@ -263,8 +263,8 @@ static void uv__udp_sendmsg(uv_loop_t* loop,
assert(handle->type == UV_UDP);
assert(revents & UV__POLLOUT);
- assert(!ngx_queue_empty(&handle->write_queue)
- || !ngx_queue_empty(&handle->write_completed_queue));
+ assert(!QUEUE_EMPTY(&handle->write_queue)
+ || !QUEUE_EMPTY(&handle->write_completed_queue));
/* Write out pending data first. */
uv__udp_run_pending(handle);
@@ -272,11 +272,11 @@ static void uv__udp_sendmsg(uv_loop_t* loop,
/* Drain 'request completed' queue. */
uv__udp_run_completed(handle);
- if (!ngx_queue_empty(&handle->write_completed_queue)) {
+ if (!QUEUE_EMPTY(&handle->write_completed_queue)) {
/* Schedule completion callbacks. */
uv__io_feed(handle->loop, &handle->io_watcher);
}
- else if (ngx_queue_empty(&handle->write_queue)) {
+ else if (QUEUE_EMPTY(&handle->write_queue)) {
/* Pending queue and completion queue empty, stop watcher. */
uv__io_stop(loop, &handle->io_watcher, UV__POLLOUT);
@@ -441,7 +441,7 @@ static int uv__send(uv_udp_send_t* req,
}
memcpy(req->bufs, bufs, bufcnt * sizeof(bufs[0]));
- ngx_queue_insert_tail(&handle->write_queue, &req->queue);
+ QUEUE_INSERT_TAIL(&handle->write_queue, &req->queue);
uv__io_start(handle->loop, &handle->io_watcher, UV__POLLOUT);
uv__handle_start(handle);
@@ -454,8 +454,8 @@ int uv_udp_init(uv_loop_t* loop, uv_udp_t* handle) {
handle->alloc_cb = NULL;
handle->recv_cb = NULL;
uv__io_init(&handle->io_watcher, uv__udp_io, -1);
- ngx_queue_init(&handle->write_queue);
- ngx_queue_init(&handle->write_completed_queue);
+ QUEUE_INIT(&handle->write_queue);
+ QUEUE_INIT(&handle->write_completed_queue);
return 0;
}
diff --git a/deps/uv/src/uv-common.c b/deps/uv/src/uv-common.c
index 8c9d323af..c95dfdd3e 100644
--- a/deps/uv/src/uv-common.c
+++ b/deps/uv/src/uv-common.c
@@ -361,11 +361,11 @@ unsigned long uv_thread_self(void) {
void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg) {
- ngx_queue_t* q;
+ QUEUE* q;
uv_handle_t* h;
- ngx_queue_foreach(q, &loop->handle_queue) {
- h = ngx_queue_data(q, uv_handle_t, handle_queue);
+ QUEUE_FOREACH(q, &loop->handle_queue) {
+ h = QUEUE_DATA(q, uv_handle_t, handle_queue);
if (h->flags & UV__HANDLE_INTERNAL) continue;
walk_cb(h, arg);
}
@@ -375,14 +375,14 @@ void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg) {
#ifndef NDEBUG
static void uv__print_handles(uv_loop_t* loop, int only_active) {
const char* type;
- ngx_queue_t* q;
+ QUEUE* q;
uv_handle_t* h;
if (loop == NULL)
loop = uv_default_loop();
- ngx_queue_foreach(q, &loop->handle_queue) {
- h = ngx_queue_data(q, uv_handle_t, handle_queue);
+ QUEUE_FOREACH(q, &loop->handle_queue) {
+ h = QUEUE_DATA(q, uv_handle_t, handle_queue);
if (only_active && !uv__is_active(h))
continue;
diff --git a/deps/uv/src/uv-common.h b/deps/uv/src/uv-common.h
index 80c9c7193..e2d2f4bc1 100644
--- a/deps/uv/src/uv-common.h
+++ b/deps/uv/src/uv-common.h
@@ -38,6 +38,7 @@
#include "uv.h"
#include "tree.h"
+#include "queue.h"
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
@@ -116,18 +117,18 @@ void uv__fs_poll_close(uv_fs_poll_t* handle);
#define uv__has_active_reqs(loop) \
- (ngx_queue_empty(&(loop)->active_reqs) == 0)
+ (QUEUE_EMPTY(&(loop)->active_reqs) == 0)
#define uv__req_register(loop, req) \
do { \
- ngx_queue_insert_tail(&(loop)->active_reqs, &(req)->active_queue); \
+ QUEUE_INSERT_TAIL(&(loop)->active_reqs, &(req)->active_queue); \
} \
while (0)
#define uv__req_unregister(loop, req) \
do { \
assert(uv__has_active_reqs(loop)); \
- ngx_queue_remove(&(req)->active_queue); \
+ QUEUE_REMOVE(&(req)->active_queue); \
} \
while (0)
@@ -196,7 +197,7 @@ void uv__fs_poll_close(uv_fs_poll_t* handle);
(h)->loop = (loop_); \
(h)->type = (type_); \
(h)->flags = UV__HANDLE_REF; /* Ref the loop when active. */ \
- ngx_queue_insert_tail(&(loop_)->handle_queue, &(h)->handle_queue); \
+ QUEUE_INSERT_TAIL(&(loop_)->handle_queue, &(h)->handle_queue); \
uv__handle_platform_init(h); \
} \
while (0)
diff --git a/deps/uv/src/version.c b/deps/uv/src/version.c
index 0ee0753ea..48dc7bd2b 100644
--- a/deps/uv/src/version.c
+++ b/deps/uv/src/version.c
@@ -27,9 +27,9 @@
*/
#define UV_VERSION_MAJOR 0
-#define UV_VERSION_MINOR 10
-#define UV_VERSION_PATCH 3
-#define UV_VERSION_IS_RELEASE 1
+#define UV_VERSION_MINOR 11
+#define UV_VERSION_PATCH 1
+#define UV_VERSION_IS_RELEASE 0
#define UV_VERSION ((UV_VERSION_MAJOR << 16) | \
diff --git a/deps/uv/src/win/core.c b/deps/uv/src/win/core.c
index a06c23f3c..85272f1a3 100644
--- a/deps/uv/src/win/core.c
+++ b/deps/uv/src/win/core.c
@@ -92,8 +92,8 @@ static void uv_loop_init(uv_loop_t* loop) {
loop->time = 0;
uv_update_time(loop);
- ngx_queue_init(&loop->handle_queue);
- ngx_queue_init(&loop->active_reqs);
+ QUEUE_INIT(&loop->handle_queue);
+ QUEUE_INIT(&loop->active_reqs);
loop->active_handles = 0;
loop->pending_reqs_tail = NULL;
@@ -253,7 +253,7 @@ static void uv_poll_ex(uv_loop_t* loop, int block) {
static int uv__loop_alive(uv_loop_t* loop) {
return loop->active_handles > 0 ||
- !ngx_queue_empty(&loop->active_reqs) ||
+ !QUEUE_EMPTY(&loop->active_reqs) ||
loop->endgame_handles != NULL;
}
@@ -291,7 +291,7 @@ int uv_run(uv_loop_t *loop, uv_run_mode mode) {
loop->endgame_handles == NULL &&
!loop->stop_flag &&
(loop->active_handles > 0 ||
- !ngx_queue_empty(&loop->active_reqs)) &&
+ !QUEUE_EMPTY(&loop->active_reqs)) &&
!(mode & UV_RUN_NOWAIT));
uv_check_invoke(loop);
diff --git a/deps/uv/src/win/handle-inl.h b/deps/uv/src/win/handle-inl.h
index 52dfbbc1a..3eef10c4e 100644
--- a/deps/uv/src/win/handle-inl.h
+++ b/deps/uv/src/win/handle-inl.h
@@ -74,7 +74,7 @@
#define uv__handle_close(handle) \
do { \
- ngx_queue_remove(&(handle)->handle_queue); \
+ QUEUE_REMOVE(&(handle)->handle_queue); \
uv__active_handle_rm((uv_handle_t*) (handle)); \
\
(handle)->flags |= UV_HANDLE_CLOSED; \
diff --git a/deps/uv/test/test-getaddrinfo.c b/deps/uv/test/test-getaddrinfo.c
index dd022072a..b515c8a02 100644
--- a/deps/uv/test/test-getaddrinfo.c
+++ b/deps/uv/test/test-getaddrinfo.c
@@ -33,6 +33,18 @@ static int getaddrinfo_cbs = 0;
static uv_getaddrinfo_t* getaddrinfo_handle;
static uv_getaddrinfo_t getaddrinfo_handles[CONCURRENT_COUNT];
static int callback_counts[CONCURRENT_COUNT];
+static int fail_cb_called;
+
+
+static void getaddrinfo_fail_cb(uv_getaddrinfo_t* req,
+ int status,
+ struct addrinfo* res) {
+ ASSERT(fail_cb_called == 0);
+ ASSERT(status == -1);
+ ASSERT(res == NULL);
+ uv_freeaddrinfo(res); /* Should not crash. */
+ fail_cb_called++;
+}
static void getaddrinfo_basic_cb(uv_getaddrinfo_t* handle,
@@ -68,6 +80,23 @@ static void getaddrinfo_cuncurrent_cb(uv_getaddrinfo_t* handle,
}
+TEST_IMPL(getaddrinfo_fail) {
+ uv_getaddrinfo_t req;
+
+ ASSERT(0 == uv_getaddrinfo(uv_default_loop(),
+ &req,
+ getaddrinfo_fail_cb,
+ "xyzzy.xyzzy.xyzzy",
+ NULL,
+ NULL));
+ ASSERT(0 == uv_run(uv_default_loop(), UV_RUN_DEFAULT));
+ ASSERT(fail_cb_called == 1);
+
+ MAKE_VALGRIND_HAPPY();
+ return 0;
+}
+
+
TEST_IMPL(getaddrinfo_basic) {
int r;
getaddrinfo_handle = (uv_getaddrinfo_t*)malloc(sizeof(uv_getaddrinfo_t));
diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h
index 016f62711..30a2a0a28 100644
--- a/deps/uv/test/test-list.h
+++ b/deps/uv/test/test-list.h
@@ -136,6 +136,7 @@ TEST_DECLARE (process_title)
TEST_DECLARE (cwd_and_chdir)
TEST_DECLARE (get_memory)
TEST_DECLARE (hrtime)
+TEST_DECLARE (getaddrinfo_fail)
TEST_DECLARE (getaddrinfo_basic)
TEST_DECLARE (getaddrinfo_concurrent)
TEST_DECLARE (getsockname_tcp)
@@ -398,6 +399,7 @@ TASK_LIST_START
TEST_ENTRY (hrtime)
+ TEST_ENTRY (getaddrinfo_fail)
TEST_ENTRY (getaddrinfo_basic)
TEST_ENTRY (getaddrinfo_concurrent)
diff --git a/deps/uv/test/test-threadpool-cancel.c b/deps/uv/test/test-threadpool-cancel.c
index f000c1a86..0a21357b9 100644
--- a/deps/uv/test/test-threadpool-cancel.c
+++ b/deps/uv/test/test-threadpool-cancel.c
@@ -121,7 +121,9 @@ static void getaddrinfo_cb(uv_getaddrinfo_t* req,
int status,
struct addrinfo* res) {
ASSERT(UV_ECANCELED == uv_last_error(req->loop).code);
- ASSERT(UV_ECANCELED == status);
+ ASSERT(status == -1);
+ ASSERT(res == NULL);
+ uv_freeaddrinfo(res); /* Should not crash. */
getaddrinfo_cb_called++;
}
diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp
index db90ee90e..dc8cd8daa 100644
--- a/deps/uv/uv.gyp
+++ b/deps/uv/uv.gyp
@@ -50,10 +50,10 @@
'sources': [
'common.gypi',
'include/uv.h',
- 'include/uv-private/ngx-queue.h',
'include/uv-private/tree.h',
'src/fs-poll.c',
'src/inet.c',
+ 'src/queue.h',
'src/uv-common.c',
'src/uv-common.h',
'src/version.c'