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.dylib
# Generated by dtrace(1) when doing an in-tree build.
/src/unix/uv-dtrace.h
/out/
/build/gyp

5
deps/uv/AUTHORS

@ -79,3 +79,8 @@ Tim Bradshaw <tfb@cley.com>
Timothy J. Fontaine <tjfontaine@gmail.com>
Marc Schlaich <marc.schlaich@googlemail.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)
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
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.
MacOS using the GCC or XCode 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
$(RM) libuv.a libuv.$(SOEXT) \
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)

10
deps/uv/common.gypi

@ -132,6 +132,11 @@
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
'cflags': [ '-Wall' ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
'target_conditions': [
['_type=="static_library"', {
'standalone_static_library': 1, # disable thin archive which needs binutils >= 2.19
}],
],
'conditions': [
[ 'host_arch != target_arch and target_arch=="ia32"', {
'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_LDFLAGS=-L"$(CURDIR)" -luv -Xlinker -rpath -Xlinker "$(CURDIR)"
HAVE_DTRACE=
DTRACE_OBJS=
DTRACE_HEADER=
OBJS += src/unix/async.o
OBJS += src/unix/core.o
OBJS += src/unix/dl.o
@ -58,11 +62,14 @@ OBJS += src/inet.o
OBJS += src/version.o
ifeq (sunos,$(PLATFORM))
HAVE_DTRACE=1
CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
LDFLAGS+=-lkstat -lnsl -lsendfile -lsocket
# Library dependencies are not transitive.
RUNNER_LDFLAGS += $(LDFLAGS)
OBJS += src/unix/sunos.o
OBJS += src/unix/dtrace.o
DTRACE_OBJS += src/unix/core.o
endif
ifeq (aix,$(PLATFORM))
@ -72,6 +79,9 @@ OBJS += src/unix/aix.o
endif
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
LDFLAGS += -framework Foundation \
-framework CoreServices \
@ -96,6 +106,7 @@ OBJS += src/unix/linux-core.o \
endif
ifeq (freebsd,$(PLATFORM))
HAVE_DTRACE=1
LDFLAGS+=-lkvm
OBJS += src/unix/freebsd.o
OBJS += src/unix/kqueue.o
@ -132,6 +143,12 @@ else
RUNNER_LDFLAGS += -pthread
endif
ifeq ($(HAVE_DTRACE), 1)
DTRACE_HEADER = src/unix/uv-dtrace.h
CPPFLAGS += -Isrc/unix
CFLAGS += -DHAVE_DTRACE
endif
libuv.a: $(OBJS)
$(AR) rcs $@ $^
@ -152,7 +169,7 @@ src/.buildstamp src/unix/.buildstamp test/.buildstamp:
mkdir -p $(@D)
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 $@
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 $@
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
$(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
* supported.
*
* This can be used in conjunction with uv_run_once() to poll in one thread and
* run the event loop's event callbacks in another.
* This can be used in conjunction with `uv_run(loop, UV_RUN_NOWAIT)` to
* 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.
* 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.
*
* 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);
@ -1473,6 +1479,10 @@ struct uv_interface_address_s {
struct sockaddr_in address4;
struct sockaddr_in6 address6;
} address;
union {
struct sockaddr_in netmask4;
struct sockaddr_in6 netmask6;
} netmask;
};
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 const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
size_t l;
int l;
#ifndef _WIN32
l = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
#else
l = _snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
#endif
if (l <= 0 || l >= size) {
if (l <= 0 || (size_t) l >= size) {
return uv_enospc_;
}
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) {
ssize_t res;
char pp[64], cwdl[PATH_MAX];
size_t cwdl_len;
struct psinfo ps;
int fd;
@ -79,7 +78,6 @@ int uv_exepath(char* buffer, size_t* size) {
return res;
cwdl[res] = '\0';
cwdl_len = res;
(void) snprintf(pp, sizeof(pp), "/proc/%lu/psinfo", (unsigned long) getpid());
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);
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 {
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++;

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);
while (r != 0 && loop->stop_flag == 0) {
UV_TICK_START(loop, mode);
uv__update_time(loop);
uv__run_timers(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);
r = uv__loop_alive(loop);
UV_TICK_STOP(loop, mode);
if (mode & (UV_RUN_ONCE | UV_RUN_NOWAIT))
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) {
uint32_t usize;
int result;
char* path;
char* fullpath;
if (!buffer || !size) {
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);
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 {
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;

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. */
else if (req->retcode == EAI_NODATA)
uv__set_sys_error(req->loop, ENOENT);
#elif defined(__sun)
if (req->retcode == EAI_MEMORY && hostlen >= MAXHOSTNAMELEN) {
#endif
#if defined(__sun)
else if (req->retcode == EAI_MEMORY && hostlen >= MAXHOSTNAMELEN)
uv__set_sys_error(req->loop, ENOENT);
#endif
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;
}
#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_ */

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);
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 {
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;

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);
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 {
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;

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

@ -33,6 +33,7 @@
#include <sys/uio.h>
#include <sys/un.h>
#include <unistd.h>
#include <limits.h> /* IOV_MAX */
#if defined(__APPLE__)
# 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->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
* in the loop so check it on each iteration.
@ -742,6 +742,10 @@ start:
iov = (struct iovec*) &(req->bufs[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
* 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;
/* Set up to receive a descriptor even if one isn't in the message */
msg.msg_controllen = 64;
msg.msg_control = (void *) cmsg_space;
msg.msg_control = (void*) cmsg_space;
do {
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)
break;
handle = (uv_fs_event_t *)pe.portev_user;
handle = (uv_fs_event_t*) pe.portev_user;
assert((r == 0) && "unexpected port_get() error");
events = 0;
@ -457,12 +457,12 @@ uv_err_t uv_uptime(double* uptime) {
if ((kc = kstat_open()) == NULL)
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) {
*uptime = -1;
} 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;
}
@ -485,7 +485,7 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
/* Get count of cpus */
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++;
}
@ -499,18 +499,18 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
cpu_info = *cpu_infos;
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) {
cpu_info->speed = 0;
cpu_info->model = NULL;
} 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 ||
knp->data_type == KSTAT_DATA_INT64);
cpu_info->speed = (knp->data_type == KSTAT_DATA_INT32) ? knp->value.i32
: 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);
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;
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) {
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.irq = 0;
} 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);
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);
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);
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);
cpu_info->cpu_times.irq = knp->value.ui64;
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);
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 {
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 &

3
deps/uv/src/version.c

@ -19,6 +19,7 @@
* 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
@ -29,7 +30,7 @@
#define UV_VERSION_MAJOR 0
#define UV_VERSION_MINOR 11
#define UV_VERSION_PATCH 1
#define UV_VERSION_IS_RELEASE 0
#define UV_VERSION_IS_RELEASE 1
#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 */
/* 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);
#endif
@ -185,7 +185,6 @@ int uv_backend_timeout(const uv_loop_t* loop) {
static void uv_poll(uv_loop_t* loop, int block) {
BOOL success;
DWORD bytes, timeout;
ULONG_PTR key;
OVERLAPPED* overlapped;
@ -197,11 +196,11 @@ static void uv_poll(uv_loop_t* loop, int block) {
timeout = 0;
}
success = GetQueuedCompletionStatus(loop->iocp,
&bytes,
&key,
&overlapped,
timeout);
GetQueuedCompletionStatus(loop->iocp,
&bytes,
&key,
&overlapped,
timeout);
if (overlapped) {
/* 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);
}

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) {
uv_req_t* req = (uv_req_t*) arg;
uv_poll_t* handle = (uv_poll_t*) req->data;
unsigned char events, reported_events;
unsigned char reported_events;
int r;
uv_single_fd_set_t rfds, wfds, efds;
struct timeval timeout;
@ -319,14 +319,6 @@ static DWORD WINAPI uv__slow_poll_thread_proc(void* arg) {
assert(handle->type == UV_POLL);
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) {
rfds.fd_count = 1;
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) {
HANDLE handle = INVALID_HANDLE_VALUE;
HANDLE handle;
CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
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,
unsigned int flags) {
int r;
DWORD no = 0, yes = 1;
DWORD no = 0;
if ((flags & UV_UDP_IPV6ONLY) && family != AF_INET6) {
/* 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) {
WSAPROTOCOL_INFOW protocol_info;
int opt_len;
DWORD yes = 1;
/* Detect the address family of the socket. */
opt_len = (int) sizeof protocol_info;

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

@ -31,6 +31,7 @@
#include "uv.h"
#include "internal.h"
#include <Winsock2.h>
#include <iphlpapi.h>
#include <psapi.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;
DWORD sppi_size;
SYSTEM_INFO system_info;
DWORD cpu_count, i, r;
DWORD cpu_count, r, i;
NTSTATUS status;
ULONG result_size;
size_t size;
uv_err_t err;
uv_cpu_info_t* cpu_info;
*cpu_infos = NULL;
*count = 0;
cpu_infos = NULL;
cpu_count = 0;
sppi = NULL;
uv__once_init();
GetSystemInfo(&system_info);
cpu_count = system_info.dwNumberOfProcessors;
size = cpu_count * sizeof(uv_cpu_info_t);
*cpu_infos = (uv_cpu_info_t*) malloc(size);
if (*cpu_infos == NULL) {
cpu_infos = calloc(cpu_count, sizeof *cpu_infos);
if (cpu_infos == NULL) {
err = uv__new_artificial_error(UV_ENOMEM);
goto out;
goto error;
}
memset(*cpu_infos, 0, size);
sppi_size = sizeof(*sppi) * cpu_count;
sppi = (SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION*) malloc(sppi_size);
if (!sppi) {
uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
sppi_size = cpu_count * sizeof(*sppi);
sppi = malloc(sppi_size);
if (sppi == NULL) {
err = uv__new_artificial_error(UV_ENOMEM);
goto error;
}
r = pNtQuerySystemInformation(SystemProcessorPerformanceInformation,
sppi,
sppi_size,
&result_size);
if (r != ERROR_SUCCESS || result_size != sppi_size) {
err = uv__new_sys_error(GetLastError());
goto out;
status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation,
sppi,
sppi_size,
&result_size);
if (!NT_SUCCESS(status)) {
err = uv__new_sys_error(pRtlNtStatusToDosError(status));
goto error;
}
assert(result_size == sppi_size);
for (i = 0; i < cpu_count; i++) {
WCHAR key_name[128];
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);
WCHAR cpu_brand[256];
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,
ARRAY_SIZE(key_name),
L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%d",
i);
assert(len > 0 && len < ARRAY_SIZE(key_name));
r = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
key_name,
@ -639,32 +646,34 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
&processor_key);
if (r != ERROR_SUCCESS) {
err = uv__new_sys_error(GetLastError());
goto out;
goto error;
}
if (RegQueryValueExW(processor_key,
L"~MHz",
NULL, NULL,
NULL,
NULL,
(BYTE*) &cpu_speed,
&cpu_speed_size) != ERROR_SUCCESS) {
err = uv__new_sys_error(GetLastError());
RegCloseKey(processor_key);
goto out;
goto error;
}
if (RegQueryValueExW(processor_key,
L"ProcessorNameString",
NULL, NULL,
NULL,
NULL,
(BYTE*) &cpu_brand,
&cpu_brand_size) != ERROR_SUCCESS) {
err = uv__new_sys_error(GetLastError());
RegCloseKey(processor_key);
goto out;
goto error;
}
RegCloseKey(processor_key);
cpu_info = &(*cpu_infos)[i];
cpu_info = &cpu_infos[i];
cpu_info->speed = cpu_speed;
cpu_info->cpu_times.user = sppi[i].UserTime.QuadPart / 10000;
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.nice = 0;
size = uv_utf16_to_utf8(cpu_brand,
cpu_brand_size / sizeof(WCHAR),
NULL,
0);
if (size == 0) {
len = WideCharToMultiByte(CP_UTF8,
0,
cpu_brand,
cpu_brand_size / sizeof(WCHAR),
NULL,
0,
NULL,
NULL);
if (len == 0) {
err = uv__new_sys_error(GetLastError());
goto out;
goto error;
}
assert(len > 0);
/* 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) {
err = uv__new_artificial_error(UV_ENOMEM);
goto out;
goto error;
}
if (uv_utf16_to_utf8(cpu_brand,
cpu_brand_size / sizeof(WCHAR),
cpu_info->model,
size) == 0) {
if (WideCharToMultiByte(CP_UTF8,
0,
cpu_brand,
cpu_brand_size / sizeof(WCHAR),
cpu_info->model,
len,
NULL,
NULL) == 0) {
err = uv__new_sys_error(GetLastError());
goto out;
goto error;
}
/* Ensure that cpu_info->model is null terminated. */
cpu_info->model[size] = '\0';
(*count)++;
cpu_info->model[len] = '\0';
}
err = uv_ok_;
free(sppi);
out:
if (sppi) {
free(sppi);
}
*cpu_count_ptr = cpu_count;
*cpu_infos_ptr = cpu_infos;
if (err.code != UV_OK &&
*cpu_infos != NULL) {
int i;
return uv_ok_;
for (i = 0; i < *count; i++) {
/* This is safe because the cpu_infos memory area is zeroed out */
/* immediately after allocating it. */
free((*cpu_infos)[i].model);
}
free(*cpu_infos);
error:
/* This is safe because the cpu_infos array is zeroed on allocation. */
for (i = 0; i < cpu_count; i++)
free(cpu_infos[i].model);
*cpu_infos = NULL;
*count = 0;
}
free(cpu_infos);
free(sppi);
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 */
/* win_address_buf_size. */
r = GetAdaptersAddresses(AF_UNSPEC,
0,
GAA_FLAG_INCLUDE_PREFIX,
NULL,
win_address_buf,
&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 = win_address->Next) {
IP_ADAPTER_UNICAST_ADDRESS_XP* unicast_address;
IP_ADAPTER_PREFIX* prefix;
int 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());
}
prefix = win_address->FirstPrefix;
/* 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*)
win_address->FirstUnicastAddress;
unicast_address != NULL;
unicast_address = unicast_address->Next) {
unicast_address != NULL && prefix != NULL;
unicast_address = unicast_address->Next, prefix = prefix->Next) {
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->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);
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->is_internal =
(win_address->IfType == IF_TYPE_SOFTWARE_LOOPBACK);
uv_address->netmask.netmask4.sin_family = AF_INET;
uv_address->netmask.netmask4.sin_addr.s_addr =
htonl(0xffffffff << (32 - prefix_len));
}
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() {
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;
int errorno;
SOCKET dummy;

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

@ -80,6 +80,14 @@ TEST_IMPL(platform_output) {
}
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);

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

@ -26,8 +26,8 @@
#define WRITES 3
#define CHUNKS_PER_WRITE 3
#define CHUNK_SIZE 10485760 /* 10 MB */
#define CHUNKS_PER_WRITE 4096
#define CHUNK_SIZE 10024 /* 10 kb */
#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': {
'conditions': [
['OS != "win"', {
@ -248,7 +257,17 @@
}],
['library=="shared_library"', {
'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
},
},
}
},
{
'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
: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
if not defined VS100COMNTOOLS goto vc-set-2008
if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2008

Loading…
Cancel
Save