Permalink
Browse files

Upgrade libuv to ea4271f

Required adding uv_default_loop() in many places.
  • Loading branch information...
1 parent 6f60683 commit 21cc4c4985fdf40cc128cd88cfdc02fd49e33b26 @ry ry committed Aug 31, 2011
Showing with 2,152 additions and 1,688 deletions.
  1. +1 −1 deps/uv/Makefile
  2. +26 −24 deps/uv/config-unix.mk
  3. +2 −2 deps/uv/include/{ → uv-private}/eio.h
  4. 0 deps/uv/include/{ → uv-private}/ev.h
  5. 0 deps/uv/include/{ → uv-private}/ngx-queue.h
  6. 0 deps/uv/include/{ → uv-private}/tree.h
  7. +10 −0 deps/uv/include/{ → uv-private}/uv-unix.h
  8. +38 −2 deps/uv/include/{ → uv-private}/uv-win.h
  9. +103 −57 deps/uv/include/uv.h
  10. 0 deps/uv/src/{uv-cygwin.c → unix/cygwin.c}
  11. 0 deps/uv/src/{uv-darwin.c → unix/darwin.c}
  12. 0 deps/uv/src/{ → unix}/eio/Changes
  13. 0 deps/uv/src/{ → unix}/eio/LICENSE
  14. 0 deps/uv/src/{ → unix}/eio/Makefile.am
  15. 0 deps/uv/src/{ev → unix/eio}/aclocal.m4
  16. 0 deps/uv/src/{ → unix}/eio/autogen.sh
  17. 0 deps/uv/src/{ → unix}/eio/config.h.in
  18. 0 deps/uv/src/{ → unix}/eio/config_cygwin.h
  19. 0 deps/uv/src/{ → unix}/eio/config_darwin.h
  20. 0 deps/uv/src/{ → unix}/eio/config_freebsd.h
  21. 0 deps/uv/src/{ → unix}/eio/config_linux.h
  22. 0 deps/uv/src/{ → unix}/eio/config_sunos.h
  23. 0 deps/uv/src/{ → unix}/eio/configure.ac
  24. 0 deps/uv/src/{ → unix}/eio/demo.c
  25. 0 deps/uv/src/{ → unix}/eio/ecb.h
  26. 0 deps/uv/src/{ → unix}/eio/eio.3
  27. 0 deps/uv/src/{ → unix}/eio/eio.c
  28. 0 deps/uv/src/{ → unix}/eio/eio.pod
  29. 0 deps/uv/src/{ → unix}/eio/libeio.m4
  30. 0 deps/uv/src/{ → unix}/eio/xthread.h
  31. 0 deps/uv/src/{ → unix}/ev/Changes
  32. 0 deps/uv/src/{ → unix}/ev/LICENSE
  33. 0 deps/uv/src/{ → unix}/ev/Makefile.am
  34. 0 deps/uv/src/{ → unix}/ev/Makefile.in
  35. 0 deps/uv/src/{ → unix}/ev/README
  36. 0 deps/uv/src/{eio → unix/ev}/aclocal.m4
  37. 0 deps/uv/src/{ → unix}/ev/autogen.sh
  38. 0 deps/uv/src/{ → unix}/ev/config.guess
  39. 0 deps/uv/src/{ → unix}/ev/config.h.in
  40. 0 deps/uv/src/{ → unix}/ev/config.sub
  41. 0 deps/uv/src/{ → unix}/ev/config_cygwin.h
  42. 0 deps/uv/src/{ → unix}/ev/config_darwin.h
  43. 0 deps/uv/src/{ → unix}/ev/config_freebsd.h
  44. 0 deps/uv/src/{ → unix}/ev/config_linux.h
  45. 0 deps/uv/src/{ → unix}/ev/config_sunos.h
  46. 0 deps/uv/src/{ → unix}/ev/configure
  47. 0 deps/uv/src/{ → unix}/ev/configure.ac
  48. 0 deps/uv/src/{ → unix}/ev/depcomp
  49. 0 deps/uv/src/{ → unix}/ev/ev++.h
  50. 0 deps/uv/src/{ → unix}/ev/ev.3
  51. 0 deps/uv/src/{ → unix}/ev/ev.c
  52. 0 deps/uv/src/{ → unix}/ev/ev.pod
  53. 0 deps/uv/src/{ → unix}/ev/ev_epoll.c
  54. 0 deps/uv/src/{ → unix}/ev/ev_kqueue.c
  55. 0 deps/uv/src/{ → unix}/ev/ev_poll.c
  56. 0 deps/uv/src/{ → unix}/ev/ev_port.c
  57. 0 deps/uv/src/{ → unix}/ev/ev_select.c
  58. 0 deps/uv/src/{ → unix}/ev/ev_vars.h
  59. 0 deps/uv/src/{ → unix}/ev/ev_win32.c
  60. 0 deps/uv/src/{ → unix}/ev/ev_wrap.h
  61. 0 deps/uv/src/{ → unix}/ev/event.c
  62. 0 deps/uv/src/{ → unix}/ev/event.h
  63. 0 deps/uv/src/{ → unix}/ev/install-sh
  64. 0 deps/uv/src/{ → unix}/ev/libev.m4
  65. 0 deps/uv/src/{ → unix}/ev/ltmain.sh
  66. 0 deps/uv/src/{ → unix}/ev/missing
  67. 0 deps/uv/src/{ → unix}/ev/mkinstalldirs
  68. 0 deps/uv/src/{uv-freebsd.c → unix/freebsd.c}
  69. +112 −98 deps/uv/src/unix/fs.c
  70. +1 −1 deps/uv/src/unix/internal.h
  71. 0 deps/uv/src/{uv-linux.c → unix/linux.c}
  72. 0 deps/uv/src/{uv-sunos.c → unix/sunos.c}
  73. +48 −27 deps/uv/src/{ → unix}/uv-eio.c
  74. +1 −1 deps/uv/src/{ → unix}/uv-eio.h
  75. +16 −14 deps/uv/src/uv-common.c
  76. +6 −8 deps/uv/src/uv-common.h
  77. +249 −219 deps/uv/src/uv-unix.c
  78. +14 −10 deps/uv/src/win/async.c
  79. +64 −64 deps/uv/src/win/cares.c
  80. +59 −49 deps/uv/src/win/core.c
  81. +17 −13 deps/uv/src/win/error.c
  82. +141 −99 deps/uv/src/win/fs.c
  83. +61 −36 deps/uv/src/win/getaddrinfo.c
  84. +30 −26 deps/uv/src/win/handle.c
  85. +69 −97 deps/uv/src/win/internal.h
  86. +21 −17 deps/uv/src/win/loop-watcher.c
  87. +137 −111 deps/uv/src/win/pipe.c
  88. +72 −39 deps/uv/src/win/process.c
  89. +41 −34 deps/uv/src/win/req.c
  90. +5 −5 deps/uv/src/win/stdio.c
  91. +19 −13 deps/uv/src/win/stream.c
  92. +113 −81 deps/uv/src/win/tcp.c
  93. +13 −9 deps/uv/src/win/threadpool.c
  94. +44 −36 deps/uv/src/win/timer.c
  95. +69 −48 deps/uv/src/win/udp.c
  96. +20 −6 deps/uv/src/win/util.c
  97. +10 −6 deps/uv/test/benchmark-ares.c
  98. +10 −7 deps/uv/test/benchmark-getaddrinfo.c
  99. +9 −5 deps/uv/test/benchmark-ping-pongs.c
  100. +14 −11 deps/uv/test/benchmark-pound.c
  101. +27 −21 deps/uv/test/benchmark-pump.c
  102. +11 −8 deps/uv/test/benchmark-spawn.c
  103. +9 −6 deps/uv/test/benchmark-udp-packet-storm.c
  104. +10 −5 deps/uv/test/dns-server.c
  105. +27 −15 deps/uv/test/echo-server.c
  106. +3 −3 deps/uv/test/test-async.c
  107. +5 −5 deps/uv/test/test-callback-stack.c
  108. +6 −5 deps/uv/test/test-connection-fail.c
  109. +12 −12 deps/uv/test/test-delayed-accept.c
  110. +77 −66 deps/uv/test/test-fs.c
  111. +11 −8 deps/uv/test/test-getaddrinfo.c
  112. +8 −8 deps/uv/test/test-gethostbyname.c
  113. +22 −15 deps/uv/test/test-getsockname.c
  114. +4 −3 deps/uv/test/test-idle.c
  115. +9 −8 deps/uv/test/test-loop-handles.c
  116. +7 −7 deps/uv/test/test-ping-pong.c
  117. +18 −14 deps/uv/test/test-pipe-bind-error.c
  118. +17 −16 deps/uv/test/test-ref.c
  119. +4 −4 deps/uv/test/test-shutdown-eof.c
  120. +16 −16 deps/uv/test/test-spawn.c
  121. +24 −18 deps/uv/test/test-tcp-bind-error.c
  122. +19 −14 deps/uv/test/test-tcp-bind6-error.c
  123. +5 −4 deps/uv/test/test-tcp-writealot.c
  124. +2 −2 deps/uv/test/test-threadpool.c
  125. +15 −12 deps/uv/test/test-timer-again.c
  126. +8 −8 deps/uv/test/test-timer.c
  127. +3 −3 deps/uv/test/test-udp-dgram-too-big.c
  128. +4 −4 deps/uv/test/test-udp-ipv6.c
  129. +3 −3 deps/uv/test/test-udp-send-and-recv.c
  130. +29 −28 deps/uv/uv.gyp
  131. +1 −1 src/cares_wrap.cc
  132. +20 −19 src/node.cc
  133. +1 −1 src/node_child_process.h
  134. +1 −1 src/node_crypto.cc
  135. +2 −2 src/node_file.cc
  136. +1 −1 src/node_io_watcher.h
  137. +1 −1 src/node_signal_watcher.h
  138. +1 −1 src/node_stat_watcher.h
  139. +1 −1 src/node_timer.h
  140. +5 −5 src/pipe_wrap.cc
  141. +3 −3 src/process_wrap.cc
  142. +2 −2 src/stdio_wrap.cc
  143. +7 −7 src/stream_wrap.cc
  144. +9 −9 src/tcp_wrap.cc
  145. +9 −9 src/timer_wrap.cc
  146. +8 −8 src/udp_wrap.cc
View
@@ -24,7 +24,7 @@ ifdef MSVC
uname_S := MINGW
endif
-CPPFLAGS += -Iinclude
+CPPFLAGS += -Iinclude -Iinclude/uv-private
CARES_OBJS =
CARES_OBJS += src/ares/ares__close_sockets.o
@@ -23,7 +23,7 @@ AR = $(PREFIX)ar
E=
CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
CFLAGS=-g
-CPPFLAGS += -Isrc/ev
+CPPFLAGS += -Isrc/unix/ev
LINKFLAGS=-lm
CPPFLAGS += -D_LARGEFILE_SOURCE
@@ -34,15 +34,15 @@ EV_CONFIG=config_sunos.h
EIO_CONFIG=config_sunos.h
CPPFLAGS += -Isrc/ares/config_sunos -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
LINKFLAGS+=-lsocket -lnsl
-UV_OS_FILE=uv-sunos.c
+UV_OS_FILE=sunos.c
endif
ifeq (Darwin,$(uname_S))
EV_CONFIG=config_darwin.h
EIO_CONFIG=config_darwin.h
CPPFLAGS += -Isrc/ares/config_darwin
LINKFLAGS+=-framework CoreServices
-UV_OS_FILE=uv-darwin.c
+UV_OS_FILE=darwin.c
endif
ifeq (Linux,$(uname_S))
@@ -51,15 +51,15 @@ EIO_CONFIG=config_linux.h
CSTDFLAG += -D_XOPEN_SOURCE=600
CPPFLAGS += -Isrc/ares/config_linux
LINKFLAGS+=-lrt
-UV_OS_FILE=uv-linux.c
+UV_OS_FILE=linux.c
endif
ifeq (FreeBSD,$(uname_S))
EV_CONFIG=config_freebsd.h
EIO_CONFIG=config_freebsd.h
CPPFLAGS += -Isrc/ares/config_freebsd
LINKFLAGS+=
-UV_OS_FILE=uv-freebsd.c
+UV_OS_FILE=freebsd.c
endif
ifneq (,$(findstring CYGWIN,$(uname_S)))
@@ -69,7 +69,7 @@ EIO_CONFIG=config_cygwin.h
CSTDFLAG = -D_GNU_SOURCE
CPPFLAGS += -Isrc/ares/config_cygwin
LINKFLAGS+=
-UV_OS_FILE=uv-cygwin.c
+UV_OS_FILE=cygwin.c
endif
# Need _GNU_SOURCE for strdup?
@@ -85,46 +85,48 @@ endif
RUNNER_LIBS=
RUNNER_SRC=test/runner-unix.c
-uv.a: src/uv-unix.o src/unix/fs.o src/uv-common.o src/uv-platform.o src/ev/ev.o src/uv-eio.o src/eio/eio.o $(CARES_OBJS)
- $(AR) rcs uv.a src/uv-unix.o src/unix/fs.o src/uv-platform.o src/uv-common.o src/uv-eio.o src/ev/ev.o \
- src/eio/eio.o $(CARES_OBJS)
+uv.a: src/uv-unix.o src/unix/fs.o src/uv-common.o src/uv-platform.o src/unix/ev/ev.o src/unix/uv-eio.o src/unix/eio/eio.o $(CARES_OBJS)
+ $(AR) rcs uv.a src/uv-unix.o src/unix/fs.o src/uv-platform.o src/uv-common.o src/unix/uv-eio.o src/unix/ev/ev.o \
+ src/unix/eio/eio.o $(CARES_OBJS)
-src/uv-platform.o: src/$(UV_OS_FILE) include/uv.h include/uv-unix.h
- $(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c src/$(UV_OS_FILE) -o src/uv-platform.o
+src/uv-platform.o: src/unix/$(UV_OS_FILE) include/uv.h include/uv-private/uv-unix.h
+ $(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c src/unix/$(UV_OS_FILE) -o src/uv-platform.o
-src/uv-unix.o: src/uv-unix.c include/uv.h include/uv-unix.h src/unix/internal.h
+src/uv-unix.o: src/uv-unix.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h
$(CC) $(CSTDFLAG) $(CPPFLAGS) -Isrc $(CFLAGS) -c src/uv-unix.c -o src/uv-unix.o
-src/unix/fs.o: src/unix/fs.c include/uv.h include/uv-unix.h src/unix/internal.h
+src/unix/fs.o: src/unix/fs.c include/uv.h include/uv-private/uv-unix.h src/unix/internal.h
$(CC) $(CSTDFLAG) $(CPPFLAGS) -Isrc/ $(CFLAGS) -c src/unix/fs.c -o src/unix/fs.o
-src/uv-common.o: src/uv-common.c include/uv.h include/uv-unix.h
+src/uv-common.o: src/uv-common.c include/uv.h include/uv-private/uv-unix.h
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c src/uv-common.c -o src/uv-common.o
-src/ev/ev.o: src/ev/ev.c
- $(CC) $(CPPFLAGS) $(CFLAGS) -c src/ev/ev.c -o src/ev/ev.o -DEV_CONFIG_H=\"$(EV_CONFIG)\"
+src/unix/ev/ev.o: src/unix/ev/ev.c
+ $(CC) $(CPPFLAGS) $(CFLAGS) -c src/unix/ev/ev.c -o src/unix/ev/ev.o -DEV_CONFIG_H=\"$(EV_CONFIG)\"
EIO_CPPFLAGS += $(CPPFLAGS)
EIO_CPPFLAGS += -DEIO_CONFIG_H=\"$(EIO_CONFIG)\"
EIO_CPPFLAGS += -DEIO_STACKSIZE=262144
EIO_CPPFLAGS += -D_GNU_SOURCE
-src/eio/eio.o: src/eio/eio.c
- $(CC) $(EIO_CPPFLAGS) $(CFLAGS) -c src/eio/eio.c -o src/eio/eio.o
+src/unix/eio/eio.o: src/unix/eio/eio.c
+ $(CC) $(EIO_CPPFLAGS) $(CFLAGS) -c src/unix/eio/eio.c -o src/unix/eio/eio.o
-src/uv-eio.o: src/uv-eio.c
- $(CC) $(CPPFLAGS) -Isrc/eio/ $(CSTDFLAG) $(CFLAGS) -c src/uv-eio.c -o src/uv-eio.o
+src/unix/uv-eio.o: src/unix/uv-eio.c
+ $(CC) $(CPPFLAGS) -Isrc/unix/eio/ $(CSTDFLAG) $(CFLAGS) -c src/unix/uv-eio.c -o src/unix/uv-eio.o
clean-platform:
-rm -f src/ares/*.o
- -rm -f src/ev/*.o
- -rm -f src/eio/*.o
+ -rm -f src/unix/ev/*.o
+ -rm -f src/unix/eio/*.o
+ -rm -f src/unix/*.o
-rm -rf test/run-tests.dSYM run-benchmarks.dSYM
distclean-platform:
-rm -f src/ares/*.o
- -rm -f src/ev/*.o
- -rm -f src/eio/*.o
+ -rm -f src/unix/ev/*.o
+ -rm -f src/unix/*.o
+ -rm -f src/unix/eio/*.o
-rm -rf test/run-tests.dSYM run-benchmarks.dSYM
@@ -195,15 +195,15 @@ enum
enum
{
EIO_MCL_CURRENT = 1,
- EIO_MCL_FUTURE = 2,
+ EIO_MCL_FUTURE = 2
};
/* request priorities */
enum {
EIO_PRI_MIN = -4,
EIO_PRI_MAX = 4,
- EIO_PRI_DEFAULT = 0,
+ EIO_PRI_DEFAULT = 0
};
/* eio request structure */
File renamed without changes.
File renamed without changes.
@@ -42,6 +42,16 @@ typedef struct {
typedef int uv_file;
+#define UV_LOOP_PRIVATE_FIELDS \
+ ares_channel channel; \
+ /* \
+ * While the channel is active this timer is called once per second to be \
+ * sure that we're always calling ares_process. See the warning above the \
+ * definition of ares_timeout(). \
+ */ \
+ ev_timer timer; \
+ struct ev_loop* ev;
+
#define UV_REQ_BUFSML_SIZE (4)
#define UV_REQ_PRIVATE_FIELDS /* empty */
@@ -44,6 +44,40 @@ typedef struct uv_buf_t {
typedef int uv_file;
+RB_HEAD(uv_timer_tree_s, uv_timer_s);
+
+#define UV_LOOP_PRIVATE_FIELDS \
+ /* The loop's I/O completion port */ \
+ HANDLE iocp; \
+ /* Reference count that keeps the event loop alive */ \
+ int refs; \
+ /* The current time according to the event loop. in msecs. */ \
+ int64_t time; \
+ /* Tail of a single-linked circular queue of pending reqs. If the queue */ \
+ /* is empty, tail_ is NULL. If there is only one item, */ \
+ /* tail_->next_req == tail_ */ \
+ uv_req_t* pending_reqs_tail; \
+ /* Head of a single-linked list of closed handles */ \
+ uv_handle_t* endgame_handles; \
+ /* The head of the timers tree */ \
+ struct uv_timer_tree_s timers; \
+ /* Lists of active loop (prepare / check / idle) watchers */ \
+ uv_prepare_t* prepare_handles; \
+ uv_check_t* check_handles; \
+ uv_idle_t* idle_handles; \
+ /* This pointer will refer to the prepare/check/idle handle whose */ \
+ /* callback is scheduled to be called next. This is needed to allow */ \
+ /* safe removal from one of the lists above while that list being */ \
+ /* iterated over. */ \
+ uv_prepare_t* next_prepare_handle; \
+ uv_check_t* next_check_handle; \
+ uv_idle_t* next_idle_handle; \
+ ares_channel ares_channel; \
+ int ares_active_sockets; \
+ uv_timer_t ares_polling_timer; \
+ /* Last error code */ \
+ uv_err_t last_error;
+
#define UV_REQ_TYPE_PRIVATE \
/* TODO: remove the req suffix */ \
UV_ARES_EVENT_REQ, \
@@ -227,5 +261,7 @@ typedef int uv_file;
#define UV_WORK_PRIVATE_FIELDS \
-int uv_utf16_to_utf8(const wchar_t* utf16Buffer, size_t utf16Size, char* utf8Buffer, size_t utf8Size);
-int uv_utf8_to_utf16(const char* utf8Buffer, wchar_t* utf16Buffer, size_t utf16Size);
+int uv_utf16_to_utf8(const wchar_t* utf16Buffer, size_t utf16Size,
+ char* utf8Buffer, size_t utf8Size);
+int uv_utf8_to_utf16(const char* utf8Buffer, wchar_t* utf16Buffer,
+ size_t utf16Size);
Oops, something went wrong.

0 comments on commit 21cc4c4

Please sign in to comment.