Merge remote-tracking branch 'origin/v0.10'
This commit is contained in:
commit
f78bcfbd6a
3
.gitignore
vendored
3
.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
|
||||
|
||||
|
||||
10
common.gypi
10
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' ]
|
||||
}],
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
@ -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,7 @@ OBJS += src/unix/aix.o
|
||||
endif
|
||||
|
||||
ifeq (darwin,$(PLATFORM))
|
||||
HAVE_DTRACE=1
|
||||
CPPFLAGS += -D_DARWIN_USE_64_BIT_INODE=1
|
||||
LDFLAGS += -framework Foundation \
|
||||
-framework CoreServices \
|
||||
@ -96,6 +104,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 +141,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 +167,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 +177,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 $@
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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_ */
|
||||
|
||||
@ -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>
|
||||
@ -741,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.
|
||||
|
||||
25
src/unix/uv-dtrace.d
Normal file
25
src/unix/uv-dtrace.d
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);
|
||||
};
|
||||
@ -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
|
||||
|
||||
|
||||
@ -1062,6 +1062,8 @@ static void fs__sendfile(uv_fs_t* req) {
|
||||
}
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
||||
SET_REQ_RESULT(req, result);
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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
uv.gyp
65
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)' ]
|
||||
}
|
||||
]
|
||||
} ]
|
||||
]
|
||||
},
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user