uv: Upgrade to v0.10.4
This commit is contained in:
parent
212eb8a52e
commit
e5fdc4d6f1
3
deps/uv/.gitignore
vendored
3
deps/uv/.gitignore
vendored
@ -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
|
||||
|
||||
|
1
deps/uv/.mailmap
vendored
1
deps/uv/.mailmap
vendored
@ -2,6 +2,7 @@ Alan Gutierrez <alan@prettyrobots.com> <alan@blogometer.com>
|
||||
Bert Belder <bertbelder@gmail.com> <info@2bs.nl>
|
||||
Bert Belder <bertbelder@gmail.com> <user@ChrUbuntu.(none)>
|
||||
Brandon Philips <brandon.philips@rackspace.com> <brandon@ifup.org>
|
||||
Brian White <mscdex@mscdex.net>
|
||||
Brian White <mscdex@mscdex.net> <mscdex@gmail.com>
|
||||
Frank Denis <github@pureftpd.org>
|
||||
Isaac Z. Schlueter <i@izs.me>
|
||||
|
2
deps/uv/AUTHORS
vendored
2
deps/uv/AUTHORS
vendored
@ -79,3 +79,5 @@ Tim Bradshaw <tfb@cley.com>
|
||||
Timothy J. Fontaine <tjfontaine@gmail.com>
|
||||
Marc Schlaich <marc.schlaich@googlemail.com>
|
||||
Brian Mazza <louseman@gmail.com>
|
||||
Nils Maier <maierman@web.de>
|
||||
Nicholas Vavilov <vvnicholas@gmail.com>
|
||||
|
35
deps/uv/ChangeLog
vendored
35
deps/uv/ChangeLog
vendored
@ -1,3 +1,38 @@
|
||||
2013.04.12, Version 0.10.4 (Stable)
|
||||
|
||||
Changes since version 0.10.3:
|
||||
|
||||
* include: update uv_backend_fd() documentation (Ben Noordhuis)
|
||||
|
||||
* unix: include uv.h in src/version.c (Ben Noordhuis)
|
||||
|
||||
* unix: don't write more than IOV_MAX iovecs (Fedor Indutny)
|
||||
|
||||
* mingw-w64: don't call _set_invalid_parameter_handler (Nils Maier)
|
||||
|
||||
* build: gyp disable thin archives (Timothy J. Fontaine)
|
||||
|
||||
* sunos: re-export entire library when static (Timothy J. Fontaine)
|
||||
|
||||
* unix: dtrace probes for tick-start and tick-stop (Timothy J. Fontaine)
|
||||
|
||||
* windows: fix memory leak in fs__sendfile (Shannen Saez)
|
||||
|
||||
* windows: remove double initialization in uv_tty_init (Shannen Saez)
|
||||
|
||||
* build: fix dtrace-enabled out of tree build (Ben Noordhuis)
|
||||
|
||||
* build: squelch -Wdollar-in-identifier-extension warnings (Ben Noordhuis)
|
||||
|
||||
* inet: snprintf returns int, not size_t (Brian White)
|
||||
|
||||
* win: refactor uv_cpu_info (Bert Belder)
|
||||
|
||||
* build: add support for Visual Studio 2012 (Nicholas Vavilov)
|
||||
|
||||
* build: -Wno-dollar-in-identifier-extension is clang only (Ben Noordhuis)
|
||||
|
||||
|
||||
2013.02.04, Version 0.10.3 (Stable)
|
||||
|
||||
Changes since version 0.10.2:
|
||||
|
10
deps/uv/common.gypi
vendored
10
deps/uv/common.gypi
vendored
@ -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' ]
|
||||
}],
|
||||
],
|
||||
},
|
||||
}
|
||||
|
34
deps/uv/config-unix.mk
vendored
34
deps/uv/config-unix.mk
vendored
@ -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,13 @@ OBJS += src/unix/aix.o
|
||||
endif
|
||||
|
||||
ifeq (darwin,$(PLATFORM))
|
||||
HAVE_DTRACE=1
|
||||
# dtrace(1) probes contain dollar signs on OS X. Mute the warnings they
|
||||
# generate but only when CC=clang, -Wno-dollar-in-identifier-extension
|
||||
# is a clang extension.
|
||||
ifeq (__clang__,$(shell sh -c "$(CC) -dM -E - </dev/null | grep -ow __clang__"))
|
||||
CFLAGS += -Wno-dollar-in-identifier-extension
|
||||
endif
|
||||
CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
|
||||
LDFLAGS += -framework Foundation \
|
||||
-framework CoreServices \
|
||||
@ -96,6 +110,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 +147,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 $@ $^
|
||||
|
||||
@ -151,7 +172,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
|
||||
@ -161,7 +182,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 $@
|
||||
|
4
deps/uv/include/uv.h
vendored
4
deps/uv/include/uv.h
vendored
@ -294,8 +294,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.
|
||||
|
4
deps/uv/src/inet.c
vendored
4
deps/uv/src/inet.c
vendored
@ -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);
|
||||
|
2
deps/uv/src/unix/aix.c
vendored
2
deps/uv/src/unix/aix.c
vendored
@ -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);
|
||||
|
4
deps/uv/src/unix/core.c
vendored
4
deps/uv/src/unix/core.c
vendored
@ -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;
|
||||
}
|
||||
|
5
deps/uv/src/unix/cygwin.c
vendored
5
deps/uv/src/unix/cygwin.c
vendored
@ -55,11 +55,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;
|
||||
}
|
||||
|
7
deps/uv/src/unix/internal.h
vendored
7
deps/uv/src/unix/internal.h
vendored
@ -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_ */
|
||||
|
5
deps/uv/src/unix/stream.c
vendored
5
deps/uv/src/unix/stream.c
vendored
@ -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>
|
||||
@ -742,6 +743,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.
|
||||
|
25
deps/uv/src/unix/uv-dtrace.d
vendored
Normal file
25
deps/uv/src/unix/uv-dtrace.d
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
provider uv {
|
||||
probe tick__start(void* loop, int mode);
|
||||
probe tick__stop(void* loop, int mode);
|
||||
};
|
6
deps/uv/src/version.c
vendored
6
deps/uv/src/version.c
vendored
@ -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
|
||||
@ -26,9 +27,12 @@
|
||||
* releases.
|
||||
*/
|
||||
|
||||
#undef UV_VERSION_MAJOR /* TODO(bnoordhuis) Remove in v0.11. */
|
||||
#undef UV_VERSION_MINOR /* TODO(bnoordhuis) Remove in v0.11. */
|
||||
|
||||
#define UV_VERSION_MAJOR 0
|
||||
#define UV_VERSION_MINOR 10
|
||||
#define UV_VERSION_PATCH 3
|
||||
#define UV_VERSION_PATCH 4
|
||||
#define UV_VERSION_IS_RELEASE 1
|
||||
|
||||
|
||||
|
13
deps/uv/src/win/core.c
vendored
13
deps/uv/src/win/core.c
vendored
@ -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
vendored
2
deps/uv/src/win/fs.c
vendored
@ -1048,6 +1048,8 @@ static void fs__sendfile(uv_fs_t* req) {
|
||||
}
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
||||
SET_REQ_RESULT(req, result);
|
||||
}
|
||||
|
||||
|
10
deps/uv/src/win/poll.c
vendored
10
deps/uv/src/win/poll.c
vendored
@ -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
vendored
2
deps/uv/src/win/tty.c
vendored
@ -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
vendored
3
deps/uv/src/win/udp.c
vendored
@ -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;
|
||||
|
142
deps/uv/src/win/util.c
vendored
142
deps/uv/src/win/util.c
vendored
@ -578,47 +578,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;
|
||||
}
|
||||
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");
|
||||
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;
|
||||
sppi_size = cpu_count * sizeof(*sppi);
|
||||
sppi = malloc(sppi_size);
|
||||
if (sppi == NULL) {
|
||||
err = uv__new_artificial_error(UV_ENOMEM);
|
||||
goto error;
|
||||
}
|
||||
|
||||
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 +629,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;
|
||||
|
||||
_snwprintf(key_name,
|
||||
ARRAY_SIZE(key_name),
|
||||
L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\%d",
|
||||
i);
|
||||
len = _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 +645,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 +681,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;
|
||||
}
|
||||
|
6
deps/uv/src/win/winsock.c
vendored
6
deps/uv/src/win/winsock.c
vendored
@ -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;
|
||||
|
4
deps/uv/test/test-tcp-writealot.c
vendored
4
deps/uv/test/test-tcp-writealot.c
vendored
@ -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
vendored
65
deps/uv/uv.gyp
vendored
@ -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
vendored
8
deps/uv/vcbuild.bat
vendored
@ -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…
x
Reference in New Issue
Block a user