Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

uv: ugprade to c468e2a

  • Loading branch information...
commit 3921d8a6f344369d9aeabcfd462c49a076cc19ed 1 parent 8c43cd0
@bnoordhuis authored
Showing with 21,770 additions and 1,915 deletions.
  1. +3 −0  deps/libuv/.mailmap
  2. +10 −0 deps/libuv/AUTHORS
  3. +3 −3 deps/libuv/Makefile
  4. +44 −6 deps/libuv/{README → README.md}
  5. +20 −0 deps/libuv/build/gcc_version.py
  6. +18 −5 deps/libuv/common.gypi
  7. +1 −0  deps/libuv/config-mingw.mk
  8. +15 −4 deps/libuv/config-unix.mk
  9. +11 −2 deps/libuv/include/ares.h
  10. +2 −2 deps/libuv/include/ares_version.h
  11. +1 −0  deps/libuv/include/uv-private/ev.h
  12. +46 −6 deps/libuv/include/uv-private/uv-unix.h
  13. +170 −18 deps/libuv/include/uv-private/uv-win.h
  14. +434 −217 deps/libuv/include/uv.h
  15. +20 −0 deps/libuv/src/ares/CHANGES
  16. +24 −0 deps/libuv/src/ares/README.msvc
  17. +18 −17 deps/libuv/src/ares/RELEASE-NOTES
  18. +8 −1 deps/libuv/src/ares/ares_expand_name.c
  19. +1 −0  deps/libuv/src/ares/ares_fds.c
  20. +3 −0  deps/libuv/src/ares/ares_free_hostent.c
  21. +30 −0 deps/libuv/src/ares/ares_getenv.c
  22. +26 −0 deps/libuv/src/ares/ares_getenv.h
  23. +11 −2 deps/libuv/src/ares/ares_gethostbyaddr.c
  24. +17 −9 deps/libuv/src/ares/ares_gethostbyname.c
  25. +3 −2 deps/libuv/src/ares/ares_getnameinfo.c
  26. +238 −94 deps/libuv/src/ares/ares_init.c
  27. +221 −0 deps/libuv/src/ares/ares_iphlpapi.h
  28. +10 −0 deps/libuv/src/ares/ares_library_init.c
  29. +4 −1 deps/libuv/src/ares/ares_library_init.h
  30. +126 −4 deps/libuv/src/ares/ares_nowarn.c
  31. +32 −1 deps/libuv/src/ares/ares_nowarn.h
  32. +4 −9 deps/libuv/src/ares/ares_options.c
  33. +3 −0  deps/libuv/src/ares/ares_parse_a_reply.c
  34. +3 −0  deps/libuv/src/ares/ares_parse_aaaa_reply.c
  35. +2 −2 deps/libuv/src/ares/ares_parse_mx_reply.c
  36. +2 −2 deps/libuv/src/ares/ares_parse_ns_reply.c
  37. +12 −3 deps/libuv/src/ares/ares_parse_ptr_reply.c
  38. +3 −3 deps/libuv/src/ares/ares_parse_srv_reply.c
  39. +11,035 −0 deps/libuv/src/ares/ares_platform.c
  40. +43 −0 deps/libuv/src/ares/ares_platform.h
  41. +6 −2 deps/libuv/src/ares/ares_private.h
  42. +24 −25 deps/libuv/src/ares/ares_process.c
  43. +1 −2  deps/libuv/src/ares/ares_search.c
  44. +1 −1  deps/libuv/src/ares/ares_send.c
  45. +12 −4 deps/libuv/src/ares/ares_setup.h
  46. +2 −0  deps/libuv/src/ares/config_cygwin/ares_config.h
  47. +2 −0  deps/libuv/src/ares/config_darwin/ares_config.h
  48. +2 −0  deps/libuv/src/ares/config_freebsd/ares_config.h
  49. +2 −0  deps/libuv/src/ares/config_linux/ares_config.h
  50. +2 −0  deps/libuv/src/ares/config_netbsd/ares_config.h
  51. +2 −0  deps/libuv/src/ares/config_openbsd/ares_config.h
  52. +2 −0  deps/libuv/src/ares/config_sunos/ares_config.h
  53. +3 −3 deps/libuv/src/ares/config_win32/ares_config.h
  54. +21 −20 deps/libuv/src/ares/inet_net_pton.c
  55. +6 −6 deps/libuv/src/ares/inet_net_pton.h
  56. +79 −103 deps/libuv/src/ares/inet_ntop.c
  57. +0 −1  deps/libuv/src/ares/inet_ntop.h
  58. +10 −0 deps/libuv/src/ares/nameser.h
  59. +18 −2 deps/libuv/src/ares/setup_once.h
  60. +2 −1  deps/libuv/src/unix/cares.c
  61. +56 −23 deps/libuv/src/unix/core.c
  62. +29 −0 deps/libuv/src/unix/cygwin.c
  63. +43 −0 deps/libuv/src/unix/darwin.c
  64. +57 −0 deps/libuv/src/unix/dl.c
  65. +137 −0 deps/libuv/src/unix/eio/config_openbsd.h
  66. +1 −1  deps/libuv/src/unix/eio/config_sunos.h
  67. +4 −0 deps/libuv/src/unix/eio/eio.c
  68. +50 −20 deps/libuv/src/unix/error.c
  69. +126 −0 deps/libuv/src/unix/ev/config_openbsd.h
  70. +2 −1  deps/libuv/src/unix/ev/ev.c
  71. +1 −1  deps/libuv/src/unix/ev/ev_epoll.c
  72. +15 −0 deps/libuv/src/unix/ev/ev_kqueue.c
  73. +44 −1 deps/libuv/src/unix/freebsd.c
  74. +54 −43 deps/libuv/src/unix/fs.c
  75. +40 −18 deps/libuv/src/unix/internal.h
  76. +146 −0 deps/libuv/src/unix/kqueue.c
  77. +159 −1 deps/libuv/src/unix/linux.c
  78. +45 −1 deps/libuv/src/unix/netbsd.c
  79. +123 −0 deps/libuv/src/unix/openbsd.c
  80. +13 −12 deps/libuv/src/unix/pipe.c
  81. +59 −46 deps/libuv/src/unix/process.c
  82. +243 −63 deps/libuv/src/unix/stream.c
  83. +116 −1 deps/libuv/src/unix/sunos.c
  84. +113 −67 deps/libuv/src/unix/tcp.c
  85. +104 −25 deps/libuv/src/unix/tty.c
  86. +71 −36 deps/libuv/src/unix/udp.c
  87. +107 −1 deps/libuv/src/uv-common.c
  88. +24 −0 deps/libuv/src/uv-common.h
  89. +9 −2 deps/libuv/src/win/core.c
  90. +25 −37 deps/libuv/src/win/{stdio.c → dl.c}
  91. +6 −30 deps/libuv/src/win/error.c
  92. +420 −0 deps/libuv/src/win/fs-event.c
  93. +342 −125 deps/libuv/src/win/fs.c
  94. +14 −9 deps/libuv/src/win/getaddrinfo.c
  95. +41 −0 deps/libuv/src/win/handle.c
  96. +104 −37 deps/libuv/src/win/internal.h
  97. +645 −148 deps/libuv/src/win/pipe.c
  98. +121 −28 deps/libuv/src/win/process.c
  99. +10 −0 deps/libuv/src/win/req.c
  100. +43 −9 deps/libuv/src/win/stream.c
  101. +395 −137 deps/libuv/src/win/tcp.c
  102. +1 −1  deps/libuv/src/win/threadpool.c
  103. +3 −3 deps/libuv/src/win/timer.c
  104. +1,727 −6 deps/libuv/src/win/tty.c
  105. +97 −131 deps/libuv/src/win/udp.c
  106. +58 −2 deps/libuv/src/win/util.c
  107. +11 −3 deps/libuv/src/win/winapi.c
  108. +33 −4 deps/libuv/src/win/winapi.h
  109. +220 −65 deps/libuv/src/win/winsock.c
  110. +62 −86 deps/libuv/src/win/winsock.h
  111. +2 −0  deps/libuv/test/benchmark-getaddrinfo.c
  112. +5 −0 deps/libuv/test/benchmark-list.h
  113. +2 −7 deps/libuv/test/benchmark-pound.c
  114. +4 −5 deps/libuv/test/benchmark-pump.c
  115. +1 −0  deps/libuv/test/benchmark-sizes.c
  116. +1 −1  deps/libuv/test/benchmark-spawn.c
  117. +144 −0 deps/libuv/test/benchmark-tcp-write-batch.c
  118. +122 −0 deps/libuv/test/blackhole-server.c
  119. +2 −2 deps/libuv/test/echo-server.c
  120. 0  deps/libuv/test/fixtures/empty_file
  121. +216 −0 deps/libuv/test/run-tests.c
  122. +2 −0  deps/libuv/test/task.h
  123. +59 −0 deps/libuv/test/test-error.c
  124. +270 −0 deps/libuv/test/test-fs-event.c
  125. +240 −13 deps/libuv/test/test-fs.c
  126. +36 −0 deps/libuv/test/test-get-loadavg.c
  127. +36 −0 deps/libuv/test/test-get-memory.c
  128. +7 −3 deps/libuv/test/test-getaddrinfo.c
  129. +278 −0 deps/libuv/test/test-ipc.c
  130. +64 −1 deps/libuv/test/test-list.h
  131. +102 −0 deps/libuv/test/test-multiple-listen.c
  132. +2 −3 deps/libuv/test/test-ping-pong.c
  133. +6 −6 deps/libuv/test/test-pipe-bind-error.c
  134. +68 −0 deps/libuv/test/test-pipe-connect-error.c
  135. +90 −7 deps/libuv/test/test-spawn.c
  136. +157 −0 deps/libuv/test/test-stdio-over-pipes.c
  137. +47 −0 deps/libuv/test/test-tcp-close.c
  138. +70 −0 deps/libuv/test/test-tcp-connect-error.c
  139. +68 −0 deps/libuv/test/test-tcp-connect6-error.c
  140. +51 −0 deps/libuv/test/test-tcp-flags.c
  141. +39 −25 deps/libuv/test/test-tcp-write-error.c
  142. +40 −0 deps/libuv/test/test-timer.c
  143. +66 −0 deps/libuv/test/test-tty.c
  144. +139 −0 deps/libuv/test/test-udp-multicast-join.c
  145. +91 −35 deps/libuv/uv.gyp
View
3  deps/libuv/.mailmap
@@ -5,3 +5,6 @@
<bertbelder@gmail.com> <info@2bs.nl>
<alan@prettyrobots.com> <alan@blogometer.com>
San-Tai Hsu <vanilla@fatpipi.com>
+Isaac Z. Schlueter <i@izs.me>
+Saúl Ibarra Corretgé <saghul@gmail.com>
+Yuki OKUMURA <mjt@cltn.org>
View
10 deps/libuv/AUTHORS
@@ -21,3 +21,13 @@ Clifford Heath <clifford.heath@gmail.com>
Jorge Chamorro Bieling <jorge@jorgechamorro.com>
Luis Lavena <luislavena@gmail.com>
Matthew Sporleder <msporleder@gmail.com>
+Erick Tryzelaar <erick.tryzelaar@gmail.com>
+Isaac Z. Schlueter <i@izs.me>
+Pieter Noordhuis <pcnoordhuis@gmail.com>
+Marek Jelen <marek@jelen.biz>
+Fedor Indutny <fedor.indutny@gmail.com>
+Saúl Ibarra Corretgé <saghul@gmail.com>
+Felix Geisendörfer <felix@debuggable.com>
+Yuki OKUMURA <mjt@cltn.org>
+Roman Shtylman <shtylman@gmail.com>
+Frank DENIS <github@pureftpd.org>
View
6 deps/libuv/Makefile
@@ -77,10 +77,10 @@ else
include config-unix.mk
endif
-TESTS=test/echo-server.c test/test-*.c
-BENCHMARKS=test/echo-server.c test/dns-server.c test/benchmark-*.c
+TESTS=test/blackhole-server.c test/echo-server.c test/test-*.c
+BENCHMARKS=test/blackhole-server.c test/echo-server.c test/dns-server.c test/benchmark-*.c
-all: uv.a test/run-tests$(E) test/run-benchmarks$(E)
+all: uv.a
$(CARES_OBJS): %.o: %.c
$(CC) -o $*.o -c $(CFLAGS) $(CPPFLAGS) $< -DHAVE_CONFIG_H
View
50 deps/libuv/README → deps/libuv/README.md
@@ -1,10 +1,48 @@
-This is the new networking layer for Node. Its purpose is to abstract
-IOCP on windows and libev on Unix systems. We intend to eventually contain
-all platform differences in this library.
+# libuv
+
+libuv is a new platform layer for Node. Its purpose is to abstract IOCP on
+windows and libev on Unix systems. We intend to eventually contain all
+platform differences in this library.
http://nodejs.org/
-= Build Instructions
+## Features
+
+ * Non-blocking TCP sockets
+
+ * Non-blocking named pipes
+
+ * UDP
+
+ * Timers
+
+ * Child process spawning
+
+ * Asynchronous DNS via c-ares or `uv_getaddrinfo`.
+
+ * Asynchronous file system APIs `uv_fs_*`
+
+ * High resolution time `uv_hrtime`
+
+ * Current executable path look up `uv_exepath`
+
+ * Thread pool scheduling `uv_queue_work`
+
+ * ANSI escape code controlled TTY `uv_tty_t`
+
+ * File system events Currently supports inotify, `ReadDirectoryChangesW`
+ and kqueue. Event ports in the near future.
+ `uv_fs_event_t`
+
+ * IPC and socket sharing between processes `uv_write2`
+
+
+## Documentation
+
+See `include/uv.h`.
+
+
+## Build Instructions
For GCC (including MinGW) there are two methods building: via normal
makefiles or via GYP. GYP is a meta-build system which can generate MSVS,
@@ -19,7 +57,7 @@ To build with Visual Studio run the vcbuilds.bat file which will
checkout the GYP code into build/gyp and generate the uv.sln and
related files.
-Windows users can also build from cmd-line using msbuild. This is
+Windows users can also build from cmd-line using msbuild. This is
done by running vcbuild.bat from Visual Studio command prompt.
To have GYP generate build script for another system you will need to
@@ -38,7 +76,7 @@ Macintosh users run
xcodebuild -project uv.xcodeproj -configuration Release -target All
-= Supported Platforms
+## Supported Platforms
Microsoft Windows operating systems since Windows XP SP2. It can be built
with either Visual Studio or MinGW.
View
20 deps/libuv/build/gcc_version.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+import os
+import re
+import subprocess
+import sys
+
+
+def DoMain(*args):
+ cc = os.environ.get('CC', 'gcc')
+ stdin, stderr = os.pipe()
+ subprocess.call([cc, '-v'], stderr=stderr)
+ output = os.read(stdin, 4096)
+ match = re.search("\ngcc version (\d+\.\d+\.\d+)", output)
+ if match:
+ print(match.group(1))
+
+
+if __name__ == '__main__':
+ DoMain(*sys.argv)
View
23 deps/libuv/common.gypi
@@ -32,6 +32,11 @@
'LinkIncremental': 2, # enable incremental linking
},
},
+ 'conditions': [
+ ['OS != "win"', {
+ 'defines': [ 'EV_VERIFY=2' ],
+ }],
+ ]
},
'Release': {
'defines': [ 'NDEBUG' ],
@@ -109,18 +114,27 @@
],
}],
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
- 'cflags': [ '-Wall', '-pthread', ],
+ 'variables': {
+ 'gcc_version%': '<!(python build/gcc_version.py)>)',
+ },
+ 'cflags': [ '-Wall' ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
- 'ldflags': [ '-pthread', ],
'conditions': [
- [ 'target_arch=="ia32"', {
+ [ 'host_arch != target_arch and target_arch=="ia32"', {
'cflags': [ '-m32' ],
'ldflags': [ '-m32' ],
}],
[ 'OS=="linux"', {
'cflags': [ '-ansi' ],
}],
- [ 'visibility=="hidden"', {
+ [ 'OS=="solaris"', {
+ 'cflags': [ '-pthreads' ],
+ 'ldflags': [ '-pthreads' ],
+ }, {
+ 'cflags': [ '-pthread' ],
+ 'ldflags': [ '-pthread' ],
+ }],
+ [ 'visibility=="hidden" and gcc_version >= "4.0.0"', {
'cflags': [ '-fvisibility=hidden' ],
}],
],
@@ -138,7 +152,6 @@
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
- 'GCC_VERSION': '4.2',
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
'MACOSX_DEPLOYMENT_TARGET': '10.4', # -mmacosx-version-min=10.4
'PREBINDING': 'NO', # No -Wl,-prebind
View
1  deps/libuv/config-mingw.mk
@@ -28,6 +28,7 @@ CFLAGS=$(CPPFLAGS) -g --std=gnu89 -D_WIN32_WINNT=0x0501 -Isrc/ares/config_win32
LINKFLAGS=-lm
CARES_OBJS += src/ares/windows_port.o
+CARES_OBJS += src/ares/ares_platform.o
WIN_SRCS=$(wildcard src/win/*.c)
WIN_OBJS=$(WIN_SRCS:.c=.o)
View
19 deps/libuv/config-unix.mk
@@ -18,11 +18,9 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
-CC = $(PREFIX)gcc
-AR = $(PREFIX)ar
E=
CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
-CFLAGS=-g
+CFLAGS += -g
CPPFLAGS += -Isrc/unix/ev
LINKFLAGS=-lm
@@ -30,6 +28,7 @@ CPPFLAGS += -D_LARGEFILE_SOURCE
CPPFLAGS += -D_FILE_OFFSET_BITS=64
OBJS += src/unix/core.o
+OBJS += src/unix/dl.o
OBJS += src/unix/fs.o
OBJS += src/unix/cares.o
OBJS += src/unix/udp.o
@@ -44,7 +43,7 @@ ifeq (SunOS,$(uname_S))
EV_CONFIG=config_sunos.h
EIO_CONFIG=config_sunos.h
CPPFLAGS += -Isrc/ares/config_sunos -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
-LINKFLAGS+=-lsocket -lnsl
+LINKFLAGS+=-lsocket -lnsl -lkstat
OBJS += src/unix/sunos.o
endif
@@ -54,6 +53,7 @@ EIO_CONFIG=config_darwin.h
CPPFLAGS += -Isrc/ares/config_darwin
LINKFLAGS+=-framework CoreServices
OBJS += src/unix/darwin.o
+OBJS += src/unix/kqueue.o
endif
ifeq (Linux,$(uname_S))
@@ -71,6 +71,7 @@ EIO_CONFIG=config_freebsd.h
CPPFLAGS += -Isrc/ares/config_freebsd
LINKFLAGS+=
OBJS += src/unix/freebsd.o
+OBJS += src/unix/kqueue.o
endif
ifeq (NetBSD,$(uname_S))
@@ -79,6 +80,16 @@ EIO_CONFIG=config_netbsd.h
CPPFLAGS += -Isrc/ares/config_netbsd
LINKFLAGS+=
OBJS += src/unix/netbsd.o
+OBJS += src/unix/kqueue.o
+endif
+
+ifeq (OpenBSD,$(uname_S))
+EV_CONFIG=config_openbsd.h
+EIO_CONFIG=config_openbsd.h
+CPPFLAGS += -Isrc/ares/config_openbsd
+LINKFLAGS+=
+OBJS += src/unix/openbsd.o
+OBJS += src/unix/kqueue.o
endif
ifneq (,$(findstring CYGWIN,$(uname_S)))
View
13 deps/libuv/include/ares.h
@@ -1,6 +1,6 @@
/* Copyright 1998, 2009 by the Massachusetts Institute of Technology.
- * Copyright (C) 2007-2010 by Daniel Stenberg
+ * Copyright (C) 2007-2011 by Daniel Stenberg
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
@@ -96,10 +96,19 @@ typedef int ares_socklen_t;
# include <netinet/in.h>
# include <sys/socket.h>
# include <tcp.h>
+#elif defined(_WIN32_WCE)
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h>
+# include <winsock.h>
#elif defined(WIN32)
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN
+# endif
+# include <windows.h>
# include <winsock2.h>
# include <ws2tcpip.h>
-# include <windows.h>
#else
# include <sys/socket.h>
# include <netinet/in.h>
View
4 deps/libuv/include/ares_version.h
@@ -7,11 +7,11 @@
#define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 7
-#define ARES_VERSION_PATCH 4
+#define ARES_VERSION_PATCH 5
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH))
-#define ARES_VERSION_STR "1.7.4"
+#define ARES_VERSION_STR "1.7.5-DEV"
#if (ARES_VERSION >= 0x010700)
# define CARES_HAVE_ARES_LIBRARY_INIT 1
View
1  deps/libuv/include/uv-private/ev.h
@@ -207,6 +207,7 @@ enum {
EV_NONE = 0x00, /* no events */
EV_READ = 0x01, /* ev_io detected read will not block */
EV_WRITE = 0x02, /* ev_io detected write will not block */
+ EV_LIBUV_KQUEUE_HACK = 0x40,
EV__IOFDSET = 0x80, /* internal use only */
EV_IO = EV_READ, /* alias for type-detection */
EV_TIMER = 0x00000100, /* timer timed out */
View
52 deps/libuv/include/uv-private/uv-unix.h
@@ -29,10 +29,11 @@
#include <sys/types.h>
#include <sys/socket.h>
-#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
-
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <termios.h>
/* Note: May be cast to struct iovec. See writev(2). */
typedef struct {
@@ -42,6 +43,10 @@ typedef struct {
typedef int uv_file;
+/* Platform-specific definitions for uv_dlopen support. */
+typedef void* uv_lib_t;
+#define UV_DYNAMIC /* empty */
+
#define UV_LOOP_PRIVATE_FIELDS \
ares_channel channel; \
/* \
@@ -90,8 +95,6 @@ typedef int uv_file;
#define UV_STREAM_PRIVATE_FIELDS \
- uv_read_cb read_cb; \
- uv_alloc_cb alloc_cb; \
uv_connect_t *connect_req; \
uv_shutdown_t *shutdown_req; \
ev_io read_watcher; \
@@ -100,7 +103,8 @@ typedef int uv_file;
ngx_queue_t write_completed_queue; \
int delayed_error; \
uv_connection_cb connection_cb; \
- int accepted_fd;
+ int accepted_fd; \
+ int blocking;
/* UV_TCP */
@@ -174,6 +178,42 @@ typedef int uv_file;
#define UV_WORK_PRIVATE_FIELDS \
eio_req* eio;
-#define UV_TTY_PRIVATE_FIELDS /* empty */
+#define UV_TTY_PRIVATE_FIELDS \
+ struct termios orig_termios; \
+ int mode;
+
+/* UV_FS_EVENT_PRIVATE_FIELDS */
+#if defined(__linux__)
+
+#define UV_FS_EVENT_PRIVATE_FIELDS \
+ ev_io read_watcher; \
+ uv_fs_event_cb cb; \
+
+#elif (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) \
+ || defined(__FreeBSD__) \
+ || defined(__OpenBSD__) \
+ || defined(__NetBSD__)
+
+#define UV_FS_EVENT_PRIVATE_FIELDS \
+ ev_io event_watcher; \
+ uv_fs_event_cb cb; \
+ int fflags; \
+
+#elif defined(__sun)
+
+#include <sys/port.h>
+#include <port.h>
+
+#define UV_FS_EVENT_PRIVATE_FIELDS \
+ ev_io event_watcher; \
+ uv_fs_event_cb cb; \
+ file_obj_t fo; \
+
+#else
+
+/* Stub for platforms where the file watcher isn't implemented yet. */
+#define UV_FS_EVENT_PRIVATE_FIELDS
+
+#endif
#endif /* UV_UNIX_H */
View
188 deps/libuv/include/uv-private/uv-win.h
@@ -34,6 +34,98 @@
#define MAX_PIPENAME_LEN 256
+/*
+ * Guids and typedefs for winsock extension functions
+ * Mingw32 doesn't have these :-(
+ */
+#ifndef WSAID_ACCEPTEX
+# define WSAID_ACCEPTEX \
+ {0xb5367df1, 0xcbac, 0x11cf, \
+ {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
+
+# define WSAID_CONNECTEX \
+ {0x25a207b9, 0xddf3, 0x4660, \
+ {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}}
+
+# define WSAID_GETACCEPTEXSOCKADDRS \
+ {0xb5367df2, 0xcbac, 0x11cf, \
+ {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
+
+# define WSAID_DISCONNECTEX \
+ {0x7fda2e11, 0x8630, 0x436f, \
+ {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
+
+# define WSAID_TRANSMITFILE \
+ {0xb5367df0, 0xcbac, 0x11cf, \
+ {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
+
+ typedef BOOL PASCAL (*LPFN_ACCEPTEX)
+ (SOCKET sListenSocket,
+ SOCKET sAcceptSocket,
+ PVOID lpOutputBuffer,
+ DWORD dwReceiveDataLength,
+ DWORD dwLocalAddressLength,
+ DWORD dwRemoteAddressLength,
+ LPDWORD lpdwBytesReceived,
+ LPOVERLAPPED lpOverlapped);
+
+ typedef BOOL PASCAL (*LPFN_CONNECTEX)
+ (SOCKET s,
+ const struct sockaddr* name,
+ int namelen,
+ PVOID lpSendBuffer,
+ DWORD dwSendDataLength,
+ LPDWORD lpdwBytesSent,
+ LPOVERLAPPED lpOverlapped);
+
+ typedef void PASCAL (*LPFN_GETACCEPTEXSOCKADDRS)
+ (PVOID lpOutputBuffer,
+ DWORD dwReceiveDataLength,
+ DWORD dwLocalAddressLength,
+ DWORD dwRemoteAddressLength,
+ LPSOCKADDR* LocalSockaddr,
+ LPINT LocalSockaddrLength,
+ LPSOCKADDR* RemoteSockaddr,
+ LPINT RemoteSockaddrLength);
+
+ typedef BOOL PASCAL (*LPFN_DISCONNECTEX)
+ (SOCKET hSocket,
+ LPOVERLAPPED lpOverlapped,
+ DWORD dwFlags,
+ DWORD reserved);
+
+ typedef BOOL PASCAL (*LPFN_TRANSMITFILE)
+ (SOCKET hSocket,
+ HANDLE hFile,
+ DWORD nNumberOfBytesToWrite,
+ DWORD nNumberOfBytesPerSend,
+ LPOVERLAPPED lpOverlapped,
+ LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
+ DWORD dwFlags);
+#endif
+
+typedef int (WSAAPI* LPFN_WSARECV)
+ (SOCKET socket,
+ LPWSABUF buffers,
+ DWORD buffer_count,
+ LPDWORD bytes,
+ LPDWORD flags,
+ LPWSAOVERLAPPED overlapped,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE
+ completion_routine);
+
+typedef int (WSAAPI* LPFN_WSARECVFROM)
+ (SOCKET socket,
+ LPWSABUF buffers,
+ DWORD buffer_count,
+ LPDWORD bytes,
+ LPDWORD flags,
+ struct sockaddr* addr,
+ LPINT addr_len,
+ LPWSAOVERLAPPED overlapped,
+ LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
+
+
/**
* It should be possible to cast uv_buf_t[] to WSABUF[]
* see http://msdn.microsoft.com/en-us/library/ms741542(v=vs.85).aspx
@@ -45,6 +137,10 @@ typedef struct uv_buf_t {
typedef int uv_file;
+/* Platform-specific definitions for uv_dlopen support. */
+typedef HMODULE uv_lib_t;
+#define UV_DYNAMIC FAR WINAPI
+
RB_HEAD(uv_timer_tree_s, uv_timer_s);
#define UV_LOOP_PRIVATE_FIELDS \
@@ -75,9 +171,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
uv_idle_t* next_idle_handle; \
ares_channel ares_chan; \
int ares_active_sockets; \
- uv_timer_t ares_polling_timer; \
- /* Last error code */ \
- uv_err_t last_error;
+ uv_timer_t ares_polling_timer;
#define UV_REQ_TYPE_PRIVATE \
/* TODO: remove the req suffix */ \
@@ -86,7 +180,8 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
UV_GETADDRINFO_REQ, \
UV_PROCESS_EXIT, \
UV_PROCESS_CLOSE, \
- UV_UDP_RECV
+ UV_UDP_RECV, \
+ UV_FS_EVENT_REQ
#define UV_REQ_PRIVATE_FIELDS \
union { \
@@ -99,7 +194,10 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
struct uv_req_s* next_req;
#define UV_WRITE_PRIVATE_FIELDS \
- /* empty */
+ int ipc_header; \
+ uv_buf_t write_buffer; \
+ HANDLE event_handle; \
+ HANDLE wait_handle;
#define UV_CONNECT_PRIVATE_FIELDS \
/* empty */
@@ -116,12 +214,21 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
HANDLE pipeHandle; \
struct uv_pipe_accept_s* next_pending; \
} uv_pipe_accept_t; \
+ \
typedef struct uv_tcp_accept_s { \
UV_REQ_FIELDS \
SOCKET accept_socket; \
char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \
+ HANDLE event_handle; \
+ HANDLE wait_handle; \
struct uv_tcp_accept_s* next_pending; \
- } uv_tcp_accept_t;
+ } uv_tcp_accept_t; \
+ \
+ typedef struct uv_read_s { \
+ UV_REQ_FIELDS \
+ HANDLE event_handle; \
+ HANDLE wait_handle; \
+ } uv_read_t;
#define uv_stream_connection_fields \
unsigned int write_reqs_pending; \
@@ -132,9 +239,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
#define UV_STREAM_PRIVATE_FIELDS \
unsigned int reqs_pending; \
- uv_alloc_cb alloc_cb; \
- uv_read_cb read_cb; \
- uv_req_t read_req; \
+ uv_read_t read_req; \
union { \
struct { uv_stream_connection_fields }; \
struct { uv_stream_server_fields }; \
@@ -142,14 +247,17 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
#define uv_tcp_server_fields \
uv_tcp_accept_t* accept_reqs; \
- uv_tcp_accept_t* pending_accepts;
+ unsigned int processed_accepts; \
+ uv_tcp_accept_t* pending_accepts; \
+ LPFN_ACCEPTEX func_acceptex;
#define uv_tcp_connection_fields \
- uv_buf_t read_buffer;
+ uv_buf_t read_buffer; \
+ LPFN_CONNECTEX func_connectex;
#define UV_TCP_PRIVATE_FIELDS \
SOCKET socket; \
- uv_err_t bind_error; \
+ int bind_error; \
union { \
struct { uv_tcp_server_fields }; \
struct { uv_tcp_connection_fields }; \
@@ -163,14 +271,21 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
struct sockaddr_storage recv_from; \
int recv_from_len; \
uv_udp_recv_cb recv_cb; \
- uv_alloc_cb alloc_cb;
+ uv_alloc_cb alloc_cb; \
+ LPFN_WSARECV func_wsarecv; \
+ LPFN_WSARECVFROM func_wsarecvfrom;
#define uv_pipe_server_fields \
- uv_pipe_accept_t accept_reqs[4]; \
- uv_pipe_accept_t* pending_accepts;
+ uv_pipe_accept_t accept_reqs[4]; \
+ uv_pipe_accept_t* pending_accepts;
#define uv_pipe_connection_fields \
- uv_timer_t* eof_timer;
+ uv_timer_t* eof_timer; \
+ uv_write_t ipc_header_write_req; \
+ int ipc_pid; \
+ uint64_t remaining_ipc_rawdata_bytes; \
+ WSAPROTOCOL_INFOW* pending_socket_info; \
+ uv_write_t* non_overlapped_writes_tail;
#define UV_PIPE_PRIVATE_FIELDS \
HANDLE handle; \
@@ -180,6 +295,33 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
struct { uv_pipe_connection_fields }; \
};
+/* TODO: put the parser states in an union - TTY handles are always */
+/* half-duplex so read-state can safely overlap write-state. */
+#define UV_TTY_PRIVATE_FIELDS \
+ HANDLE handle; \
+ HANDLE read_line_handle; \
+ uv_buf_t read_line_buffer; \
+ HANDLE read_raw_wait; \
+ DWORD original_console_mode; \
+ /* Fields used for translating win */ \
+ /* keystrokes into vt100 characters */ \
+ char last_key[8]; \
+ unsigned char last_key_offset; \
+ unsigned char last_key_len; \
+ INPUT_RECORD last_input_record; \
+ WCHAR last_utf16_high_surrogate; \
+ /* utf8-to-utf16 conversion state */ \
+ unsigned char utf8_bytes_left; \
+ unsigned int utf8_codepoint; \
+ /* eol conversion state */ \
+ unsigned char previous_eol; \
+ /* ansi parser state */ \
+ unsigned char ansi_parser_state; \
+ unsigned char ansi_csi_argc; \
+ unsigned short ansi_csi_argv[4]; \
+ COORD saved_position; \
+ WORD saved_attributes;
+
#define UV_TIMER_PRIVATE_FIELDS \
RB_ENTRY(uv_timer_s) tree_entry; \
int64_t due; \
@@ -243,6 +385,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
HANDLE close_handle;
#define UV_FS_PRIVATE_FIELDS \
+ wchar_t* pathw; \
int flags; \
int last_error; \
struct _stati64 stat; \
@@ -261,8 +404,17 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
#define UV_WORK_PRIVATE_FIELDS \
-
-#define UV_TTY_PRIVATE_FIELDS /* empty */
+#define UV_FS_EVENT_PRIVATE_FIELDS \
+ struct uv_fs_event_req_s { \
+ UV_REQ_FIELDS \
+ } req; \
+ HANDLE dir_handle; \
+ int req_pending; \
+ uv_fs_event_cb cb; \
+ wchar_t* filew; \
+ wchar_t* short_filew; \
+ int is_path_dir; \
+ char* buffer;
int uv_utf16_to_utf8(const wchar_t* utf16Buffer, size_t utf16Size,
char* utf8Buffer, size_t utf8Size);
View
651 deps/libuv/include/uv.h
@@ -27,10 +27,29 @@
extern "C" {
#endif
+#ifdef _WIN32
+ /* Windows - set up dll import/export decorators. */
+# if defined(BUILDING_UV_SHARED)
+ /* Building shared library. Export everything from c-ares as well. */
+# define UV_EXTERN __declspec(dllexport)
+# define CARES_BUILDING_LIBRARY 1
+# elif defined(USING_UV_SHARED)
+ /* Using shared library. Use shared c-ares as well. */
+# define UV_EXTERN __declspec(dllimport)
+# else
+ /* Building static library. Build c-ares statically as well. */
+# define UV_EXTERN /* nothing */
+# define CARES_STATICLIB 1
+# endif
+#else
+ /* Unix. TODO: symbol hiding */
+# define UV_EXTERN /* nothing */
+#endif
+
+
#define UV_VERSION_MAJOR 0
#define UV_VERSION_MINOR 1
-#define CARES_STATICLIB 1
#include <stdint.h> /* int64_t */
#include <sys/types.h> /* size_t */
@@ -41,109 +60,19 @@ extern "C" {
typedef intptr_t ssize_t;
#endif
-typedef struct uv_loop_s uv_loop_t;
-typedef struct uv_ares_task_s uv_ares_task_t;
-typedef struct uv_err_s uv_err_t;
-typedef struct uv_handle_s uv_handle_t;
-typedef struct uv_stream_s uv_stream_t;
-typedef struct uv_tcp_s uv_tcp_t;
-typedef struct uv_udp_s uv_udp_t;
-typedef struct uv_pipe_s uv_pipe_t;
-typedef struct uv_tty_s uv_tty_t;
-typedef struct uv_timer_s uv_timer_t;
-typedef struct uv_prepare_s uv_prepare_t;
-typedef struct uv_check_s uv_check_t;
-typedef struct uv_idle_s uv_idle_t;
-typedef struct uv_async_s uv_async_t;
-typedef struct uv_getaddrinfo_s uv_getaddrinfo_t;
-typedef struct uv_process_s uv_process_t;
-typedef struct uv_counters_s uv_counters_t;
-/* Request types */
-typedef struct uv_req_s uv_req_t;
-typedef struct uv_shutdown_s uv_shutdown_t;
-typedef struct uv_write_s uv_write_t;
-typedef struct uv_connect_s uv_connect_t;
-typedef struct uv_udp_send_s uv_udp_send_t;
-typedef struct uv_fs_s uv_fs_t;
-typedef struct uv_work_s uv_work_t;
-
#if defined(__unix__) || defined(__POSIX__) || defined(__APPLE__)
# include "uv-private/uv-unix.h"
#else
# include "uv-private/uv-win.h"
#endif
-
-/*
- * This function must be called before any other functions in libuv.
- *
- * All functions besides uv_run() are non-blocking.
- *
- * All callbacks in libuv are made asynchronously. That is they are never
- * made by the function that takes them as a parameter.
- */
-uv_loop_t* uv_loop_new();
-void uv_loop_delete(uv_loop_t*);
-
-
-/*
- * Returns the default loop.
- */
-uv_loop_t* uv_default_loop();
-
-/*
- * This function starts the event loop. It blocks until the reference count
- * of the loop drops to zero.
- */
-int uv_run(uv_loop_t*);
-
-/*
- * Manually modify the event loop's reference count. Useful if the user wants
- * to have a handle or timeout that doesn't keep the loop alive.
- */
-void uv_ref(uv_loop_t*);
-void uv_unref(uv_loop_t*);
-
-void uv_update_time(uv_loop_t*);
-int64_t uv_now(uv_loop_t*);
-
-
-/*
- * The status parameter is 0 if the request completed successfully,
- * and should be -1 if the request was cancelled or failed.
- * For uv_close_cb, -1 means that the handle was closed due to an error.
- * Error details can be obtained by calling uv_last_error().
- *
- * In the case of uv_read_cb the uv_buf_t returned should be freed by the
- * user.
- */
-typedef uv_buf_t (*uv_alloc_cb)(uv_handle_t* handle, size_t suggested_size);
-typedef void (*uv_read_cb)(uv_stream_t* stream, ssize_t nread, uv_buf_t buf);
-typedef void (*uv_write_cb)(uv_write_t* req, int status);
-typedef void (*uv_connect_cb)(uv_connect_t* req, int status);
-typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status);
-typedef void (*uv_connection_cb)(uv_stream_t* server, int status);
-typedef void (*uv_close_cb)(uv_handle_t* handle);
-typedef void (*uv_timer_cb)(uv_timer_t* handle, int status);
-/* TODO: do these really need a status argument? */
-typedef void (*uv_async_cb)(uv_async_t* handle, int status);
-typedef void (*uv_prepare_cb)(uv_prepare_t* handle, int status);
-typedef void (*uv_check_cb)(uv_check_t* handle, int status);
-typedef void (*uv_idle_cb)(uv_idle_t* handle, int status);
-typedef void (*uv_getaddrinfo_cb)(uv_getaddrinfo_t* handle, int status,
- struct addrinfo* res);
-typedef void (*uv_exit_cb)(uv_process_t*, int exit_status, int term_signal);
-typedef void (*uv_fs_cb)(uv_fs_t* req);
-typedef void (*uv_work_cb)(uv_work_t* req);
-typedef void (*uv_after_work_cb)(uv_work_t* req);
-
-
/* Expand this list if necessary. */
typedef enum {
UV_UNKNOWN = -1,
UV_OK = 0,
UV_EOF,
- UV_EACCESS,
+ UV_EADDRINFO,
+ UV_EACCES,
UV_EAGAIN,
UV_EADDRINUSE,
UV_EADDRNOTAVAIL,
@@ -167,12 +96,14 @@ typedef enum {
UV_ENFILE,
UV_ENOBUFS,
UV_ENOMEM,
+ UV_ENOTDIR,
UV_ENONET,
UV_ENOPROTOOPT,
UV_ENOTCONN,
UV_ENOTSOCK,
UV_ENOTSUP,
UV_ENOENT,
+ UV_ENOSYS,
UV_EPIPE,
UV_EPROTO,
UV_EPROTONOSUPPORT,
@@ -201,7 +132,8 @@ typedef enum {
UV_ASYNC,
UV_ARES_TASK,
UV_ARES_EVENT,
- UV_PROCESS
+ UV_PROCESS,
+ UV_FS_EVENT
} uv_handle_type;
typedef enum {
@@ -220,6 +152,121 @@ typedef enum {
} uv_req_type;
+
+typedef struct uv_loop_s uv_loop_t;
+typedef struct uv_ares_task_s uv_ares_task_t;
+typedef struct uv_err_s uv_err_t;
+typedef struct uv_handle_s uv_handle_t;
+typedef struct uv_stream_s uv_stream_t;
+typedef struct uv_tcp_s uv_tcp_t;
+typedef struct uv_udp_s uv_udp_t;
+typedef struct uv_pipe_s uv_pipe_t;
+typedef struct uv_tty_s uv_tty_t;
+typedef struct uv_timer_s uv_timer_t;
+typedef struct uv_prepare_s uv_prepare_t;
+typedef struct uv_check_s uv_check_t;
+typedef struct uv_idle_s uv_idle_t;
+typedef struct uv_async_s uv_async_t;
+typedef struct uv_getaddrinfo_s uv_getaddrinfo_t;
+typedef struct uv_process_s uv_process_t;
+typedef struct uv_counters_s uv_counters_t;
+/* Request types */
+typedef struct uv_req_s uv_req_t;
+typedef struct uv_shutdown_s uv_shutdown_t;
+typedef struct uv_write_s uv_write_t;
+typedef struct uv_connect_s uv_connect_t;
+typedef struct uv_udp_send_s uv_udp_send_t;
+typedef struct uv_fs_s uv_fs_t;
+/* uv_fs_event_t is a subclass of uv_handle_t. */
+typedef struct uv_fs_event_s uv_fs_event_t;
+typedef struct uv_work_s uv_work_t;
+
+
+/*
+ * This function must be called before any other functions in libuv.
+ *
+ * All functions besides uv_run() are non-blocking.
+ *
+ * All callbacks in libuv are made asynchronously. That is they are never
+ * made by the function that takes them as a parameter.
+ */
+UV_EXTERN uv_loop_t* uv_loop_new();
+UV_EXTERN void uv_loop_delete(uv_loop_t*);
+
+
+/*
+ * Returns the default loop.
+ */
+UV_EXTERN uv_loop_t* uv_default_loop();
+
+/*
+ * This function starts the event loop. It blocks until the reference count
+ * of the loop drops to zero.
+ */
+UV_EXTERN int uv_run (uv_loop_t*);
+
+/*
+ * Manually modify the event loop's reference count. Useful if the user wants
+ * to have a handle or timeout that doesn't keep the loop alive.
+ */
+UV_EXTERN void uv_ref(uv_loop_t*);
+UV_EXTERN void uv_unref(uv_loop_t*);
+
+UV_EXTERN void uv_update_time(uv_loop_t*);
+UV_EXTERN int64_t uv_now(uv_loop_t*);
+
+
+/*
+ * The status parameter is 0 if the request completed successfully,
+ * and should be -1 if the request was cancelled or failed.
+ * For uv_close_cb, -1 means that the handle was closed due to an error.
+ * Error details can be obtained by calling uv_last_error().
+ *
+ * In the case of uv_read_cb the uv_buf_t returned should be freed by the
+ * user.
+ */
+typedef uv_buf_t (*uv_alloc_cb)(uv_handle_t* handle, size_t suggested_size);
+typedef void (*uv_read_cb)(uv_stream_t* stream, ssize_t nread, uv_buf_t buf);
+/*
+ * Just like the uv_read_cb except that if the pending parameter is true
+ * then you can use uv_accept() to pull the new handle into the process.
+ * If no handle is pending then pending will be UV_UNKNOWN_HANDLE.
+ */
+typedef void (*uv_read2_cb)(uv_pipe_t* pipe, ssize_t nread, uv_buf_t buf,
+ uv_handle_type pending);
+typedef void (*uv_write_cb)(uv_write_t* req, int status);
+typedef void (*uv_connect_cb)(uv_connect_t* req, int status);
+typedef void (*uv_shutdown_cb)(uv_shutdown_t* req, int status);
+typedef void (*uv_connection_cb)(uv_stream_t* server, int status);
+typedef void (*uv_close_cb)(uv_handle_t* handle);
+typedef void (*uv_timer_cb)(uv_timer_t* handle, int status);
+/* TODO: do these really need a status argument? */
+typedef void (*uv_async_cb)(uv_async_t* handle, int status);
+typedef void (*uv_prepare_cb)(uv_prepare_t* handle, int status);
+typedef void (*uv_check_cb)(uv_check_t* handle, int status);
+typedef void (*uv_idle_cb)(uv_idle_t* handle, int status);
+typedef void (*uv_getaddrinfo_cb)(uv_getaddrinfo_t* handle, int status,
+ struct addrinfo* res);
+typedef void (*uv_exit_cb)(uv_process_t*, int exit_status, int term_signal);
+typedef void (*uv_fs_cb)(uv_fs_t* req);
+typedef void (*uv_work_cb)(uv_work_t* req);
+typedef void (*uv_after_work_cb)(uv_work_t* req);
+
+/*
+* This will be called repeatedly after the uv_fs_event_t is initialized.
+* If uv_fs_event_t was initialized with a directory the filename parameter
+* will be a relative path to a file contained in the directory.
+* The events paramenter is an ORed mask of enum uv_fs_event elements.
+*/
+typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle, const char* filename,
+ int events, int status);
+
+typedef enum {
+ UV_LEAVE_GROUP = 0,
+ UV_JOIN_GROUP
+} uv_membership;
+
+
struct uv_err_s {
/* read-only */
uv_err_code code;
@@ -233,9 +280,9 @@ struct uv_err_s {
* On error the user should then call uv_last_error() to determine
* the error code.
*/
-uv_err_t uv_last_error(uv_loop_t*);
-char* uv_strerror(uv_err_t err);
-const char* uv_err_name(uv_err_t err);
+UV_EXTERN uv_err_t uv_last_error(uv_loop_t*);
+UV_EXTERN const char* uv_strerror(uv_err_t err);
+UV_EXTERN const char* uv_err_name(uv_err_t err);
#define UV_REQ_FIELDS \
@@ -264,7 +311,8 @@ UV_PRIVATE_REQ_TYPES
* initialized stream. req should be an uninitalized shutdown request
* struct. The cb is a called after shutdown is complete.
*/
-int uv_shutdown(uv_shutdown_t* req, uv_stream_t* handle, uv_shutdown_cb cb);
+UV_EXTERN int uv_shutdown(uv_shutdown_t* req, uv_stream_t* handle,
+ uv_shutdown_cb cb);
struct uv_shutdown_s {
UV_REQ_FIELDS
@@ -293,7 +341,7 @@ struct uv_handle_s {
* Returns 1 if the prepare/check/idle handle has been started, 0 otherwise.
* For other handle types this always returns 1.
*/
-int uv_is_active(uv_handle_t* handle);
+UV_EXTERN int uv_is_active(uv_handle_t* handle);
/*
* Request handle to be closed. close_cb will be called asynchronously after
@@ -303,7 +351,7 @@ int uv_is_active(uv_handle_t* handle);
* close_cb will still be deferred to the next iteration of the event loop.
* It gives you a chance to free up any resources associated with the handle.
*/
-void uv_close(uv_handle_t* handle, uv_close_cb close_cb);
+UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb);
/*
@@ -312,12 +360,15 @@ void uv_close(uv_handle_t* handle, uv_close_cb close_cb);
* base and len members of the uv_buf_t struct. The user is responsible for
* freeing base after the uv_buf_t is done. Return struct passed by value.
*/
-uv_buf_t uv_buf_init(char* base, size_t len);
+UV_EXTERN uv_buf_t uv_buf_init(char* base, size_t len);
#define UV_STREAM_FIELDS \
/* number of bytes queued for writing */ \
size_t write_queue_size; \
+ uv_alloc_cb alloc_cb; \
+ uv_read_cb read_cb; \
+ uv_read2_cb read2_cb; \
/* private */ \
UV_STREAM_PRIVATE_FIELDS
@@ -326,15 +377,15 @@ uv_buf_t uv_buf_init(char* base, size_t len);
*
* uv_stream is an abstract class.
*
- * uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t, uv_tty_t
- * and soon uv_file_t.
+ * uv_stream_t is the parent class of uv_tcp_t, uv_pipe_t, uv_tty_t, and
+ * soon uv_file_t.
*/
struct uv_stream_s {
UV_HANDLE_FIELDS
UV_STREAM_FIELDS
};
-int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb);
+UV_EXTERN int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb);
/*
* This call is used in conjunction with uv_listen() to accept incoming
@@ -347,7 +398,7 @@ int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb);
* once, it may fail. It is suggested to only call uv_accept once per
* uv_connection_cb call.
*/
-int uv_accept(uv_stream_t* server, uv_stream_t* client);
+UV_EXTERN int uv_accept(uv_stream_t* server, uv_stream_t* client);
/*
* Read data from an incoming stream. The callback will be made several
@@ -359,17 +410,18 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client);
* eof; it happens when libuv requested a buffer through the alloc callback
* but then decided that it didn't need that buffer.
*/
-int uv_read_start(uv_stream_t*, uv_alloc_cb alloc_cb, uv_read_cb read_cb);
+UV_EXTERN int uv_read_start(uv_stream_t*, uv_alloc_cb alloc_cb,
+ uv_read_cb read_cb);
-int uv_read_stop(uv_stream_t*);
+UV_EXTERN int uv_read_stop(uv_stream_t*);
-typedef enum {
- UV_STDIN = 0,
- UV_STDOUT,
- UV_STDERR
-} uv_std_type;
+/*
+ * Extended read methods for receiving handles over a pipe. The pipe must be
+ * initialized with ipc == 1.
+ */
+UV_EXTERN int uv_read2_start(uv_stream_t*, uv_alloc_cb alloc_cb,
+ uv_read2_cb read_cb);
-uv_stream_t* uv_std_handle(uv_loop_t*, uv_std_type type);
/*
* Write data to stream. Buffers are written in order. Example:
@@ -389,13 +441,17 @@ uv_stream_t* uv_std_handle(uv_loop_t*, uv_std_type type);
* uv_write(req, stream, b, 2);
*
*/
-int uv_write(uv_write_t* req, uv_stream_t* handle, uv_buf_t bufs[], int bufcnt,
- uv_write_cb cb);
+UV_EXTERN int uv_write(uv_write_t* req, uv_stream_t* handle,
+ uv_buf_t bufs[], int bufcnt, uv_write_cb cb);
+
+UV_EXTERN int uv_write2(uv_write_t* req, uv_stream_t* handle, uv_buf_t bufs[],
+ int bufcnt, uv_stream_t* send_handle, uv_write_cb cb);
/* uv_write_t is a subclass of uv_req_t */
struct uv_write_s {
UV_REQ_FIELDS
uv_write_cb cb;
+ uv_stream_t* send_handle;
uv_stream_t* handle;
UV_WRITE_PRIVATE_FIELDS
};
@@ -413,12 +469,34 @@ struct uv_tcp_s {
UV_TCP_PRIVATE_FIELDS
};
-int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle);
+UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle);
+
+/* Enable/disable Nagle's algorithm. */
+UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable);
+
+/* Enable/disable TCP keep-alive.
+ *
+ * `ms` is the initial delay in seconds, ignored when `enable` is zero.
+ */
+UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle, int enable,
+ unsigned int delay);
+
+/*
+ * This setting applies to Windows only.
+ * Enable/disable simultaneous asynchronous accept requests that are
+ * queued by the operating system when listening for new tcp connections.
+ * This setting is used to tune a tcp server for the desired performance.
+ * Having simultaneous accepts can significantly improve the rate of
+ * accepting connections (which is why it is enabled by default).
+ */
+UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable);
-int uv_tcp_bind(uv_tcp_t* handle, struct sockaddr_in);
-int uv_tcp_bind6(uv_tcp_t* handle, struct sockaddr_in6);
-int uv_tcp_getsockname(uv_tcp_t* handle, struct sockaddr* name, int* namelen);
-int uv_tcp_getpeername(uv_tcp_t* handle, struct sockaddr* name, int* namelen);
+UV_EXTERN int uv_tcp_bind(uv_tcp_t* handle, struct sockaddr_in);
+UV_EXTERN int uv_tcp_bind6(uv_tcp_t* handle, struct sockaddr_in6);
+UV_EXTERN int uv_tcp_getsockname(uv_tcp_t* handle, struct sockaddr* name,
+ int* namelen);
+UV_EXTERN int uv_tcp_getpeername(uv_tcp_t* handle, struct sockaddr* name,
+ int* namelen);
/*
* uv_tcp_connect, uv_tcp_connect6
@@ -426,9 +504,9 @@ int uv_tcp_getpeername(uv_tcp_t* handle, struct sockaddr* name, int* namelen);
* initialized TCP handle and an uninitialized uv_connect_t*. The callback
* will be made when the connection is estabished.
*/
-int uv_tcp_connect(uv_connect_t* req, uv_tcp_t* handle,
+UV_EXTERN int uv_tcp_connect(uv_connect_t* req, uv_tcp_t* handle,
struct sockaddr_in address, uv_connect_cb cb);
-int uv_tcp_connect6(uv_connect_t* req, uv_tcp_t* handle,
+UV_EXTERN int uv_tcp_connect6(uv_connect_t* req, uv_tcp_t* handle,
struct sockaddr_in6 address, uv_connect_cb cb);
/* uv_connect_t is a subclass of uv_req_t */
@@ -495,7 +573,7 @@ struct uv_udp_send_s {
* Initialize a new UDP handle. The actual socket is created lazily.
* Returns 0 on success.
*/
-int uv_udp_init(uv_loop_t*, uv_udp_t* handle);
+UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle);
/*
* Bind to a IPv4 address and port.
@@ -508,7 +586,8 @@ int uv_udp_init(uv_loop_t*, uv_udp_t* handle);
* Returns:
* 0 on success, -1 on error.
*/
-int uv_udp_bind(uv_udp_t* handle, struct sockaddr_in addr, unsigned flags);
+UV_EXTERN int uv_udp_bind(uv_udp_t* handle, struct sockaddr_in addr,
+ unsigned flags);
/*
* Bind to a IPv6 address and port.
@@ -521,8 +600,27 @@ int uv_udp_bind(uv_udp_t* handle, struct sockaddr_in addr, unsigned flags);
* Returns:
* 0 on success, -1 on error.
*/
-int uv_udp_bind6(uv_udp_t* handle, struct sockaddr_in6 addr, unsigned flags);
-int uv_udp_getsockname(uv_udp_t* handle, struct sockaddr* name, int* namelen);
+UV_EXTERN int uv_udp_bind6(uv_udp_t* handle, struct sockaddr_in6 addr,
+ unsigned flags);
+UV_EXTERN int uv_udp_getsockname(uv_udp_t* handle, struct sockaddr* name,
+ int* namelen);
+
+/*
+ * Set membership for a multicast address
+ *
+ * Arguments:
+ * handle UDP handle. Should have been initialized with
+ * `uv_udp_init`.
+ * multicast_addr multicast address to set membership for
+ * interface_addr interface address
+ * membership Should be UV_JOIN_GROUP or UV_LEAVE_GROUP
+ *
+ * Returns:
+ * 0 on success, -1 on error.
+ */
+UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle,
+ const char* multicast_addr, const char* interface_addr,
+ uv_membership membership);
/*
* Send data. If the socket has not previously been bound with `uv_udp_bind`
@@ -540,8 +638,9 @@ int uv_udp_getsockname(uv_udp_t* handle, struct sockaddr* name, int* namelen);
* Returns:
* 0 on success, -1 on error.
*/
-int uv_udp_send(uv_udp_send_t* req, uv_udp_t* handle, uv_buf_t bufs[],
- int bufcnt, struct sockaddr_in addr, uv_udp_send_cb send_cb);
+UV_EXTERN int uv_udp_send(uv_udp_send_t* req, uv_udp_t* handle,
+ uv_buf_t bufs[], int bufcnt, struct sockaddr_in addr,
+ uv_udp_send_cb send_cb);
/*
* Send data. If the socket has not previously been bound with `uv_udp_bind6`,
@@ -558,11 +657,12 @@ int uv_udp_send(uv_udp_send_t* req, uv_udp_t* handle, uv_buf_t bufs[],
* Returns:
* 0 on success, -1 on error.
*/
-int uv_udp_send6(uv_udp_send_t* req, uv_udp_t* handle, uv_buf_t bufs[],
- int bufcnt, struct sockaddr_in6 addr, uv_udp_send_cb send_cb);
+UV_EXTERN int uv_udp_send6(uv_udp_send_t* req, uv_udp_t* handle,
+ uv_buf_t bufs[], int bufcnt, struct sockaddr_in6 addr,
+ uv_udp_send_cb send_cb);
/*
- * Send data. If the socket has not previously been bound with `uv_udp_bind`
+ * Receive data. If the socket has not previously been bound with `uv_udp_bind`
* or `uv_udp_bind6`, it is bound to 0.0.0.0 (the "all interfaces" address)
* and a random port number.
*
@@ -574,7 +674,7 @@ int uv_udp_send6(uv_udp_send_t* req, uv_udp_t* handle, uv_buf_t bufs[],
* Returns:
* 0 on success, -1 on error.
*/
-int uv_udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb,
+UV_EXTERN int uv_udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb,
uv_udp_recv_cb recv_cb);
/*
@@ -586,7 +686,7 @@ int uv_udp_recv_start(uv_udp_t* handle, uv_alloc_cb alloc_cb,
* Returns:
* 0 on success, -1 on error.
*/
-int uv_udp_recv_stop(uv_udp_t* handle);
+UV_EXTERN int uv_udp_recv_stop(uv_udp_t* handle);
/*
@@ -600,13 +700,42 @@ struct uv_tty_s {
UV_TTY_PRIVATE_FIELDS
};
-int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd);
+/*
+ * Initialize a new TTY stream with the given file descriptor. Usually the
+ * file descriptor will be
+ * 0 = stdin
+ * 1 = stdout
+ * 2 = stderr
+ * The last argument, readable, specifies if you plan on calling
+ * uv_read_start with this stream. stdin is readable, stdout is not.
+ *
+ * TTY streams which are not readable have blocking writes.
+ */
+UV_EXTERN int uv_tty_init(uv_loop_t*, uv_tty_t*, uv_file fd, int readable);
/*
* Set mode. 0 for normal, 1 for raw.
*/
-int uv_tty_set_mode(uv_tty_t*, int mode);
+UV_EXTERN int uv_tty_set_mode(uv_tty_t*, int mode);
+/*
+ * To be called when the program exits. Resets TTY settings to default
+ * values for the next process to take over.
+ */
+UV_EXTERN void uv_tty_reset_mode();
+
+/*
+ * Gets the current Window size. On success zero is returned.
+ */
+UV_EXTERN int uv_tty_get_winsize(uv_tty_t*, int* width, int* height);
+
+/*
+ * Used to detect what type of stream should be used with a given file
+ * descriptor. Usually this will be used during initialization to guess the
+ * type of the stdio streams.
+ * For isatty() functionality use this function and test for UV_TTY.
+ */
+UV_EXTERN uv_handle_type uv_guess_handle(uv_file file);
/*
* uv_pipe_t is a subclass of uv_stream_t
@@ -618,18 +747,23 @@ struct uv_pipe_s {
UV_HANDLE_FIELDS
UV_STREAM_FIELDS
UV_PIPE_PRIVATE_FIELDS
+ int ipc; /* non-zero if this pipe is used for passing handles */
};
-int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle);
+/*
+ * Initialize a pipe. The last argument is a boolean to indicate if
+ * this pipe will be used for handle passing between processes.
+ */
+UV_EXTERN int uv_pipe_init(uv_loop_t*, uv_pipe_t* handle, int ipc);
/*
* Opens an existing file descriptor or HANDLE as a pipe.
*/
-void uv_pipe_open(uv_pipe_t*, uv_file file);
+UV_EXTERN void uv_pipe_open(uv_pipe_t*, uv_file file);
-int uv_pipe_bind(uv_pipe_t* handle, const char* name);
+UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name);
-int uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
+UV_EXTERN void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
const char* name, uv_connect_cb cb);
@@ -645,11 +779,11 @@ struct uv_prepare_s {
UV_PREPARE_PRIVATE_FIELDS
};
-int uv_prepare_init(uv_loop_t*, uv_prepare_t* prepare);
+UV_EXTERN int uv_prepare_init(uv_loop_t*, uv_prepare_t* prepare);
-int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb);
+UV_EXTERN int uv_prepare_start(uv_prepare_t* prepare, uv_prepare_cb cb);
-int uv_prepare_stop(uv_prepare_t* prepare);
+UV_EXTERN int uv_prepare_stop(uv_prepare_t* prepare);
/*
@@ -663,11 +797,11 @@ struct uv_check_s {
UV_CHECK_PRIVATE_FIELDS
};
-int uv_check_init(uv_loop_t*, uv_check_t* check);
+UV_EXTERN int uv_check_init(uv_loop_t*, uv_check_t* check);
-int uv_check_start(uv_check_t* check, uv_check_cb cb);
+UV_EXTERN int uv_check_start(uv_check_t* check, uv_check_cb cb);
-int uv_check_stop(uv_check_t* check);
+UV_EXTERN int uv_check_stop(uv_check_t* check);
/*
@@ -683,11 +817,11 @@ struct uv_idle_s {
UV_IDLE_PRIVATE_FIELDS
};
-int uv_idle_init(uv_loop_t*, uv_idle_t* idle);
+UV_EXTERN int uv_idle_init(uv_loop_t*, uv_idle_t* idle);
-int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb);
+UV_EXTERN int uv_idle_start(uv_idle_t* idle, uv_idle_cb cb);
-int uv_idle_stop(uv_idle_t* idle);
+UV_EXTERN int uv_idle_stop(uv_idle_t* idle);
/*
@@ -705,14 +839,15 @@ struct uv_async_s {
UV_ASYNC_PRIVATE_FIELDS
};
-int uv_async_init(uv_loop_t*, uv_async_t* async, uv_async_cb async_cb);
+UV_EXTERN int uv_async_init(uv_loop_t*, uv_async_t* async,
+ uv_async_cb async_cb);
/*
* This can be called from other threads to wake up a libuv thread.
*
* libuv is single threaded at the moment.
*/
-int uv_async_send(uv_async_t* async);
+UV_EXTERN int uv_async_send(uv_async_t* async);
/*
@@ -726,19 +861,19 @@ struct uv_timer_s {
UV_TIMER_PRIVATE_FIELDS
};
-int uv_timer_init(uv_loop_t*, uv_timer_t* timer);
+UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* timer);
-int uv_timer_start(uv_timer_t* timer, uv_timer_cb cb, int64_t timeout,
- int64_t repeat);
+UV_EXTERN int uv_timer_start(uv_timer_t* timer, uv_timer_cb cb,
+ int64_t timeout, int64_t repeat);
-int uv_timer_stop(uv_timer_t* timer);
+UV_EXTERN int uv_timer_stop(uv_timer_t* timer);
/*
* Stop the timer, and if it is repeating restart it using the repeat value
* as the timeout. If the timer has never been started before it returns -1 and
* sets the error to UV_EINVAL.
*/
-int uv_timer_again(uv_timer_t* timer);
+UV_EXTERN int uv_timer_again(uv_timer_t* timer);
/*
* Set the repeat value. Note that if the repeat value is set from a timer
@@ -746,19 +881,17 @@ int uv_timer_again(uv_timer_t* timer);
* before, it will have been stopped. If it was repeating, then the old repeat
* value will have been used to schedule the next timeout.
*/
-void uv_timer_set_repeat(uv_timer_t* timer, int64_t repeat);
+UV_EXTERN void uv_timer_set_repeat(uv_timer_t* timer, int64_t repeat);
-int64_t uv_timer_get_repeat(uv_timer_t* timer);
+UV_EXTERN int64_t uv_timer_get_repeat(uv_timer_t* timer);
/* c-ares integration initialize and terminate */
-int uv_ares_init_options(uv_loop_t*,
- ares_channel *channelptr,
- struct ares_options *options,
- int optmask);
+UV_EXTERN int uv_ares_init_options(uv_loop_t*,
+ ares_channel *channelptr, struct ares_options *options, int optmask);
/* TODO remove the loop argument from this function? */
-void uv_ares_destroy(uv_loop_t*, ares_channel channel);
+UV_EXTERN void uv_ares_destroy(uv_loop_t*, ares_channel channel);
/*
@@ -779,15 +912,18 @@ struct uv_getaddrinfo_s {
*
* Return code 0 means that request is accepted and callback will be called
* with result. Other return codes mean that there will not be a callback.
- * Input arguments may be released after return from this call. Callback
- * must not call freeaddrinfo.
+ * Input arguments may be released after return from this call.
+ *
+ * uv_freeaddrinfo() must be called after completion to free the addrinfo
+ * structure.
+ *
+ * On error NXDOMAIN the status code will be non-zero and UV_ENOENT returned.
*/
- int uv_getaddrinfo(uv_loop_t*,
- uv_getaddrinfo_t* handle,
- uv_getaddrinfo_cb getaddrinfo_cb,
- const char* node,
- const char* service,
- const struct addrinfo* hints);
+UV_EXTERN int uv_getaddrinfo(uv_loop_t*, uv_getaddrinfo_t* handle,
+ uv_getaddrinfo_cb getaddrinfo_cb, const char* node, const char* service,
+ const struct addrinfo* hints);
+
+UV_EXTERN void uv_freeaddrinfo(struct addrinfo* ai);
/* uv_spawn() options */
typedef struct uv_process_options_s {
@@ -837,13 +973,18 @@ struct uv_process_s {
};
/* Initializes uv_process_t and starts the process. */
-int uv_spawn(uv_loop_t*, uv_process_t*, uv_process_options_t options);
+UV_EXTERN int uv_spawn(uv_loop_t*, uv_process_t*,
+ uv_process_options_t options);
/*
* Kills the process with the specified signal. The user must still
* call uv_close on the process.
*/
-int uv_process_kill(uv_process_t*, int signum);
+UV_EXTERN int uv_process_kill(uv_process_t*, int signum);
+
+
+/* Kills the process with the specified signal. */
+UV_EXTERN uv_err_t uv_kill(int pid, int signum);
/*
@@ -858,8 +999,8 @@ struct uv_work_s {
};
/* Queues a work request to execute asynchronously on the thread pool. */
-int uv_queue_work(uv_loop_t* loop, uv_work_t* req, uv_work_cb work_cb,
- uv_after_work_cb after_work_cb);
+UV_EXTERN int uv_queue_work(uv_loop_t* loop, uv_work_t* req,
+ uv_work_cb work_cb, uv_after_work_cb after_work_cb);
@@ -921,94 +1062,154 @@ struct uv_fs_s {
UV_FS_PRIVATE_FIELDS
};
-void uv_fs_req_cleanup(uv_fs_t* req);
+UV_EXTERN void uv_fs_req_cleanup(uv_fs_t* req);
+
+UV_EXTERN int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ uv_fs_cb cb);
-int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb);
+UV_EXTERN int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path,
+ int flags, int mode, uv_fs_cb cb);
-int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
- int mode, uv_fs_cb cb);
+UV_EXTERN int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ void* buf, size_t length, off_t offset, uv_fs_cb cb);
-int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
- size_t length, off_t offset, uv_fs_cb cb);
+UV_EXTERN int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
+ uv_fs_cb cb);
-int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb);
+UV_EXTERN int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ void* buf, size_t length, off_t offset, uv_fs_cb cb);
-int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
- size_t length, off_t offset, uv_fs_cb cb);
+UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path,
+ int mode, uv_fs_cb cb);
-int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
+UV_EXTERN int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path,
uv_fs_cb cb);
-int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb);
+UV_EXTERN int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req,
+ const char* path, int flags, uv_fs_cb cb);
-int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
+UV_EXTERN int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path,
uv_fs_cb cb);
-int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb);
-
-int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb);
+UV_EXTERN int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ uv_fs_cb cb);
-int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path,
+UV_EXTERN int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path,
const char* new_path, uv_fs_cb cb);
-int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb);
+UV_EXTERN int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ uv_fs_cb cb);
-int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb);
+UV_EXTERN int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ uv_fs_cb cb);
-int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+UV_EXTERN int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file,
off_t offset, uv_fs_cb cb);
-int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd,
+UV_EXTERN int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd,
uv_file in_fd, off_t in_offset, size_t length, uv_fs_cb cb);
-int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
- uv_fs_cb cb);
+UV_EXTERN int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path,
+ int mode, uv_fs_cb cb);
-int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime,
- double mtime, uv_fs_cb cb);
+UV_EXTERN int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path,
+ double atime, double mtime, uv_fs_cb cb);
-int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file file, double atime,
- double mtime, uv_fs_cb cb);
+UV_EXTERN int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ double atime, double mtime, uv_fs_cb cb);
-int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb);
+UV_EXTERN int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path,
+ uv_fs_cb cb);
-int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path,
+UV_EXTERN int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path,
const char* new_path, uv_fs_cb cb);
-/*
+/*
* This flag can be used with uv_fs_symlink on Windows
* to specify whether path argument points to a directory.
*/
#define UV_FS_SYMLINK_DIR 0x0001
-int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
+UV_EXTERN int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
const char* new_path, int flags, uv_fs_cb cb);
-int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
+UV_EXTERN int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
uv_fs_cb cb);
-int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file file, int mode,
- uv_fs_cb cb);
+UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ int mode, uv_fs_cb cb);
+
+UV_EXTERN int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path,
+ int uid, int gid, uv_fs_cb cb);
+
+UV_EXTERN int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file file,
+ int uid, int gid, uv_fs_cb cb);
+
+
+enum uv_fs_event {
+ UV_RENAME = 1,
+ UV_CHANGE = 2
+};
+
+
+struct uv_fs_event_s {
+ UV_HANDLE_FIELDS
+ char* filename;
+ UV_FS_EVENT_PRIVATE_FIELDS
+};
+
+
+/*
+ * Gets load avg
+ * See: http://en.wikipedia.org/wiki/Load_(computing)
+ * (Returns [0,0,0] for windows and cygwin)
+ */
+UV_EXTERN void uv_loadavg(double avg[3]);
+
-int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, int uid,
- int gid, uv_fs_cb cb);
+/*
+ * Flags to be passed to uv_fs_event_init.
+ */
+enum uv_fs_event_flags {
+ /*
+ * By default, if the fs event watcher is given a directory name, we will
+ * watch for all events in that directory. This flags overrides this behavior
+ * and makes fs_event report only changes to the directory entry itself. This
+ * flag does not affect individual files watched.
+ * This flag is currently not implemented yet on any backend.
+ */
+ UV_FS_EVENT_WATCH_ENTRY = 1,
+
+ /*
+ * By default uv_fs_event will try to use a kernel interface such as inotify
+ * or kqueue to detect events. This may not work on remote filesystems such
+ * as NFS mounts. This flag makes fs_event fall back to calling stat() on a
+ * regular interval.
+ * This flag is currently not implemented yet on any backend.
+ */
+ UV_FS_EVENT_STAT = 2
+};
-int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file file, int uid,
- int gid, uv_fs_cb cb);
+UV_EXTERN int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle,
+ const char* filename, uv_fs_event_cb cb, int flags);
/* Utility */
/* Convert string ip addresses to binary structures */
-struct sockaddr_in uv_ip4_addr(const char* ip, int port);
-struct sockaddr_in6 uv_ip6_addr(const char* ip, int port);
+UV_EXTERN struct sockaddr_in uv_ip4_addr(const char* ip, int port);
+UV_EXTERN struct sockaddr_in6 uv_ip6_addr(const char* ip, int port);
/* Convert binary addresses to strings */
-int uv_ip4_name(struct sockaddr_in* src, char* dst, size_t size);
-int uv_ip6_name(struct sockaddr_in6* src, char* dst, size_t size);
+UV_EXTERN int uv_ip4_name(struct sockaddr_in* src, char* dst, size_t size);
+UV_EXTERN int uv_ip6_name(struct sockaddr_in6* src, char* dst, size_t size);
/* Gets the executable path */
-int uv_exepath(char* buffer, size_t* size);
+UV_EXTERN int uv_exepath(char* buffer, size_t* size);
+
+/* Gets memory info in bytes */
+UV_EXTERN uint64_t uv_get_free_memory(void);
+UV_EXTERN uint64_t uv_get_total_memory(void);
/*
* Returns the current high-resolution real time. This is expressed in
@@ -1019,7 +1220,20 @@ int uv_exepath(char* buffer, size_t* size);
* Note not every platform can support nanosecond resolution; however, this
* value will always be in nanoseconds.
*/
-extern uint64_t uv_hrtime(void);
+UV_EXTERN extern uint64_t uv_hrtime(void);
+
+
+/*
+ * Opens a shared library. The filename is in utf-8. On success, -1 is
+ * and the variable pointed by library receives a handle to the library.
+ */
+UV_EXTERN uv_err_t uv_dlopen(const char* filename, uv_lib_t* library);
+UV_EXTERN uv_err_t uv_dlclose(uv_lib_t library);
+
+/*
+ * Retrieves a data pointer from a dynamic library.
+ */
+UV_EXTERN uv_err_t uv_dlsym(uv_lib_t library, const char* name, void** ptr);
/* the presence of these unions force similar struct layout */
@@ -1032,6 +1246,7 @@ union uv_any_handle {
uv_async_t async;
uv_timer_t timer;
uv_getaddrinfo_t getaddrinfo;
+ uv_fs_event_t fs_event;
};
union uv_any_req {
@@ -1059,6 +1274,7 @@ struct uv_counters_s {
uint64_t async_init;
uint64_t timer_init;
uint64_t process_init;
+ uint64_t fs_event_init;
};
@@ -1092,6 +1308,7 @@ struct uv_loop_s {
#undef UV_GETADDRINFO_PRIVATE_FIELDS
#undef UV_FS_REQ_PRIVATE_FIELDS
#undef UV_WORK_PRIVATE_FIELDS
+#undef UV_FS_EVENT_PRIVATE_FIELDS
#ifdef __cplusplus
}
View
20 deps/libuv/src/ares/CHANGES
@@ -1,5 +1,25 @@
Changelog for the c-ares project
+Version 1.7.5 (August 16, 2011)
+
+Fixed:
+
+ o detection of semicolon comments in resolv.conf
+ o avoid using system's inet_net_pton affected by the WLB-2008080064 advisory
+ o replacement ares_inet_net_pton affected by the WLB-2008080064 advisory
+ o replacement ares_inet_ntop affected by potential out of bounds write
+ o added install target to Makefile.msvc
+ o only fall back to AF_INET searches when looking for AF_UNSPEC addresses
+ o fixed ares_parse_*_reply memory leaks
+ o Use correct sizeof in ares_getnameinfo()
+ o IPv6-on-windows: find DNS servers correctly
+ o man pages: docs for the c-ares utility programs
+ o getservbyport replacement for Win CE
+ o config_sortlist: (win32) missing else
+ o advance_tcp_send_queue: avoid NULL ptr dereference
+ o configure: fix a bashism
+ o ares_expand_name: Fix encoded length for indirect root
+
Version 1.7.4 (December 9, 2010)
Changed:
View
24 deps/libuv/src/ares/README.msvc
@@ -40,6 +40,30 @@
library version it is using.
+ How to install using MSVC from the command line
+ -----------------------------------------------
+
+ In order to allow easy usage of c-ares libraries it may be convenient to
+ install c-ares libraries and header files to a common subdirectory tree.
+
+ Once that c-ares libraries have been built using procedure described above,
+ use same command prompt window to define environment variable INSTALL_DIR
+ to designate the top subdirectory where installation of c-ares libraries and
+ header files will be done.
+
+ > set INSTALL_DIR=c:\c-ares
+
+ Afterwards, run following command to actually perform the installation:
+
+ > nmake -f Makefile.msvc install
+
+ Installation procedure will copy c-ares libraries to subdirectory 'lib' and
+ c-ares header files to subdirectory 'include' below the INSTALL_DIR subdir.
+
+ When environment variable INSTALL_DIR is not defined, installation is done
+ to c-ares source folder where Makefile.msvc file is located.
+
+
How to build using Visual Studio 6 IDE
--------------------------------------
View
35 deps/libuv/src/ares/RELEASE-NOTES
@@ -1,25 +1,26 @@
-c-ares version 1.7.4
-
-Changed:
-
- o local-bind: Support binding to local interface/IPs, see
- ares_set_local_ip4, ares_set_local_ip6, ares_set_local_dev
+c-ares version 1.7.5
Fixed:
- o memory leak in ares_getnameinfo
- o add missing break that caused get_ares_servers to fail
- o ares_parse_a_reply: fix CNAME response parsing
- o init_by_options: don't copy an empty sortlist
- o Replaced uint32_t with unsigned int to fix broken builds
- on a couple of platforms
- o Fix lookup with HOSTALIASES set
- o adig: fix NAPTR parsing
- o compiler warning cleanups
+ o detection of semicolon comments in resolv.conf
+ o avoid using system's inet_net_pton affected by the WLB-2008080064 advisory
+ o replacement ares_inet_net_pton affected by the WLB-2008080064 advisory
+ o replacement ares_inet_ntop affected by potential out of bounds write
+ o added install target to Makefile.msvc
+ o only fall back to AF_INET searches when looking for AF_UNSPEC addresses
+ o fixed ares_parse_*_reply memory leaks
+ o Use correct sizeof in ares_getnameinfo()
+ o IPv6-on-windows: find DNS servers correctly
+ o man pages: docs for the c-ares utility programs
+ o getservbyport replacement for Win CE
+ o config_sortlist: (win32) missing else
+ o advance_tcp_send_queue: avoid NULL ptr dereference
+ o configure: fix a bashism
+ o ares_expand_name: Fix encoded length for indirect root
Thanks go to these friendly people for their efforts and contributions:
- Andrew C. Morrow, Ben Greear, Ben Noordhuis, Daniel Stenberg,
- Guenter Knauf, Mike Crowe, Patrik Thunstrom, Yang Tse
+ Yang Tse, Jakub Hrozek, Gisle Vanem, Tom Hughes, David Stuart, Dima Tisnek,
+ Peter Pentchev, Stefan Buhler
Have fun!
View
9 deps/libuv/src/ares/ares_expand_name.c
@@ -87,7 +87,14 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
* Since this function strips trailing dots though, it becomes ""
*/
q[0] = '\0';
- *enclen = 1; /* the caller should move one byte to get past this */
+
+ /* indirect root label (like 0xc0 0x0c) is 2 bytes long (stupid, but
+ valid) */
+ if ((*encoded & INDIR_MASK) == INDIR_MASK)
+ *enclen = 2;
+ else
+ *enclen = 1; /* the caller should move one byte to get past this */
+
return ARES_SUCCESS;
}
View
1  deps/libuv/src/ares/ares_fds.c
@@ -21,6 +21,7 @@
#endif
#include "ares.h"
+#include "ares_nowarn.h"
#include "ares_private.h"
int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
View
3  deps/libuv/src/ares/ares_free_hostent.c
@@ -28,6 +28,9 @@ void ares_free_hostent(struct hostent *host)
{
char **p;
+ if (!host)
+ return;
+
free((char *)(host->h_name));
for (p = host->h_aliases; *p; p++)
free(*p);
View
30 deps/libuv/src/ares/ares_getenv.c
@@ -0,0 +1,30 @@
+
+
+/* Copyright 1998 by the Massachusetts Institute of Technology.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ */
+
+#include "ares_setup.h"
+#include "ares_getenv.h"
+
+#ifndef HAVE_GETENV
+
+char *ares_getenv(const char *name)
+{
+#ifdef _WIN32_WCE
+ return NULL;
+#endif
+}
+
+#endif
View
26 deps/libuv/src/ares/ares_getenv.h
@@ -0,0 +1,26 @@
+#ifndef HEADER_CARES_GETENV_H
+#define HEADER_CARES_GETENV_H
+
+
+/* Copyright 1998 by the Massachusetts Institute of Technology.
+ *
+ * Permission to use, copy, modify, and distribute this
+ * software and its documentation for any purpose and without
+ * fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting
+ * documentation, and that the name of M.I.T. not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ */
+
+#include "ares_setup.h"
+
+#ifndef HAVE_GETENV
+extern char *ares_getenv(const char *name);
+#endif
+
+#endif /* HEADER_CARES_GETENV_H */
View
13 deps/libuv/src/ares/ares_gethostbyaddr.c
@@ -42,6 +42,7 @@
#include "ares.h"
#include "inet_net_pton.h"
+#include "ares_platform.h"
#include "ares_private.h"
#ifdef WATT32
@@ -186,7 +187,13 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host)
#ifdef WIN32
char PATH_HOSTS[MAX_PATH];
- if (IS_NT()) {
+ win_platform platform;
+
+ PATH_HOSTS[0] = '\0';
+
+ platform = ares__getplatform();
+
+ if (platform == WIN_NT) {
char tmp[MAX_PATH];
HKEY hkeyHosts;
@@ -200,8 +207,10 @@ static int file_lookup(struct ares_addr *addr, struct hostent **host)
RegCloseKey(hkeyHosts);
}
}