Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[0.10] deps: update libuv to 0.10.37 #7293

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deps/uv/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,4 @@ Helge Deller <deller@gmx.de>
Logan Rosen <loganrosen@gmail.com>
Kenneth Perry <thothonegan@gmail.com>
Michael Penick <michael.penick@datastax.com>
Stephen von Takach <steve@advancedcontrol.com.au>
27 changes: 26 additions & 1 deletion deps/uv/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
2015.02.27, Version 0.10.36 (Stable)
2016.06.14, Version 0.10.37 (Stable)

Changes since version 0.10.36:

* build: update the location of gyp (Stephen von Takach)

* linux: fix epoll_pwait() fallback on arm64 (Ben Noordhuis)

* test: fix fs_chown when running as root (Ben Noordhuis)

* tests: skip some tests when network is unreachable (Luca Bruno)

* unix: do not discard environmental LDFLAGS (Luca Bruno)

* src: replace ngx_queue_split with ngx_queue_move (Ben Noordhuis)

* unix: use ngx_queue_move when iterating over lists (Ben Noordhuis)

* win: fix unsavory rwlock fallback implementation (Bert Belder)

* unix: map ENFILE errno (Saúl Ibarra Corretgé)

* doc: add note indicating branch status (Saúl Ibarra Corretgé)


2015.02.27, Version 0.10.36 (Stable), cc4d42a89a2a0ae0ff8e14321de086eba3c3b4ca

Changes since version 0.10.35:

Expand Down
11 changes: 4 additions & 7 deletions deps/uv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ eventually contain all platform differences in this library.

http://nodejs.org/

**This branch only receives security fixes and will be EOL'd by the end of 2016,
please switch to version v1.x**

## Features

* Non-blocking TCP sockets
Expand Down Expand Up @@ -81,13 +84,7 @@ To have GYP generate build script for another system, make sure that
you have Python 2.6 or 2.7 installed, then checkout GYP into the
project tree manually:

mkdir -p build
svn co http://gyp.googlecode.com/svn/trunk build/gyp

Or:

mkdir -p build
git clone https://git.chromium.org/external/gyp.git build/gyp
git clone https://chromium.googlesource.com/external/gyp.git build/gyp

Unix users run

Expand Down
2 changes: 1 addition & 1 deletion deps/uv/config-unix.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ E=
CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
CFLAGS += -g
CPPFLAGS += -I$(SRCDIR)/src
LDFLAGS=-lm -pthread
LDFLAGS += -lm -pthread

CPPFLAGS += -D_LARGEFILE_SOURCE
CPPFLAGS += -D_FILE_OFFSET_BITS=64
Expand Down
14 changes: 14 additions & 0 deletions deps/uv/include/uv-private/ngx-queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,17 @@ struct ngx_queue_s {
while (0)


#define ngx_queue_move(h, n) \
do { \
if (ngx_queue_empty(h)) \
ngx_queue_init(n); \
else { \
ngx_queue_t* q = ngx_queue_head(h); \
ngx_queue_split(h, q, n); \
} \
} \
while (0)

#define ngx_queue_add(h, n) \
do { \
(h)->prev->next = (n)->next; \
Expand All @@ -120,6 +131,9 @@ struct ngx_queue_s {
((type *) ((unsigned char *) q - offsetof(type, link)))


/* Important note: mutating the list while ngx_queue_foreach is
* iterating over its elements results in undefined behavior.
*/
#define ngx_queue_foreach(q, h) \
for ((q) = ngx_queue_head(h); \
(q) != ngx_queue_sentinel(h) && !ngx_queue_empty(h); \
Expand Down
18 changes: 12 additions & 6 deletions deps/uv/include/uv-private/uv-win.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,20 @@ typedef union {
} uv_cond_t;

typedef union {
/* srwlock_ has type SRWLOCK, but not all toolchains define this type in */
/* windows.h. */
SRWLOCK srwlock_;
struct {
uv_mutex_t read_mutex_;
uv_mutex_t write_mutex_;
unsigned int num_readers_;
} fallback_;
CRITICAL_SECTION num_readers_lock_;
HANDLE write_semaphore_;
} state_;
/* TODO: remove me in v2.x. */
struct {
SRWLOCK unused_;
} unused1_;
/* TODO: remove me in v2.x. */
struct {
uv_mutex_t unused1_;
uv_mutex_t unused2_;
} unused2_;
} uv_rwlock_t;

typedef struct {
Expand Down
8 changes: 7 additions & 1 deletion deps/uv/src/unix/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,18 @@ 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 queue;
ngx_queue_t* q;
uv_async_t* h;

ngx_queue_foreach(q, &loop->async_handles) {
ngx_queue_move(&loop->async_handles, &queue);
while (!ngx_queue_empty(&queue)) {
q = ngx_queue_head(&queue);
h = ngx_queue_data(q, uv_async_t, queue);

ngx_queue_remove(q);
ngx_queue_insert_tail(&loop->async_handles, q);

if (cmpxchgi(&h->pending, 1, 0) == 0)
continue;

Expand Down
8 changes: 2 additions & 6 deletions deps/uv/src/unix/darwin.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,12 @@ static void uv__cf_loop_cb(void* arg) {
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);
}
ngx_queue_move(&loop->cf_signals, &split_head);
uv_mutex_unlock(&loop->cf_mutex);

while (!ngx_queue_empty(&split_head)) {
item = ngx_queue_head(&split_head);
ngx_queue_remove(item);

s = ngx_queue_data(item, uv__cf_loop_signal_t, member);

Expand All @@ -151,7 +148,6 @@ static void uv__cf_loop_cb(void* arg) {
else
s->cb(s->arg);

ngx_queue_remove(item);
free(s);
}
}
Expand Down
1 change: 1 addition & 0 deletions deps/uv/src/unix/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ERANGE: return UV_ERANGE;
case ENXIO: return UV_ENXIO;
case EMLINK: return UV_EMLINK;
case ENFILE: return UV_ENFILE;
default: return UV_UNKNOWN;
}
UNREACHABLE();
Expand Down
6 changes: 1 addition & 5 deletions deps/uv/src/unix/fsevents.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ struct uv__fsevents_event_s {
ngx_queue_t 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); \
} \
ngx_queue_move(&(handle)->cf_events, &split_head); \
uv_mutex_unlock(&(handle)->cf_mutex); \
while (!ngx_queue_empty(&split_head)) { \
curr = ngx_queue_head(&split_head); \
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/src/unix/linux-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
if (pthread_sigmask(SIG_BLOCK, &sigset, NULL))
abort();

if (sigmask != 0 && no_epoll_pwait == 0) {
if (no_epoll_wait != 0 || (sigmask != 0 && no_epoll_pwait == 0)) {
nfds = uv__epoll_pwait(loop->backend_fd,
events,
ARRAY_SIZE(events),
Expand Down
9 changes: 8 additions & 1 deletion deps/uv/src/unix/linux-inotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +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 queue;
ngx_queue_t* q;
const char* path;
ssize_t size;
Expand Down Expand Up @@ -158,8 +159,14 @@ 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) {
ngx_queue_move(&w->watchers, &queue);
while (!ngx_queue_empty(&queue)) {
q = ngx_queue_head(&queue);
h = ngx_queue_data(q, uv_fs_event_t, watchers);

ngx_queue_remove(q);
ngx_queue_insert_tail(&w->watchers, q);

h->cb(h, path, events, 0);
}
}
Expand Down
7 changes: 6 additions & 1 deletion deps/uv/src/unix/loop-watcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@
\
void uv__run_##name(uv_loop_t* loop) { \
uv_##name##_t* h; \
ngx_queue_t queue; \
ngx_queue_t* q; \
ngx_queue_foreach(q, &loop->name##_handles) { \
ngx_queue_move(&loop->name##_handles, &queue); \
while (!ngx_queue_empty(&queue)) { \
q = ngx_queue_head(&queue); \
h = ngx_queue_data(q, uv_##name##_t, queue); \
ngx_queue_remove(q); \
ngx_queue_insert_tail(&loop->name##_handles, q); \
h->name##_cb(h, 0); \
} \
} \
Expand Down
2 changes: 2 additions & 0 deletions deps/uv/src/unix/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ void uv__signal_loop_cleanup(uv_loop_t* loop) {
/* 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.
* It's safe to use QUEUE_FOREACH here because the handles and the handle
* queue are not modified by uv__signal_stop().
*/
ngx_queue_foreach(q, &loop->handle_queue) {
uv_handle_t* handle = ngx_queue_data(q, uv_handle_t, handle_queue);
Expand Down
33 changes: 15 additions & 18 deletions deps/uv/src/unix/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,12 @@ int uv_mutex_trylock(uv_mutex_t* mutex) {

r = pthread_mutex_trylock(mutex);

if (r && r != EBUSY && r != EAGAIN)
abort();

if (r)
if (r) {
if (r != EBUSY && r != EAGAIN)
abort();
return -1;
else
return 0;
}
return 0;
}


Expand Down Expand Up @@ -125,13 +124,12 @@ int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock) {

r = pthread_rwlock_tryrdlock(rwlock);

if (r && r != EBUSY && r != EAGAIN)
abort();

if (r)
if (r) {
if (r != EBUSY && r != EAGAIN)
abort();
return -1;
else
return 0;
}
return 0;
}


Expand All @@ -152,13 +150,12 @@ int uv_rwlock_trywrlock(uv_rwlock_t* rwlock) {

r = pthread_rwlock_trywrlock(rwlock);

if (r && r != EBUSY && r != EAGAIN)
abort();

if (r)
if (r) {
if (r != EBUSY && r != EAGAIN)
abort();
return -1;
else
return 0;
}
return 0;
}


Expand Down
7 changes: 1 addition & 6 deletions deps/uv/src/unix/threadpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,8 @@ void uv__work_done(uv_async_t* handle, int status) {
int err;

loop = container_of(handle, uv_loop_t, wq_async);
ngx_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);
}
ngx_queue_move(&loop->wq, &wq);
uv_mutex_unlock(&loop->wq_mutex);

while (!ngx_queue_empty(&wq)) {
Expand Down
9 changes: 8 additions & 1 deletion deps/uv/src/uv-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,18 @@ unsigned long uv_thread_self(void) {


void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg) {
ngx_queue_t queue;
ngx_queue_t* q;
uv_handle_t* h;

ngx_queue_foreach(q, &loop->handle_queue) {
ngx_queue_move(&loop->handle_queue, &queue);
while (!ngx_queue_empty(&queue)) {
q = ngx_queue_head(&queue);
h = ngx_queue_data(q, uv_handle_t, handle_queue);

ngx_queue_remove(q);
ngx_queue_insert_tail(&loop->handle_queue, q);

if (h->flags & UV__HANDLE_INTERNAL) continue;
walk_cb(h, arg);
}
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#define UV_VERSION_MAJOR 0
#define UV_VERSION_MINOR 10
#define UV_VERSION_PATCH 36
#define UV_VERSION_PATCH 37
#define UV_VERSION_IS_RELEASE 1


Expand Down
Loading