Browse Source

uv: Upgrade to v0.11.1

v0.11.1-release
Fedor Indutny 12 years ago
parent
commit
061151c5f5
  1. 3
      deps/uv/.gitignore
  2. 5
      deps/uv/AUTHORS
  3. 38
      deps/uv/ChangeLog
  4. 6
      deps/uv/README.md
  5. 2
      deps/uv/build.mk
  6. 10
      deps/uv/common.gypi
  7. 30
      deps/uv/config-unix.mk
  8. 14
      deps/uv/include/uv.h
  9. 4
      deps/uv/src/inet.c
  10. 8
      deps/uv/src/unix/aix.c
  11. 4
      deps/uv/src/unix/core.c
  12. 3
      deps/uv/src/unix/cygwin.c
  13. 10
      deps/uv/src/unix/darwin.c
  14. 5
      deps/uv/src/unix/getaddrinfo.c
  15. 7
      deps/uv/src/unix/internal.h
  16. 10
      deps/uv/src/unix/linux-core.c
  17. 10
      deps/uv/src/unix/netbsd.c
  18. 10
      deps/uv/src/unix/stream.c
  19. 34
      deps/uv/src/unix/sunos.c
  20. 3
      deps/uv/src/version.c
  21. 13
      deps/uv/src/win/core.c
  22. 2
      deps/uv/src/win/fs.c
  23. 10
      deps/uv/src/win/poll.c
  24. 2
      deps/uv/src/win/tty.c
  25. 3
      deps/uv/src/win/udp.c
  26. 174
      deps/uv/src/win/util.c
  27. 6
      deps/uv/src/win/winsock.c
  28. 8
      deps/uv/test/test-platform-output.c
  29. 4
      deps/uv/test/test-tcp-writealot.c
  30. 65
      deps/uv/uv.gyp
  31. 8
      deps/uv/vcbuild.bat

3
deps/uv/.gitignore

@ -12,6 +12,9 @@ vgcore.*
/libuv.so /libuv.so
/libuv.dylib /libuv.dylib
# Generated by dtrace(1) when doing an in-tree build.
/src/unix/uv-dtrace.h
/out/ /out/
/build/gyp /build/gyp

5
deps/uv/AUTHORS

@ -79,3 +79,8 @@ Tim Bradshaw <tfb@cley.com>
Timothy J. Fontaine <tjfontaine@gmail.com> Timothy J. Fontaine <tjfontaine@gmail.com>
Marc Schlaich <marc.schlaich@googlemail.com> Marc Schlaich <marc.schlaich@googlemail.com>
Brian Mazza <louseman@gmail.com> Brian Mazza <louseman@gmail.com>
Elliot Saba <staticfloat@gmail.com>
Ben Kelly <ben@wanderview.com>
Kristian Evensen <kristian.evensen@gmail.com>
Nils Maier <maierman@web.de>
Nicholas Vavilov <vvnicholas@gmail.com>

38
deps/uv/ChangeLog

@ -1,3 +1,41 @@
2013.04.11, Version 0.11.1 (Unstable)
This is the first versioned release from the current unstable libuv branch.
Changes since Node.js v0.11.0:
* all platforms: nanosecond resolution support for uv_fs_[fl]stat (Timothy J.
Fontaine)
* all platforms: add netmask to uv_interface_address (Ben Kelly)
* unix: make sure the `status` parameter passed to the `uv_getaddrinfo` is 0 or
-1 (Ben Noordhuis)
* unix: limit the number of iovecs written in a single `writev` syscall to
IOV_MAX (Fedor Indutny)
* unix: add dtrace probes for tick-start and tick-stop (Timothy J. Fontaine)
* mingw-w64: don't call _set_invalid_parameter_handler (Nils Maier)
* windows: fix memory leak in fs__sendfile (Shannen Saez)
* windows: fix edge case bugs in uv_cpu_info (Bert Belder)
* include: no longer ship with / include ngx-queue.h (Ben Noordhuis)
* include: remove UV_VERSION_* macros from uv.h (Ben Noordhuis)
* documentation updates (Kristian Evensen, Ben Kelly, Ben Noordhuis)
* build: fix dtrace-enabled builds (Ben Noordhuis, Timothy J. Fontaine)
* build: gyp disable thin archives (Timothy J. Fontaine)
* build: add support for Visual Studio 2012 (Nicholas Vavilov)
2013.02.04, Version 0.10.3 (Stable) 2013.02.04, Version 0.10.3 (Stable)
Changes since version 0.10.2: Changes since version 0.10.2:

6
deps/uv/README.md

@ -109,10 +109,14 @@ autotools, add a `AC_GNU_SOURCE` declaration to your `configure.ac`.
## Supported Platforms ## Supported Platforms
Microsoft Windows operating systems since Windows XP SP2. It can be built Microsoft Windows operating systems since Windows XP SP2. It can be built
with either Visual Studio or MinGW. with either Visual Studio or MinGW. Consider using
[Visual Studio Express 2010][] or later if you do not have a full Visual
Studio license.
Linux 2.6 using the GCC toolchain. Linux 2.6 using the GCC toolchain.
MacOS using the GCC or XCode toolchain. MacOS using the GCC or XCode toolchain.
Solaris 121 and later using GCC toolchain. Solaris 121 and later using GCC toolchain.
[Visual Studio Express 2010]: http://www.microsoft.com/visualstudio/eng/products/visual-studio-2010-express

2
deps/uv/build.mk

@ -160,5 +160,5 @@ bench: run-benchmarks$(E)
clean distclean: clean-platform clean distclean: clean-platform
$(RM) libuv.a libuv.$(SOEXT) \ $(RM) libuv.a libuv.$(SOEXT) \
test/run-tests.o test/run-benchmarks.o \ test/run-tests.o test/run-benchmarks.o \
test/run-tests$(E) test/run-benchmarks$(E) \ test/runner.o run-tests$(E) test/run-benchmarks$(E) \
$(BENCHMARKS) $(TESTS) $(RUNNER_LIBS) $(BENCHMARKS) $(TESTS) $(RUNNER_LIBS)

10
deps/uv/common.gypi

@ -132,6 +132,11 @@
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
'cflags': [ '-Wall' ], 'cflags': [ '-Wall' ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ], 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
'target_conditions': [
['_type=="static_library"', {
'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
}],
],
'conditions': [ 'conditions': [
[ 'host_arch != target_arch and target_arch=="ia32"', { [ 'host_arch != target_arch and target_arch=="ia32"', {
'cflags': [ '-m32' ], 'cflags': [ '-m32' ],
@ -192,6 +197,11 @@
}], }],
], ],
}], }],
['OS=="solaris"', {
'cflags': [ '-fno-omit-frame-pointer' ],
# pull in V8's postmortem metadata
'ldflags': [ '-Wl,-z,allextract' ]
}],
], ],
}, },
} }

30
deps/uv/config-unix.mk

@ -33,6 +33,10 @@ RUNNER_SRC=test/runner-unix.c
RUNNER_CFLAGS=$(CFLAGS) -I$(SRCDIR)/test RUNNER_CFLAGS=$(CFLAGS) -I$(SRCDIR)/test
RUNNER_LDFLAGS=-L"$(CURDIR)" -luv -Xlinker -rpath -Xlinker "$(CURDIR)" RUNNER_LDFLAGS=-L"$(CURDIR)" -luv -Xlinker -rpath -Xlinker "$(CURDIR)"
HAVE_DTRACE=
DTRACE_OBJS=
DTRACE_HEADER=
OBJS += src/unix/async.o OBJS += src/unix/async.o
OBJS += src/unix/core.o OBJS += src/unix/core.o
OBJS += src/unix/dl.o OBJS += src/unix/dl.o
@ -58,11 +62,14 @@ OBJS += src/inet.o
OBJS += src/version.o OBJS += src/version.o
ifeq (sunos,$(PLATFORM)) ifeq (sunos,$(PLATFORM))
HAVE_DTRACE=1
CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
LDFLAGS+=-lkstat -lnsl -lsendfile -lsocket LDFLAGS+=-lkstat -lnsl -lsendfile -lsocket
# Library dependencies are not transitive. # Library dependencies are not transitive.
RUNNER_LDFLAGS += $(LDFLAGS) RUNNER_LDFLAGS += $(LDFLAGS)
OBJS += src/unix/sunos.o OBJS += src/unix/sunos.o
OBJS += src/unix/dtrace.o
DTRACE_OBJS += src/unix/core.o
endif endif
ifeq (aix,$(PLATFORM)) ifeq (aix,$(PLATFORM))
@ -72,6 +79,9 @@ OBJS += src/unix/aix.o
endif endif
ifeq (darwin,$(PLATFORM)) ifeq (darwin,$(PLATFORM))
HAVE_DTRACE=1
# dtrace(1) probes contain dollar signs.
CFLAGS += -Wno-dollar-in-identifier-extension
CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1 CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
LDFLAGS += -framework Foundation \ LDFLAGS += -framework Foundation \
-framework CoreServices \ -framework CoreServices \
@ -96,6 +106,7 @@ OBJS += src/unix/linux-core.o \
endif endif
ifeq (freebsd,$(PLATFORM)) ifeq (freebsd,$(PLATFORM))
HAVE_DTRACE=1
LDFLAGS+=-lkvm LDFLAGS+=-lkvm
OBJS += src/unix/freebsd.o OBJS += src/unix/freebsd.o
OBJS += src/unix/kqueue.o OBJS += src/unix/kqueue.o
@ -132,6 +143,12 @@ else
RUNNER_LDFLAGS += -pthread RUNNER_LDFLAGS += -pthread
endif endif
ifeq ($(HAVE_DTRACE), 1)
DTRACE_HEADER = src/unix/uv-dtrace.h
CPPFLAGS += -Isrc/unix
CFLAGS += -DHAVE_DTRACE
endif
libuv.a: $(OBJS) libuv.a: $(OBJS)
$(AR) rcs $@ $^ $(AR) rcs $@ $^
@ -152,7 +169,7 @@ src/.buildstamp src/unix/.buildstamp test/.buildstamp:
mkdir -p $(@D) mkdir -p $(@D)
touch $@ touch $@
src/unix/%.o src/unix/%.pic.o: src/unix/%.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h src/unix/.buildstamp src/unix/%.o src/unix/%.pic.o: src/unix/%.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h src/unix/.buildstamp $(DTRACE_HEADER)
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ $(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
src/%.o src/%.pic.o: src/%.c include/uv.h include/uv-private/uv-unix.h src/.buildstamp src/%.o src/%.pic.o: src/%.c include/uv.h include/uv-private/uv-unix.h src/.buildstamp
@ -162,7 +179,16 @@ test/%.o: test/%.c include/uv.h test/.buildstamp
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@ $(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
clean-platform: clean-platform:
$(RM) test/run-{tests,benchmarks}.dSYM $(OBJS) $(OBJS:%.o=%.pic.o) $(RM) test/run-{tests,benchmarks}.dSYM $(OBJS) $(OBJS:%.o=%.pic.o) src/unix/uv-dtrace.h
%.pic.o %.o: %.m %.pic.o %.o: %.m
$(OBJC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@ $(OBJC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@
src/unix/uv-dtrace.h: src/unix/uv-dtrace.d
dtrace -h -xnolibs -s $< -o $@
src/unix/dtrace.o: src/unix/uv-dtrace.d $(DTRACE_OBJS)
dtrace -G -s $^ -o $@
src/unix/dtrace.pic.o: src/unix/uv-dtrace.d $(DTRACE_OBJS:%.o=%.pic.o)
dtrace -G -s $^ -o $@

14
deps/uv/include/uv.h

@ -289,8 +289,8 @@ UV_EXTERN uint64_t uv_now(uv_loop_t*);
* Get backend file descriptor. Only kqueue, epoll and event ports are * Get backend file descriptor. Only kqueue, epoll and event ports are
* supported. * supported.
* *
* This can be used in conjunction with uv_run_once() to poll in one thread and * This can be used in conjunction with `uv_run(loop, UV_RUN_NOWAIT)` to
* run the event loop's event callbacks in another. * poll in one thread and run the event loop's event callbacks in another.
* *
* Useful for embedding libuv's event loop in another event loop. * Useful for embedding libuv's event loop in another event loop.
* See test/test-embed.c for an example. * See test/test-embed.c for an example.
@ -787,6 +787,12 @@ UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle);
/* /*
* Opens an existing file descriptor or SOCKET as a udp handle. * Opens an existing file descriptor or SOCKET as a udp handle.
*
* Unix only:
* The only requirement of the sock argument is that it follows the
* datagram contract (works in unconnected mode, supports sendmsg()/recvmsg(),
* etc.). In other words, other datagram-type sockets like raw sockets or
* netlink sockets can also be passed to this function.
*/ */
UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock); UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock);
@ -1473,6 +1479,10 @@ struct uv_interface_address_s {
struct sockaddr_in address4; struct sockaddr_in address4;
struct sockaddr_in6 address6; struct sockaddr_in6 address6;
} address; } address;
union {
struct sockaddr_in netmask4;
struct sockaddr_in6 netmask6;
} netmask;
}; };
UV_EXTERN char** uv_setup_args(int argc, char** argv); UV_EXTERN char** uv_setup_args(int argc, char** argv);

4
deps/uv/src/inet.c

@ -54,14 +54,14 @@ uv_err_t uv_inet_ntop(int af, const void* src, char* dst, size_t size) {
static uv_err_t inet_ntop4(const unsigned char *src, char *dst, size_t size) { static uv_err_t inet_ntop4(const unsigned char *src, char *dst, size_t size) {
static const char fmt[] = "%u.%u.%u.%u"; static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"]; char tmp[sizeof "255.255.255.255"];
size_t l; int l;
#ifndef _WIN32 #ifndef _WIN32
l = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]); l = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
#else #else
l = _snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]); l = _snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
#endif #endif
if (l <= 0 || l >= size) { if (l <= 0 || (size_t) l >= size) {
return uv_enospc_; return uv_enospc_;
} }
strncpy(dst, tmp, size); strncpy(dst, tmp, size);

8
deps/uv/src/unix/aix.c

@ -62,7 +62,6 @@ uint64_t uv__hrtime(void) {
int uv_exepath(char* buffer, size_t* size) { int uv_exepath(char* buffer, size_t* size) {
ssize_t res; ssize_t res;
char pp[64], cwdl[PATH_MAX]; char pp[64], cwdl[PATH_MAX];
size_t cwdl_len;
struct psinfo ps; struct psinfo ps;
int fd; int fd;
@ -79,7 +78,6 @@ int uv_exepath(char* buffer, size_t* size) {
return res; return res;
cwdl[res] = '\0'; cwdl[res] = '\0';
cwdl_len = res;
(void) snprintf(pp, sizeof(pp), "/proc/%lu/psinfo", (unsigned long) getpid()); (void) snprintf(pp, sizeof(pp), "/proc/%lu/psinfo", (unsigned long) getpid());
fd = open(pp, O_RDONLY); fd = open(pp, O_RDONLY);
@ -364,11 +362,13 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
address->name = strdup(p->ifr_name); address->name = strdup(p->ifr_name);
if (p->ifr_addr.sa_family == AF_INET6) { if (p->ifr_addr.sa_family == AF_INET6) {
address->address.address6 = *((struct sockaddr_in6 *)&p->ifr_addr); address->address.address6 = *((struct sockaddr_in6*) &p->ifr_addr);
} else { } else {
address->address.address4 = *((struct sockaddr_in *)&p->ifr_addr); address->address.address4 = *((struct sockaddr_in*) &p->ifr_addr);
} }
/* TODO: Retrieve netmask using SIOCGIFNETMASK ioctl */
address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0; address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0;
address++; address++;

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

@ -299,6 +299,8 @@ int uv_run(uv_loop_t* loop, uv_run_mode mode) {
r = uv__loop_alive(loop); r = uv__loop_alive(loop);
while (r != 0 && loop->stop_flag == 0) { while (r != 0 && loop->stop_flag == 0) {
UV_TICK_START(loop, mode);
uv__update_time(loop); uv__update_time(loop);
uv__run_timers(loop); uv__run_timers(loop);
uv__run_idle(loop); uv__run_idle(loop);
@ -314,6 +316,8 @@ int uv_run(uv_loop_t* loop, uv_run_mode mode) {
uv__run_closing_handles(loop); uv__run_closing_handles(loop);
r = uv__loop_alive(loop); r = uv__loop_alive(loop);
UV_TICK_STOP(loop, mode);
if (mode & (UV_RUN_ONCE | UV_RUN_NOWAIT)) if (mode & (UV_RUN_ONCE | UV_RUN_NOWAIT))
break; break;
} }

3
deps/uv/src/unix/cygwin.c

@ -56,9 +56,6 @@ void uv_loadavg(double avg[3]) {
int uv_exepath(char* buffer, size_t* size) { int uv_exepath(char* buffer, size_t* size) {
uint32_t usize; uint32_t usize;
int result;
char* path;
char* fullpath;
if (!buffer || !size) { if (!buffer || !size) {
return -1; return -1;

10
deps/uv/src/unix/darwin.c

@ -403,9 +403,15 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
address->name = strdup(ent->ifa_name); address->name = strdup(ent->ifa_name);
if (ent->ifa_addr->sa_family == AF_INET6) { if (ent->ifa_addr->sa_family == AF_INET6) {
address->address.address6 = *((struct sockaddr_in6 *)ent->ifa_addr); address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr);
} else { } else {
address->address.address4 = *((struct sockaddr_in *)ent->ifa_addr); address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
}
if (ent->ifa_netmask->sa_family == AF_INET6) {
address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
} else {
address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
} }
address->is_internal = ent->ifa_flags & IFF_LOOPBACK ? 1 : 0; address->is_internal = ent->ifa_flags & IFF_LOOPBACK ? 1 : 0;

5
deps/uv/src/unix/getaddrinfo.c

@ -87,8 +87,9 @@ static void uv__getaddrinfo_done(struct uv__work* w, int status) {
#if defined(EAI_NODATA) /* Newer FreeBSDs don't have EAI_NODATA. */ #if defined(EAI_NODATA) /* Newer FreeBSDs don't have EAI_NODATA. */
else if (req->retcode == EAI_NODATA) else if (req->retcode == EAI_NODATA)
uv__set_sys_error(req->loop, ENOENT); uv__set_sys_error(req->loop, ENOENT);
#elif defined(__sun) #endif
if (req->retcode == EAI_MEMORY && hostlen >= MAXHOSTNAMELEN) { #if defined(__sun)
else if (req->retcode == EAI_MEMORY && hostlen >= MAXHOSTNAMELEN)
uv__set_sys_error(req->loop, ENOENT); uv__set_sys_error(req->loop, ENOENT);
#endif #endif
else { else {

7
deps/uv/src/unix/internal.h

@ -256,4 +256,11 @@ static void uv__update_time(uv_loop_t* loop) {
loop->time = uv__hrtime() / 1000000; loop->time = uv__hrtime() / 1000000;
} }
#ifdef HAVE_DTRACE
#include "uv-dtrace.h"
#else
#define UV_TICK_START(arg0, arg1)
#define UV_TICK_STOP(arg0, arg1)
#endif
#endif /* UV_UNIX_INTERNAL_H_ */ #endif /* UV_UNIX_INTERNAL_H_ */

10
deps/uv/src/unix/linux-core.c

@ -688,9 +688,15 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
address->name = strdup(ent->ifa_name); address->name = strdup(ent->ifa_name);
if (ent->ifa_addr->sa_family == AF_INET6) { if (ent->ifa_addr->sa_family == AF_INET6) {
address->address.address6 = *((struct sockaddr_in6 *)ent->ifa_addr); address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr);
} else { } else {
address->address.address4 = *((struct sockaddr_in *)ent->ifa_addr); address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
}
if (ent->ifa_netmask->sa_family == AF_INET6) {
address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
} else {
address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
} }
address->is_internal = ent->ifa_flags & IFF_LOOPBACK ? 1 : 0; address->is_internal = ent->ifa_flags & IFF_LOOPBACK ? 1 : 0;

10
deps/uv/src/unix/netbsd.c

@ -326,9 +326,15 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses, int* count)
address->name = strdup(ent->ifa_name); address->name = strdup(ent->ifa_name);
if (ent->ifa_addr->sa_family == AF_INET6) { if (ent->ifa_addr->sa_family == AF_INET6) {
address->address.address6 = *((struct sockaddr_in6 *)ent->ifa_addr); address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr);
} else { } else {
address->address.address4 = *((struct sockaddr_in *)ent->ifa_addr); address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
}
if (ent->ifa_netmask->sa_family == AF_INET6) {
address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
} else {
address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
} }
address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK) ? 1 : 0; address->is_internal = !!(ent->ifa_flags & IFF_LOOPBACK) ? 1 : 0;

10
deps/uv/src/unix/stream.c

@ -33,6 +33,7 @@
#include <sys/uio.h> #include <sys/uio.h>
#include <sys/un.h> #include <sys/un.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h> /* IOV_MAX */
#if defined(__APPLE__) #if defined(__APPLE__)
# include <sys/event.h> # include <sys/event.h>
@ -484,8 +485,7 @@ void uv__server_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
assert(stream->accepted_fd == -1); assert(stream->accepted_fd == -1);
assert(!(stream->flags & UV_CLOSING)); assert(!(stream->flags & UV_CLOSING));
if (stream->accepted_fd == -1) uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN);
uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN);
/* connection_cb can close the server socket while we're /* connection_cb can close the server socket while we're
* in the loop so check it on each iteration. * in the loop so check it on each iteration.
@ -742,6 +742,10 @@ start:
iov = (struct iovec*) &(req->bufs[req->write_index]); iov = (struct iovec*) &(req->bufs[req->write_index]);
iovcnt = req->bufcnt - req->write_index; iovcnt = req->bufcnt - req->write_index;
/* Limit iov count to avoid EINVALs from writev() */
if (iovcnt > IOV_MAX)
iovcnt = IOV_MAX;
/* /*
* Now do the actual writev. Note that we've been updating the pointers * Now do the actual writev. Note that we've been updating the pointers
* inside the iov each time we write. So there is no need to offset it. * inside the iov each time we write. So there is no need to offset it.
@ -962,7 +966,7 @@ static void uv__read(uv_stream_t* stream) {
msg.msg_namelen = 0; msg.msg_namelen = 0;
/* Set up to receive a descriptor even if one isn't in the message */ /* Set up to receive a descriptor even if one isn't in the message */
msg.msg_controllen = 64; msg.msg_controllen = 64;
msg.msg_control = (void *) cmsg_space; msg.msg_control = (void*) cmsg_space;
do { do {
nread = recvmsg(uv__stream_fd(stream), &msg, 0); nread = recvmsg(uv__stream_fd(stream), &msg, 0);

34
deps/uv/src/unix/sunos.c

@ -322,7 +322,7 @@ static void uv__fs_event_read(uv_loop_t* loop,
if ((r == -1 && errno == ETIME) || n == 0) if ((r == -1 && errno == ETIME) || n == 0)
break; break;
handle = (uv_fs_event_t *)pe.portev_user; handle = (uv_fs_event_t*) pe.portev_user;
assert((r == 0) && "unexpected port_get() error"); assert((r == 0) && "unexpected port_get() error");
events = 0; events = 0;
@ -457,12 +457,12 @@ uv_err_t uv_uptime(double* uptime) {
if ((kc = kstat_open()) == NULL) if ((kc = kstat_open()) == NULL)
return uv__new_sys_error(errno); return uv__new_sys_error(errno);
ksp = kstat_lookup(kc, (char *)"unix", 0, (char *)"system_misc"); ksp = kstat_lookup(kc, (char*) "unix", 0, (char*) "system_misc");
if (kstat_read(kc, ksp, NULL) == -1) { if (kstat_read(kc, ksp, NULL) == -1) {
*uptime = -1; *uptime = -1;
} else { } else {
knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"clk_intr"); knp = (kstat_named_t*) kstat_data_lookup(ksp, (char*) "clk_intr");
*uptime = knp->value.ul / hz; *uptime = knp->value.ul / hz;
} }
@ -485,7 +485,7 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
/* Get count of cpus */ /* Get count of cpus */
lookup_instance = 0; lookup_instance = 0;
while ((ksp = kstat_lookup(kc, (char *)"cpu_info", lookup_instance, NULL))) { while ((ksp = kstat_lookup(kc, (char*) "cpu_info", lookup_instance, NULL))) {
lookup_instance++; lookup_instance++;
} }
@ -499,18 +499,18 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
cpu_info = *cpu_infos; cpu_info = *cpu_infos;
lookup_instance = 0; lookup_instance = 0;
while ((ksp = kstat_lookup(kc, (char *)"cpu_info", lookup_instance, NULL))) { while ((ksp = kstat_lookup(kc, (char*) "cpu_info", lookup_instance, NULL))) {
if (kstat_read(kc, ksp, NULL) == -1) { if (kstat_read(kc, ksp, NULL) == -1) {
cpu_info->speed = 0; cpu_info->speed = 0;
cpu_info->model = NULL; cpu_info->model = NULL;
} else { } else {
knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"clock_MHz"); knp = (kstat_named_t*) kstat_data_lookup(ksp, (char*) "clock_MHz");
assert(knp->data_type == KSTAT_DATA_INT32 || assert(knp->data_type == KSTAT_DATA_INT32 ||
knp->data_type == KSTAT_DATA_INT64); knp->data_type == KSTAT_DATA_INT64);
cpu_info->speed = (knp->data_type == KSTAT_DATA_INT32) ? knp->value.i32 cpu_info->speed = (knp->data_type == KSTAT_DATA_INT32) ? knp->value.i32
: knp->value.i64; : knp->value.i64;
knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"brand"); knp = (kstat_named_t*) kstat_data_lookup(ksp, (char*) "brand");
assert(knp->data_type == KSTAT_DATA_STRING); assert(knp->data_type == KSTAT_DATA_STRING);
cpu_info->model = strdup(KSTAT_NAMED_STR_PTR(knp)); cpu_info->model = strdup(KSTAT_NAMED_STR_PTR(knp));
} }
@ -521,7 +521,7 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
cpu_info = *cpu_infos; cpu_info = *cpu_infos;
lookup_instance = 0; lookup_instance = 0;
while ((ksp = kstat_lookup(kc, (char *)"cpu", lookup_instance, (char *)"sys"))){ while ((ksp = kstat_lookup(kc, (char*) "cpu", lookup_instance, (char*) "sys"))){
if (kstat_read(kc, ksp, NULL) == -1) { if (kstat_read(kc, ksp, NULL) == -1) {
cpu_info->cpu_times.user = 0; cpu_info->cpu_times.user = 0;
@ -530,19 +530,19 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
cpu_info->cpu_times.idle = 0; cpu_info->cpu_times.idle = 0;
cpu_info->cpu_times.irq = 0; cpu_info->cpu_times.irq = 0;
} else { } else {
knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"cpu_ticks_user"); knp = (kstat_named_t*) kstat_data_lookup(ksp, (char*) "cpu_ticks_user");
assert(knp->data_type == KSTAT_DATA_UINT64); assert(knp->data_type == KSTAT_DATA_UINT64);
cpu_info->cpu_times.user = knp->value.ui64; cpu_info->cpu_times.user = knp->value.ui64;
knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"cpu_ticks_kernel"); knp = (kstat_named_t*) kstat_data_lookup(ksp, (char*) "cpu_ticks_kernel");
assert(knp->data_type == KSTAT_DATA_UINT64); assert(knp->data_type == KSTAT_DATA_UINT64);
cpu_info->cpu_times.sys = knp->value.ui64; cpu_info->cpu_times.sys = knp->value.ui64;
knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"cpu_ticks_idle"); knp = (kstat_named_t*) kstat_data_lookup(ksp, (char*) "cpu_ticks_idle");
assert(knp->data_type == KSTAT_DATA_UINT64); assert(knp->data_type == KSTAT_DATA_UINT64);
cpu_info->cpu_times.idle = knp->value.ui64; cpu_info->cpu_times.idle = knp->value.ui64;
knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"intr"); knp = (kstat_named_t*) kstat_data_lookup(ksp, (char*) "intr");
assert(knp->data_type == KSTAT_DATA_UINT64); assert(knp->data_type == KSTAT_DATA_UINT64);
cpu_info->cpu_times.irq = knp->value.ui64; cpu_info->cpu_times.irq = knp->value.ui64;
cpu_info->cpu_times.nice = 0; cpu_info->cpu_times.nice = 0;
@ -617,9 +617,15 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
address->name = strdup(ent->ifa_name); address->name = strdup(ent->ifa_name);
if (ent->ifa_addr->sa_family == AF_INET6) { if (ent->ifa_addr->sa_family == AF_INET6) {
address->address.address6 = *((struct sockaddr_in6 *)ent->ifa_addr); address->address.address6 = *((struct sockaddr_in6*) ent->ifa_addr);
} else { } else {
address->address.address4 = *((struct sockaddr_in *)ent->ifa_addr); address->address.address4 = *((struct sockaddr_in*) ent->ifa_addr);
}
if (ent->ifa_netmask->sa_family == AF_INET6) {
address->netmask.netmask6 = *((struct sockaddr_in6*) ent->ifa_netmask);
} else {
address->netmask.netmask4 = *((struct sockaddr_in*) ent->ifa_netmask);
} }
address->is_internal = ent->ifa_flags & IFF_PRIVATE || ent->ifa_flags & address->is_internal = ent->ifa_flags & IFF_PRIVATE || ent->ifa_flags &

3
deps/uv/src/version.c

@ -19,6 +19,7 @@
* IN THE SOFTWARE. * IN THE SOFTWARE.
*/ */
#include "uv.h"
/* /*
* Versions with an even minor version (e.g. 0.6.1 or 1.0.4) are API and ABI * Versions with an even minor version (e.g. 0.6.1 or 1.0.4) are API and ABI
@ -29,7 +30,7 @@
#define UV_VERSION_MAJOR 0 #define UV_VERSION_MAJOR 0
#define UV_VERSION_MINOR 11 #define UV_VERSION_MINOR 11
#define UV_VERSION_PATCH 1 #define UV_VERSION_PATCH 1
#define UV_VERSION_IS_RELEASE 0 #define UV_VERSION_IS_RELEASE 1
#define UV_VERSION ((UV_VERSION_MAJOR << 16) | \ #define UV_VERSION ((UV_VERSION_MAJOR << 16) | \

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

@ -55,7 +55,7 @@ static void uv_init(void) {
/* Tell the CRT to not exit the application when an invalid parameter is */ /* Tell the CRT to not exit the application when an invalid parameter is */
/* passed. The main issue is that invalid FDs will trigger this behavior. */ /* passed. The main issue is that invalid FDs will trigger this behavior. */
#ifdef _WRITE_ABORT_MSG #if !defined(__MINGW32__) || __MSVCRT_VERSION__ >= 0x800
_set_invalid_parameter_handler(uv__crt_invalid_parameter_handler); _set_invalid_parameter_handler(uv__crt_invalid_parameter_handler);
#endif #endif
@ -185,7 +185,6 @@ int uv_backend_timeout(const uv_loop_t* loop) {
static void uv_poll(uv_loop_t* loop, int block) { static void uv_poll(uv_loop_t* loop, int block) {
BOOL success;
DWORD bytes, timeout; DWORD bytes, timeout;
ULONG_PTR key; ULONG_PTR key;
OVERLAPPED* overlapped; OVERLAPPED* overlapped;
@ -197,11 +196,11 @@ static void uv_poll(uv_loop_t* loop, int block) {
timeout = 0; timeout = 0;
} }
success = GetQueuedCompletionStatus(loop->iocp, GetQueuedCompletionStatus(loop->iocp,
&bytes, &bytes,
&key, &key,
&overlapped, &overlapped,
timeout); timeout);
if (overlapped) { if (overlapped) {
/* Package was dequeued */ /* Package was dequeued */

2
deps/uv/src/win/fs.c

@ -1062,6 +1062,8 @@ static void fs__sendfile(uv_fs_t* req) {
} }
} }
free(buf);
SET_REQ_RESULT(req, result); SET_REQ_RESULT(req, result);
} }

10
deps/uv/src/win/poll.c

@ -311,7 +311,7 @@ static SOCKET uv__fast_poll_get_peer_socket(uv_loop_t* loop,
static DWORD WINAPI uv__slow_poll_thread_proc(void* arg) { static DWORD WINAPI uv__slow_poll_thread_proc(void* arg) {
uv_req_t* req = (uv_req_t*) arg; uv_req_t* req = (uv_req_t*) arg;
uv_poll_t* handle = (uv_poll_t*) req->data; uv_poll_t* handle = (uv_poll_t*) req->data;
unsigned char events, reported_events; unsigned char reported_events;
int r; int r;
uv_single_fd_set_t rfds, wfds, efds; uv_single_fd_set_t rfds, wfds, efds;
struct timeval timeout; struct timeval timeout;
@ -319,14 +319,6 @@ static DWORD WINAPI uv__slow_poll_thread_proc(void* arg) {
assert(handle->type == UV_POLL); assert(handle->type == UV_POLL);
assert(req->type == UV_POLL_REQ); assert(req->type == UV_POLL_REQ);
if (req == &handle->poll_req_1) {
events = handle->submitted_events_1;
} else if (req == &handle->poll_req_2) {
events = handle->submitted_events_2;
} else {
assert(0);
}
if (handle->events & UV_READABLE) { if (handle->events & UV_READABLE) {
rfds.fd_count = 1; rfds.fd_count = 1;
rfds.fd_array[0] = handle->socket; rfds.fd_array[0] = handle->socket;

2
deps/uv/src/win/tty.c

@ -96,7 +96,7 @@ void uv_console_init() {
int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) { int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, uv_file fd, int readable) {
HANDLE handle = INVALID_HANDLE_VALUE; HANDLE handle;
CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info; CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
handle = (HANDLE) _get_osfhandle(fd); handle = (HANDLE) _get_osfhandle(fd);

3
deps/uv/src/win/udp.c

@ -182,7 +182,7 @@ static int uv__bind(uv_udp_t* handle,
int addrsize, int addrsize,
unsigned int flags) { unsigned int flags) {
int r; int r;
DWORD no = 0, yes = 1; DWORD no = 0;
if ((flags & UV_UDP_IPV6ONLY) && family != AF_INET6) { if ((flags & UV_UDP_IPV6ONLY) && family != AF_INET6) {
/* UV_UDP_IPV6ONLY is supported only for IPV6 sockets */ /* UV_UDP_IPV6ONLY is supported only for IPV6 sockets */
@ -658,7 +658,6 @@ int uv_udp_set_broadcast(uv_udp_t* handle, int value) {
int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) { int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) {
WSAPROTOCOL_INFOW protocol_info; WSAPROTOCOL_INFOW protocol_info;
int opt_len; int opt_len;
DWORD yes = 1;
/* Detect the address family of the socket. */ /* Detect the address family of the socket. */
opt_len = (int) sizeof protocol_info; opt_len = (int) sizeof protocol_info;

174
deps/uv/src/win/util.c

@ -31,6 +31,7 @@
#include "uv.h" #include "uv.h"
#include "internal.h" #include "internal.h"
#include <Winsock2.h>
#include <iphlpapi.h> #include <iphlpapi.h>
#include <psapi.h> #include <psapi.h>
#include <tlhelp32.h> #include <tlhelp32.h>
@ -578,47 +579,50 @@ uv_err_t uv_uptime(double* uptime) {
} }
uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos_ptr, int* cpu_count_ptr) {
uv_cpu_info_t* cpu_infos;
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* sppi; SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* sppi;
DWORD sppi_size; DWORD sppi_size;
SYSTEM_INFO system_info; SYSTEM_INFO system_info;
DWORD cpu_count, i, r; DWORD cpu_count, r, i;
NTSTATUS status;
ULONG result_size; ULONG result_size;
size_t size;
uv_err_t err; uv_err_t err;
uv_cpu_info_t* cpu_info; uv_cpu_info_t* cpu_info;
*cpu_infos = NULL; cpu_infos = NULL;
*count = 0; cpu_count = 0;
sppi = NULL;
uv__once_init(); uv__once_init();
GetSystemInfo(&system_info); GetSystemInfo(&system_info);
cpu_count = system_info.dwNumberOfProcessors; cpu_count = system_info.dwNumberOfProcessors;
size = cpu_count * sizeof(uv_cpu_info_t); cpu_infos = calloc(cpu_count, sizeof *cpu_infos);
*cpu_infos = (uv_cpu_info_t*) malloc(size); if (cpu_infos == NULL) {
if (*cpu_infos == NULL) {
err = uv__new_artificial_error(UV_ENOMEM); err = uv__new_artificial_error(UV_ENOMEM);
goto out; goto error;
} }
memset(*cpu_infos, 0, size);
sppi_size = sizeof(*sppi) * cpu_count; sppi_size = cpu_count * sizeof(*sppi);
sppi = (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION*) malloc(sppi_size); sppi = malloc(sppi_size);
if (!sppi) { if (sppi == NULL) {
uv_fatal_error(ERROR_OUTOFMEMORY, "malloc"); err = uv__new_artificial_error(UV_ENOMEM);
goto error;
} }
r = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation,
sppi, sppi,
sppi_size, sppi_size,
&result_size); &result_size);
if (r != ERROR_SUCCESS || result_size != sppi_size) { if (!NT_SUCCESS(status)) {
err = uv__new_sys_error(GetLastError()); err = uv__new_sys_error(pRtlNtStatusToDosError(status));
goto out; goto error;
} }
assert(result_size == sppi_size);
for (i = 0; i < cpu_count; i++) { for (i = 0; i < cpu_count; i++) {
WCHAR key_name[128]; WCHAR key_name[128];
HKEY processor_key; HKEY processor_key;
@ -626,11 +630,14 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
DWORD cpu_speed_size = sizeof(cpu_speed); DWORD cpu_speed_size = sizeof(cpu_speed);
WCHAR cpu_brand[256]; WCHAR cpu_brand[256];
DWORD cpu_brand_size = sizeof(cpu_brand); DWORD cpu_brand_size = sizeof(cpu_brand);
int len;
len = _snwprintf(key_name,
ARRAY_SIZE(key_name),
L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%d",
i);
_snwprintf(key_name, assert(len > 0 && len < ARRAY_SIZE(key_name));
ARRAY_SIZE(key_name),
L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%d",
i);
r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, r = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
key_name, key_name,
@ -639,32 +646,34 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
&processor_key); &processor_key);
if (r != ERROR_SUCCESS) { if (r != ERROR_SUCCESS) {
err = uv__new_sys_error(GetLastError()); err = uv__new_sys_error(GetLastError());
goto out; goto error;
} }
if (RegQueryValueExW(processor_key, if (RegQueryValueExW(processor_key,
L"~MHz", L"~MHz",
NULL, NULL, NULL,
NULL,
(BYTE*) &cpu_speed, (BYTE*) &cpu_speed,
&cpu_speed_size) != ERROR_SUCCESS) { &cpu_speed_size) != ERROR_SUCCESS) {
err = uv__new_sys_error(GetLastError()); err = uv__new_sys_error(GetLastError());
RegCloseKey(processor_key); RegCloseKey(processor_key);
goto out; goto error;
} }
if (RegQueryValueExW(processor_key, if (RegQueryValueExW(processor_key,
L"ProcessorNameString", L"ProcessorNameString",
NULL, NULL, NULL,
NULL,
(BYTE*) &cpu_brand, (BYTE*) &cpu_brand,
&cpu_brand_size) != ERROR_SUCCESS) { &cpu_brand_size) != ERROR_SUCCESS) {
err = uv__new_sys_error(GetLastError()); err = uv__new_sys_error(GetLastError());
RegCloseKey(processor_key); RegCloseKey(processor_key);
goto out; goto error;
} }
RegCloseKey(processor_key); RegCloseKey(processor_key);
cpu_info = &(*cpu_infos)[i]; cpu_info = &cpu_infos[i];
cpu_info->speed = cpu_speed; cpu_info->speed = cpu_speed;
cpu_info->cpu_times.user = sppi[i].UserTime.QuadPart / 10000; cpu_info->cpu_times.user = sppi[i].UserTime.QuadPart / 10000;
cpu_info->cpu_times.sys = (sppi[i].KernelTime.QuadPart - cpu_info->cpu_times.sys = (sppi[i].KernelTime.QuadPart -
@ -673,57 +682,59 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
cpu_info->cpu_times.irq = sppi[i].InterruptTime.QuadPart / 10000; cpu_info->cpu_times.irq = sppi[i].InterruptTime.QuadPart / 10000;
cpu_info->cpu_times.nice = 0; cpu_info->cpu_times.nice = 0;
size = uv_utf16_to_utf8(cpu_brand,
cpu_brand_size / sizeof(WCHAR), len = WideCharToMultiByte(CP_UTF8,
NULL, 0,
0); cpu_brand,
if (size == 0) { cpu_brand_size / sizeof(WCHAR),
NULL,
0,
NULL,
NULL);
if (len == 0) {
err = uv__new_sys_error(GetLastError()); err = uv__new_sys_error(GetLastError());
goto out; goto error;
} }
assert(len > 0);
/* Allocate 1 extra byte for the null terminator. */ /* Allocate 1 extra byte for the null terminator. */
cpu_info->model = (char*) malloc(size + 1); cpu_info->model = malloc(len + 1);
if (cpu_info->model == NULL) { if (cpu_info->model == NULL) {
err = uv__new_artificial_error(UV_ENOMEM); err = uv__new_artificial_error(UV_ENOMEM);
goto out; goto error;
} }
if (uv_utf16_to_utf8(cpu_brand, if (WideCharToMultiByte(CP_UTF8,
cpu_brand_size / sizeof(WCHAR), 0,
cpu_info->model, cpu_brand,
size) == 0) { cpu_brand_size / sizeof(WCHAR),
cpu_info->model,
len,
NULL,
NULL) == 0) {
err = uv__new_sys_error(GetLastError()); err = uv__new_sys_error(GetLastError());
goto out; goto error;
} }
/* Ensure that cpu_info->model is null terminated. */ /* Ensure that cpu_info->model is null terminated. */
cpu_info->model[size] = '\0'; cpu_info->model[len] = '\0';
(*count)++;
} }
err = uv_ok_; free(sppi);
out: *cpu_count_ptr = cpu_count;
if (sppi) { *cpu_infos_ptr = cpu_infos;
free(sppi);
}
if (err.code != UV_OK && return uv_ok_;
*cpu_infos != NULL) {
int i;
for (i = 0; i < *count; i++) { error:
/* This is safe because the cpu_infos memory area is zeroed out */ /* This is safe because the cpu_infos array is zeroed on allocation. */
/* immediately after allocating it. */ for (i = 0; i < cpu_count; i++)
free((*cpu_infos)[i].model); free(cpu_infos[i].model);
}
free(*cpu_infos);
*cpu_infos = NULL; free(cpu_infos);
*count = 0; free(sppi);
}
return err; return err;
} }
@ -765,7 +776,7 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses_ptr,
/* ERROR_BUFFER_OVERFLOW, and the required buffer size will be stored in */ /* ERROR_BUFFER_OVERFLOW, and the required buffer size will be stored in */
/* win_address_buf_size. */ /* win_address_buf_size. */
r = GetAdaptersAddresses(AF_UNSPEC, r = GetAdaptersAddresses(AF_UNSPEC,
0, GAA_FLAG_INCLUDE_PREFIX,
NULL, NULL,
win_address_buf, win_address_buf,
&win_address_buf_size); &win_address_buf_size);
@ -882,6 +893,7 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses_ptr,
win_address != NULL; win_address != NULL;
win_address = win_address->Next) { win_address = win_address->Next) {
IP_ADAPTER_UNICAST_ADDRESS_XP* unicast_address; IP_ADAPTER_UNICAST_ADDRESS_XP* unicast_address;
IP_ADAPTER_PREFIX* prefix;
int name_size; int name_size;
size_t max_name_size; size_t max_name_size;
@ -907,23 +919,41 @@ uv_err_t uv_interface_addresses(uv_interface_address_t** addresses_ptr,
return uv__new_sys_error(GetLastError()); return uv__new_sys_error(GetLastError());
} }
prefix = win_address->FirstPrefix;
/* Add an uv_interface_address_t element for every unicast address. */ /* Add an uv_interface_address_t element for every unicast address. */
/* Walk the prefix list in tandem with the address list. */
for (unicast_address = (IP_ADAPTER_UNICAST_ADDRESS_XP*) for (unicast_address = (IP_ADAPTER_UNICAST_ADDRESS_XP*)
win_address->FirstUnicastAddress; win_address->FirstUnicastAddress;
unicast_address != NULL; unicast_address != NULL && prefix != NULL;
unicast_address = unicast_address->Next) { unicast_address = unicast_address->Next, prefix = prefix->Next) {
struct sockaddr* sa; struct sockaddr* sa;
ULONG prefix_len;
sa = unicast_address->Address.lpSockaddr;
prefix_len = prefix->PrefixLength;
memset(uv_address, 0, sizeof *uv_address);
uv_address->name = name_buf; uv_address->name = name_buf;
uv_address->is_internal =
(win_address->IfType == IF_TYPE_SOFTWARE_LOOPBACK);
sa = unicast_address->Address.lpSockaddr; if (sa->sa_family == AF_INET6) {
if (sa->sa_family == AF_INET6)
uv_address->address.address6 = *((struct sockaddr_in6 *) sa); uv_address->address.address6 = *((struct sockaddr_in6 *) sa);
else
uv_address->netmask.netmask6.sin6_family = AF_INET6;
memset(uv_address->netmask.netmask6.sin6_addr.s6_addr, 0xff, prefix_len >> 3);
uv_address->netmask.netmask6.sin6_addr.s6_addr[prefix_len >> 3] =
0xff << (8 - prefix_len % 8);
} else {
uv_address->address.address4 = *((struct sockaddr_in *) sa); uv_address->address.address4 = *((struct sockaddr_in *) sa);
uv_address->is_internal = uv_address->netmask.netmask4.sin_family = AF_INET;
(win_address->IfType == IF_TYPE_SOFTWARE_LOOPBACK); uv_address->netmask.netmask4.sin_addr.s_addr =
htonl(0xffffffff << (32 - prefix_len));
}
uv_address++; uv_address++;
} }

6
deps/uv/src/win/winsock.c

@ -79,12 +79,6 @@ static int error_means_no_support(DWORD error) {
void uv_winsock_init() { void uv_winsock_init() {
const GUID wsaid_connectex = WSAID_CONNECTEX;
const GUID wsaid_acceptex = WSAID_ACCEPTEX;
const GUID wsaid_getacceptexsockaddrs = WSAID_GETACCEPTEXSOCKADDRS;
const GUID wsaid_disconnectex = WSAID_DISCONNECTEX;
const GUID wsaid_transmitfile = WSAID_TRANSMITFILE;
WSADATA wsa_data; WSADATA wsa_data;
int errorno; int errorno;
SOCKET dummy; SOCKET dummy;

8
deps/uv/test/test-platform-output.c

@ -80,6 +80,14 @@ TEST_IMPL(platform_output) {
} }
printf(" address: %s\n", buffer); printf(" address: %s\n", buffer);
if (interfaces[i].netmask.netmask4.sin_family == AF_INET) {
uv_ip4_name(&interfaces[i].netmask.netmask4, buffer, sizeof(buffer));
} else if (interfaces[i].netmask.netmask4.sin_family == AF_INET6) {
uv_ip6_name(&interfaces[i].netmask.netmask6, buffer, sizeof(buffer));
}
printf(" netmask: %s\n", buffer);
} }
uv_free_interface_addresses(interfaces, count); uv_free_interface_addresses(interfaces, count);

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

@ -26,8 +26,8 @@
#define WRITES 3 #define WRITES 3
#define CHUNKS_PER_WRITE 3 #define CHUNKS_PER_WRITE 4096
#define CHUNK_SIZE 10485760 /* 10 MB */ #define CHUNK_SIZE 10024 /* 10 kb */
#define TOTAL_BYTES (WRITES * CHUNKS_PER_WRITE * CHUNK_SIZE) #define TOTAL_BYTES (WRITES * CHUNKS_PER_WRITE * CHUNK_SIZE)

65
deps/uv/uv.gyp

@ -1,4 +1,13 @@
{ {
'variables': {
'uv_use_dtrace%': 'false',
# uv_parent_path is the relative path to libuv in the parent project
# this is only relevant when dtrace is enabled and libuv is a child project
# as it's necessary to correctly locate the object files for post
# processing.
'uv_parent_path': '',
},
'target_defaults': { 'target_defaults': {
'conditions': [ 'conditions': [
['OS != "win"', { ['OS != "win"', {
@ -248,7 +257,17 @@
}], }],
['library=="shared_library"', { ['library=="shared_library"', {
'defines': [ 'BUILDING_UV_SHARED=1' ] 'defines': [ 'BUILDING_UV_SHARED=1' ]
}] }],
['uv_use_dtrace=="true"', {
'defines': [ 'HAVE_DTRACE=1' ],
'dependencies': [ 'uv_dtrace_header' ],
'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
'conditions': [
['OS != "mac"', {
'sources': ['src/unix/dtrace.c' ],
}],
],
}],
] ]
}, },
@ -426,6 +445,48 @@
'SubSystem': 1, # /subsystem:console 'SubSystem': 1, # /subsystem:console
}, },
}, },
} },
{
'target_name': 'uv_dtrace_header',
'type': 'none',
'conditions': [
[ 'uv_use_dtrace=="true"', {
'actions': [
{
'action_name': 'uv_dtrace_header',
'inputs': [ 'src/unix/uv-dtrace.d' ],
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/uv-dtrace.h' ],
'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
'-o', '<@(_outputs)' ],
},
],
}],
],
},
{
'target_name': 'uv_dtrace_provider',
'type': 'none',
'conditions': [
[ 'uv_use_dtrace=="true" and OS!="mac"', {
'actions': [
{
'action_name': 'uv_dtrace_o',
'inputs': [
'src/unix/uv-dtrace.d',
'<(PRODUCT_DIR)/obj.target/libuv/<(uv_parent_path)/src/unix/core.o',
],
'outputs': [
'<(PRODUCT_DIR)/obj.target/libuv/<(uv_parent_path)/src/unix/dtrace.o',
],
'action': [ 'dtrace', '-G', '-xnolibs', '-s', '<@(_inputs)',
'-o', '<@(_outputs)' ]
}
]
} ]
]
},
] ]
} }

8
deps/uv/vcbuild.bat

@ -41,6 +41,14 @@ shift
goto next-arg goto next-arg
:args-done :args-done
@rem Look for Visual Studio 2012
if not defined VS110COMNTOOLS goto vc-set-2010
if not exist "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2010
call "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" %vs_toolset%
set GYP_MSVS_VERSION=2012
goto select-target
:vc-set-2010
@rem Look for Visual Studio 2010 @rem Look for Visual Studio 2010
if not defined VS100COMNTOOLS goto vc-set-2008 if not defined VS100COMNTOOLS goto vc-set-2008
if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2008 if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2008

Loading…
Cancel
Save