Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
deps: update libuv to 0.10.30
Browse files Browse the repository at this point in the history
PR-URL: #8849
Reviewed-by: Trevor Norris <[email protected]>
  • Loading branch information
saghul authored and trevnorris committed Dec 9, 2014
1 parent 8120015 commit 1c031c8
Show file tree
Hide file tree
Showing 18 changed files with 172 additions and 33 deletions.
1 change: 1 addition & 0 deletions deps/uv/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,4 @@ Paul Tan <[email protected]>
Javier Hernández <[email protected]>
Tonis Tiigi <[email protected]>
Michael Hudson-Doyle <[email protected]>
Helge Deller <[email protected]>
21 changes: 20 additions & 1 deletion deps/uv/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
2014.10.21, Version 0.10.29 (Stable)
2014.12.10, Version 0.10.30 (Stable)

Changes since version 0.10.29:

* linux: fix sigmask size arg in epoll_pwait() call (Ben Noordhuis)

* linux: handle O_NONBLOCK != SOCK_NONBLOCK case (Helge Deller)

* doc: update project links (Ben Noordhuis)

* windows: fix compilation of tests (Marc Schlaich)

* unix: add flag for blocking SIGPROF during poll (Ben Noordhuis)

* unix, windows: add uv_loop_configure() function (Ben Noordhuis)

* win: keep a reference to AFD_POLL_INFO in cancel poll (Marc Schlaich)


2014.10.21, Version 0.10.29 (Stable), 2d728542d3790183417f8f122a110693cd85db14

Changes since version 0.10.28:

Expand Down
4 changes: 2 additions & 2 deletions deps/uv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ http://nodejs.org/

## Documentation

* [include/uv.h](https://github.com/joyent/libuv/blob/master/include/uv.h)
* [include/uv.h](https://github.com/libuv/libuv/blob/master/include/uv.h)
&mdash; API documentation in the form of detailed header comments.
* [An Introduction to libuv](http://nikhilm.github.com/uvbook/) &mdash; An
overview of libuv with tutorials.
* [LXJS 2012 talk](http://www.youtube.com/watch?v=nGn60vDSxQ4) - High-level
introductory talk about libuv.
* [Tests and benchmarks](https://github.com/joyent/libuv/tree/master/test) -
* [Tests and benchmarks](https://github.com/libuv/libuv/tree/master/test) -
API specification and usage examples.

## Build Instructions
Expand Down
5 changes: 4 additions & 1 deletion deps/uv/include/uv-private/uv-win.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,10 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
/* Used in fast mode */ \
SOCKET peer_socket; \
AFD_POLL_INFO afd_poll_info_1; \
AFD_POLL_INFO afd_poll_info_2; \
union { \
AFD_POLL_INFO* afd_poll_info_ptr; \
AFD_POLL_INFO afd_poll_info; \
} afd_poll_info_2; \
/* Used in fast and slow mode. */ \
uv_req_t poll_req_1; \
uv_req_t poll_req_2; \
Expand Down
19 changes: 19 additions & 0 deletions deps/uv/include/uv.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,16 @@ typedef struct uv_work_s uv_work_t;
typedef struct uv_cpu_info_s uv_cpu_info_t;
typedef struct uv_interface_address_s uv_interface_address_t;

typedef enum {
/* Block a signal when polling for new events. The second argument to
* uv_loop_configure() is the signal number.
*
* This operation is currently only implemented for SIGPROF signals,
* to suppress unnecessary wakeups when using a sampling profiler.
* Requesting other signals will fail with UV_EINVAL.
*/
UV_LOOP_BLOCK_SIGNAL
} uv_loop_option;

typedef enum {
UV_RUN_DEFAULT = 0,
Expand Down Expand Up @@ -264,6 +274,15 @@ UV_EXTERN void uv_loop_delete(uv_loop_t*);
*/
UV_EXTERN uv_loop_t* uv_default_loop(void);

/*
* Set additional loop options. You should normally call this before the
* first call to uv_run() unless mentioned otherwise.
*
* Returns 0 on success or a UV_E* error code on failure. Be prepared to
* handle UV_ENOSYS; it means the loop option is not supported by the platform.
*/
UV_EXTERN int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...);

/*
* This function runs the event loop. It will act differently depending on the
* specified mode:
Expand Down
5 changes: 5 additions & 0 deletions deps/uv/src/unix/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ enum {
UV_TCP_SINGLE_ACCEPT = 0x400 /* Only accept() when idle. */
};

/* loop flags */
enum {
UV_LOOP_BLOCK_SIGPROF = 1
};

/* core */
int uv__nonblock(int fd, int set);
int uv__cloexec(int fd, int set);
Expand Down
17 changes: 16 additions & 1 deletion deps/uv/src/unix/kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
unsigned int nevents;
unsigned int revents;
ngx_queue_t* q;
uv__io_t* w;
sigset_t* pset;
sigset_t set;
uint64_t base;
uint64_t diff;
uv__io_t* w;
int filter;
int fflags;
int count;
Expand Down Expand Up @@ -118,6 +120,13 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
w->events = w->pevents;
}

pset = NULL;
if (loop->flags & UV_LOOP_BLOCK_SIGPROF) {
pset = &set;
sigemptyset(pset);
sigaddset(pset, SIGPROF);
}

assert(timeout >= -1);
base = loop->time;
count = 48; /* Benchmarks suggest this gives the best throughput. */
Expand All @@ -128,13 +137,19 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
spec.tv_nsec = (timeout % 1000) * 1000000;
}

if (pset != NULL)
pthread_sigmask(SIG_BLOCK, pset, NULL);

nfds = kevent(loop->backend_fd,
events,
nevents,
events,
ARRAY_SIZE(events),
timeout == -1 ? NULL : &spec);

if (pset != NULL)
pthread_sigmask(SIG_UNBLOCK, pset, NULL);

/* Update loop->time unconditionally. It's tempting to skip the update when
* timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the
* operating system didn't reschedule our process while in the syscall.
Expand Down
24 changes: 17 additions & 7 deletions deps/uv/src/unix/linux-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <sys/prctl.h>
#include <sys/sysinfo.h>
#include <unistd.h>
#include <signal.h>
#include <fcntl.h>
#include <time.h>

Expand Down Expand Up @@ -130,6 +131,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
struct uv__epoll_event e;
ngx_queue_t* q;
uv__io_t* w;
sigset_t* pset;
sigset_t set;
uint64_t base;
uint64_t diff;
int nevents;
Expand Down Expand Up @@ -180,12 +183,25 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
w->events = w->pevents;
}

pset = NULL;
if (loop->flags & UV_LOOP_BLOCK_SIGPROF) {
pset = &set;
sigemptyset(pset);
sigaddset(pset, SIGPROF);
}

assert(timeout >= -1);
base = loop->time;
count = 48; /* Benchmarks suggest this gives the best throughput. */

for (;;) {
if (!no_epoll_wait) {
if (no_epoll_wait || pset != NULL) {
nfds = uv__epoll_pwait(loop->backend_fd,
events,
ARRAY_SIZE(events),
timeout,
pset);
} else {
nfds = uv__epoll_wait(loop->backend_fd,
events,
ARRAY_SIZE(events),
Expand All @@ -194,12 +210,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
no_epoll_wait = 1;
continue;
}
} else {
nfds = uv__epoll_pwait(loop->backend_fd,
events,
ARRAY_SIZE(events),
timeout,
NULL);
}

/* Update loop->time unconditionally. It's tempting to skip the update when
Expand Down
3 changes: 2 additions & 1 deletion deps/uv/src/unix/linux-syscalls.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "linux-syscalls.h"
#include <unistd.h>
#include <signal.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <errno.h>
Expand Down Expand Up @@ -298,7 +299,7 @@ int uv__epoll_pwait(int epfd,
nevents,
timeout,
sigmask,
sizeof(*sigmask));
_NSIG / 8);
#else
return errno = ENOSYS, -1;
#endif
Expand Down
8 changes: 6 additions & 2 deletions deps/uv/src/unix/linux-syscalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#if defined(__alpha__)
# define UV__O_NONBLOCK 0x4
#elif defined(__hppa__)
# define UV__O_NONBLOCK 0x10004
# define UV__O_NONBLOCK O_NONBLOCK
#elif defined(__mips__)
# define UV__O_NONBLOCK 0x80
#elif defined(__sparc__)
Expand All @@ -59,7 +59,11 @@
#define UV__IN_NONBLOCK UV__O_NONBLOCK

#define UV__SOCK_CLOEXEC UV__O_CLOEXEC
#define UV__SOCK_NONBLOCK UV__O_NONBLOCK
#if defined(SOCK_NONBLOCK)
# define UV__SOCK_NONBLOCK SOCK_NONBLOCK
#else
# define UV__SOCK_NONBLOCK UV__O_NONBLOCK
#endif

/* epoll flags */
#define UV__EPOLL_CLOEXEC UV__O_CLOEXEC
Expand Down
12 changes: 12 additions & 0 deletions deps/uv/src/unix/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,15 @@ void uv__loop_delete(uv_loop_t* loop) {
loop->watchers = NULL;
loop->nwatchers = 0;
}


int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) {
if (option != UV_LOOP_BLOCK_SIGNAL)
return UV_ENOSYS;

if (va_arg(ap, int) != SIGPROF)
return UV_EINVAL;

loop->flags |= UV_LOOP_BLOCK_SIGPROF;
return 0;
}
29 changes: 24 additions & 5 deletions deps/uv/src/unix/sunos.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,16 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
struct timespec spec;
ngx_queue_t* q;
uv__io_t* w;
sigset_t* pset;
sigset_t set;
uint64_t base;
uint64_t diff;
unsigned int nfds;
unsigned int i;
int saved_errno;
int nevents;
int count;
int err;
int fd;

if (loop->nfds == 0) {
Expand All @@ -140,6 +143,13 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
w->events = w->pevents;
}

pset = NULL;
if (loop->flags & UV_LOOP_BLOCK_SIGPROF) {
pset = &set;
sigemptyset(pset);
sigaddset(pset, SIGPROF);
}

assert(timeout >= -1);
base = loop->time;
count = 48; /* Benchmarks suggest this gives the best throughput. */
Expand All @@ -155,11 +165,20 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {

nfds = 1;
saved_errno = 0;
if (port_getn(loop->backend_fd,
events,
ARRAY_SIZE(events),
&nfds,
timeout == -1 ? NULL : &spec)) {

if (pset != NULL)
pthread_sigmask(SIG_BLOCK, pset, NULL);

err = port_getn(loop->backend_fd,
events,
ARRAY_SIZE(events),
&nfds,
timeout == -1 ? NULL : &spec);

if (pset != NULL)
pthread_sigmask(SIG_UNBLOCK, pset, NULL);

if (err) {
/* Work around another kernel bug: port_getn() may return events even
* on error.
*/
Expand Down
14 changes: 14 additions & 0 deletions deps/uv/src/uv-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include <stdio.h>
#include <assert.h>
#include <stdarg.h>
#include <stddef.h> /* NULL */
#include <stdlib.h> /* malloc */
#include <string.h> /* memset */
Expand Down Expand Up @@ -434,3 +435,16 @@ void uv_stop(uv_loop_t* loop) {
uint64_t uv_now(uv_loop_t* loop) {
return loop->time;
}


int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...) {
va_list ap;
int err;

va_start(ap, option);
/* Any platform-agnostic options should be handled here. */
err = uv__loop_configure(loop, option, ap);
va_end(ap);

return err;
}
2 changes: 2 additions & 0 deletions deps/uv/src/uv-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define UV_COMMON_H_

#include <assert.h>
#include <stdarg.h>
#include <stddef.h>

#if defined(_MSC_VER) && _MSC_VER < 1600
Expand Down Expand Up @@ -77,6 +78,7 @@ int uv__set_artificial_error(uv_loop_t* loop, uv_err_code code);
uv_err_t uv__new_sys_error(int sys_error);
uv_err_t uv__new_artificial_error(uv_err_code code);

int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap);
int uv__tcp_bind(uv_tcp_t* handle, struct sockaddr_in addr);
int uv__tcp_bind6(uv_tcp_t* handle, struct sockaddr_in6 addr);

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 29
#define UV_VERSION_PATCH 30
#define UV_VERSION_IS_RELEASE 1


Expand Down
5 changes: 5 additions & 0 deletions deps/uv/src/win/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ void uv_loop_delete(uv_loop_t* loop) {
}


int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) {
return UV_ENOSYS;
}


int uv_backend_fd(const uv_loop_t* loop) {
return -1;
}
Expand Down
Loading

0 comments on commit 1c031c8

Please sign in to comment.