Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

update libuv

  • Loading branch information...
commit ab7eec1b4986564f3824dad9cb83f43afae7f5e9 1 parent 90ea681
Shigeki Ohtsu authored

Showing 66 changed files with 1,900 additions and 1,353 deletions. Show diff stats Hide diff stats

  1. +0 20 deps/uv/build/gcc_version.py
  2. +3 4 deps/uv/common.gypi
  3. +1 0  deps/uv/config-unix.mk
  4. +16 7 deps/uv/gyp_uv
  5. +1 1  deps/uv/include/uv-private/eio.h
  6. +1 1  deps/uv/include/uv-private/ngx-queue.h
  7. +98 87 deps/uv/include/uv-private/uv-unix.h
  8. +223 222 deps/uv/include/uv-private/uv-win.h
  9. +128 99 deps/uv/include/uv.h
  10. +0 2  deps/uv/src/fs-poll.c
  11. +0 2  deps/uv/src/unix/async.c
  12. +5 0 deps/uv/src/unix/core.c
  13. +0 1  deps/uv/src/unix/cygwin.c
  14. +41 1 deps/uv/src/unix/fs.c
  15. +10 2 deps/uv/src/unix/internal.h
  16. +0 2  deps/uv/src/unix/kqueue.c
  17. +0 2  deps/uv/src/unix/linux/inotify.c
  18. +155 72 deps/uv/src/unix/linux/linux-core.c
  19. +0 1  deps/uv/src/unix/loop-watcher.c
  20. +19 3 deps/uv/src/unix/loop.c
  21. +0 1  deps/uv/src/unix/pipe.c
  22. +0 2  deps/uv/src/unix/poll.c
  23. +172 124 deps/uv/src/unix/process.c
  24. +269 0 deps/uv/src/unix/signal.c
  25. +0 3  deps/uv/src/unix/stream.c
  26. +0 3  deps/uv/src/unix/sunos.c
  27. +0 1  deps/uv/src/unix/tcp.c
  28. +6 4 deps/uv/src/unix/timer.c
  29. +0 1  deps/uv/src/unix/tty.c
  30. +0 2  deps/uv/src/unix/udp.c
  31. +2 2 deps/uv/src/unix/uv-eio.c
  32. +0 1  deps/uv/src/uv-common.h
  33. +2 32 deps/uv/src/win/async.c
  34. +56 0 deps/uv/src/win/atomicops-inl.h
  35. +0 2  deps/uv/src/win/core.c
  36. +1 1  deps/uv/src/win/dl.c
  37. +2 2 deps/uv/src/win/error.c
  38. +17 19 deps/uv/src/win/fs-event.c
  39. +11 11 deps/uv/src/win/getaddrinfo.c
  40. +4 0 deps/uv/src/win/handle-inl.h
  41. +4 0 deps/uv/src/win/handle.c
  42. +9 3 deps/uv/src/win/internal.h
  43. +0 1  deps/uv/src/win/loop-watcher.c
  44. +16 19 deps/uv/src/win/pipe.c
  45. +0 2  deps/uv/src/win/poll.c
  46. +49 35 deps/uv/src/win/process-stdio.c
  47. +242 242 deps/uv/src/win/process.c
  48. +0 5 deps/uv/src/win/req-inl.h
  49. +57 0 deps/uv/src/win/signal.c
  50. +0 2  deps/uv/src/win/stream-inl.h
  51. +0 2  deps/uv/src/win/tcp.c
  52. +13 37 deps/uv/src/win/timer.c
  53. +0 2  deps/uv/src/win/tty.c
  54. +0 2  deps/uv/src/win/udp.c
  55. +6 6 deps/uv/src/win/util.c
  56. +1 1  deps/uv/test/benchmark-fs-stat.c
  57. +4 4 deps/uv/test/runner-win.c
  58. +1 1  deps/uv/test/runner.c
  59. +0 215 deps/uv/test/test-counters-init.c
  60. +0 9 deps/uv/test/test-delayed-accept.c
  61. +10 2 deps/uv/test/test-list.h
  62. +162 0 deps/uv/test/test-signal.c
  63. +35 21 deps/uv/test/test-spawn.c
  64. +1 1  deps/uv/test/test-tcp-unexpected-read.c
  65. +42 0 deps/uv/test/test-timer.c
  66. +5 1 deps/uv/uv.gyp
20 deps/uv/build/gcc_version.py
... ... @@ -1,20 +0,0 @@
1   -#!/usr/bin/env python
2   -
3   -import os
4   -import re
5   -import subprocess
6   -import sys
7   -
8   -
9   -def DoMain(*args):
10   - cc = os.environ.get('CC', 'gcc')
11   - stdin, stderr = os.pipe()
12   - subprocess.call([cc, '-v'], stderr=stderr)
13   - output = os.read(stdin, 4096)
14   - match = re.search("\ngcc version (\d+\.\d+\.\d+)", output)
15   - if match:
16   - print(match.group(1))
17   -
18   -
19   -if __name__ == '__main__':
20   - DoMain(*sys.argv)
7 deps/uv/common.gypi
@@ -6,6 +6,8 @@
6 6 'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
7 7 'component%': 'static_library', # NB. these names match with what V8 expects
8 8 'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
  9 + 'gcc_version%': 'unknown',
  10 + 'clang%': 0,
9 11 },
10 12
11 13 'target_defaults': {
@@ -117,9 +119,6 @@
117 119 ],
118 120 }],
119 121 [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
120   - 'variables': {
121   - 'gcc_version%': '<!(python build/gcc_version.py)>)',
122   - },
123 122 'cflags': [ '-Wall' ],
124 123 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
125 124 'conditions': [
@@ -137,7 +136,7 @@
137 136 'cflags': [ '-pthread' ],
138 137 'ldflags': [ '-pthread' ],
139 138 }],
140   - [ 'visibility=="hidden" and gcc_version >= "4.0.0"', {
  139 + [ 'visibility=="hidden" and (clang==1 or gcc_version >= 40)', {
141 140 'cflags': [ '-fvisibility=hidden' ],
142 141 }],
143 142 ],
1  deps/uv/config-unix.mk
@@ -37,6 +37,7 @@ OBJS += src/unix/loop-watcher.o
37 37 OBJS += src/unix/pipe.o
38 38 OBJS += src/unix/poll.o
39 39 OBJS += src/unix/process.o
  40 +OBJS += src/unix/signal.o
40 41 OBJS += src/unix/stream.o
41 42 OBJS += src/unix/tcp.o
42 43 OBJS += src/unix/thread.o
23 deps/uv/gyp_uv
... ... @@ -1,11 +1,14 @@
1 1 #!/usr/bin/env python
  2 +
2 3 import glob
3 4 import os
4   -import shlex
  5 +import subprocess
5 6 import sys
6 7
  8 +CC = os.environ.get('CC', 'cc')
7 9 script_dir = os.path.dirname(__file__)
8 10 uv_root = os.path.normpath(script_dir)
  11 +output_dir = os.path.join(os.path.abspath(uv_root), 'out')
9 12
10 13 sys.path.insert(0, os.path.join(uv_root, 'build', 'gyp', 'pylib'))
11 14 try:
@@ -14,9 +17,14 @@ except ImportError:
14 17 print('You need to install gyp in build/gyp first. See the README.')
15 18 sys.exit(42)
16 19
17   -# Directory within which we want all generated files (including Makefiles)
18   -# to be written.
19   -output_dir = os.path.join(os.path.abspath(uv_root), 'out')
  20 +
  21 +def compiler_version():
  22 + proc = subprocess.Popen(CC.split() + ['--version'], stdout=subprocess.PIPE)
  23 + is_clang = 'clang' in proc.communicate()[0].split('\n')[0]
  24 + proc = subprocess.Popen(CC.split() + ['-dumpversion'], stdout=subprocess.PIPE)
  25 + version = tuple(map(int, proc.communicate()[0].split('.')))
  26 + return (version, is_clang)
  27 +
20 28
21 29 def run_gyp(args):
22 30 rc = gyp.main(args)
@@ -24,6 +32,7 @@ def run_gyp(args):
24 32 print 'Error running GYP'
25 33 sys.exit(rc)
26 34
  35 +
27 36 if __name__ == '__main__':
28 37 args = sys.argv[1:]
29 38
@@ -49,12 +58,12 @@ if __name__ == '__main__':
49 58
50 59 # There's a bug with windows which doesn't allow this feature.
51 60 if sys.platform != 'win32':
52   - # Tell gyp to write the Makefiles into output_dir
53 61 args.extend(['--generator-output', output_dir])
54   - # Tell make to write its output into the same dir
55 62 args.extend(['-Goutput_dir=' + output_dir])
56   - # Create Makefiles, not XCode projects
57 63 args.extend('-f make'.split())
  64 + (major, minor), is_clang = compiler_version()
  65 + args.append('-Dgcc_version=%d' % (10 * major + minor))
  66 + args.append('-Dclang=%d' % int(is_clang))
58 67
59 68 args.append('-Dtarget_arch=ia32')
60 69 args.append('-Dcomponent=static_library')
2  deps/uv/include/uv-private/eio.h
@@ -251,7 +251,7 @@ struct eio_req
251 251
252 252 eio_channel *channel; /* data used to direct poll callbacks arising from this req */
253 253
254   -#if __i386 || __amd64
  254 +#if defined(__i386) || defined(__amd64)
255 255 unsigned char cancelled;
256 256 #else
257 257 sig_atomic_t cancelled;
2  deps/uv/include/uv-private/ngx-queue.h
@@ -62,7 +62,7 @@ struct ngx_queue_s {
62 62 (q)->prev
63 63
64 64
65   -#if (NGX_DEBUG)
  65 +#if defined(NGX_DEBUG)
66 66
67 67 #define ngx_queue_remove(x) \
68 68 (x)->next->prev = (x)->prev; \
185 deps/uv/include/uv-private/uv-unix.h
@@ -51,7 +51,7 @@
51 51 # include <semaphore.h>
52 52 #endif
53 53
54   -#if __sun
  54 +#if defined(__sun)
55 55 # include <sys/port.h>
56 56 # include <port.h>
57 57 #endif
@@ -103,20 +103,21 @@ struct uv__io_s {
103 103
104 104 #define UV_REQ_TYPE_PRIVATE /* empty */
105 105
106   -#if __linux__
107   -# define UV_LOOP_PRIVATE_PLATFORM_FIELDS \
108   - uv__io_t inotify_read_watcher; \
109   - void* inotify_watchers; \
  106 +#if defined(__linux__)
  107 +# define UV_LOOP_PRIVATE_PLATFORM_FIELDS \
  108 + uv__io_t inotify_read_watcher; \
  109 + void* inotify_watchers; \
110 110 int inotify_fd;
111 111 #elif defined(PORT_SOURCE_FILE)
112   -# define UV_LOOP_PRIVATE_PLATFORM_FIELDS \
113   - uv__io_t fs_event_watcher; \
  112 +# define UV_LOOP_PRIVATE_PLATFORM_FIELDS \
  113 + uv__io_t fs_event_watcher; \
114 114 int fs_fd;
115 115 #else
116 116 # define UV_LOOP_PRIVATE_PLATFORM_FIELDS
117 117 #endif
118 118
119 119 #define UV_LOOP_PRIVATE_FIELDS \
  120 + unsigned long flags; \
120 121 /* Poll result queue */ \
121 122 eio_channel uv_eio_channel; \
122 123 struct ev_loop* ev; \
@@ -125,6 +126,7 @@ struct uv__io_s {
125 126 uv_async_t uv_eio_done_poll_notifier; \
126 127 uv_idle_t uv_eio_poller; \
127 128 uv_handle_t* closing_handles; \
  129 + ngx_queue_t process_handles[1]; \
128 130 ngx_queue_t prepare_handles; \
129 131 ngx_queue_t check_handles; \
130 132 ngx_queue_t idle_handles; \
@@ -134,98 +136,100 @@ struct uv__io_s {
134 136 /* RB_HEAD(uv__timers, uv_timer_s) */ \
135 137 struct uv__timers { struct uv_timer_s* rbh_root; } timer_handles; \
136 138 uint64_t time; \
  139 + void* signal_ctx; \
  140 + uv_signal_t child_watcher; \
137 141 UV_LOOP_PRIVATE_PLATFORM_FIELDS
138 142
139 143 #define UV_REQ_BUFSML_SIZE (4)
140 144
141 145 #define UV_REQ_PRIVATE_FIELDS /* empty */
142 146
143   -#define UV_WRITE_PRIVATE_FIELDS \
144   - ngx_queue_t queue; \
145   - int write_index; \
146   - uv_buf_t* bufs; \
147   - int bufcnt; \
148   - int error; \
  147 +#define UV_WRITE_PRIVATE_FIELDS \
  148 + ngx_queue_t queue; \
  149 + int write_index; \
  150 + uv_buf_t* bufs; \
  151 + int bufcnt; \
  152 + int error; \
149 153 uv_buf_t bufsml[UV_REQ_BUFSML_SIZE];
150 154
151 155 #define UV_SHUTDOWN_PRIVATE_FIELDS /* empty */
152 156
153   -#define UV_CONNECT_PRIVATE_FIELDS \
  157 +#define UV_CONNECT_PRIVATE_FIELDS \
154 158 ngx_queue_t queue;
155 159
156   -#define UV_UDP_SEND_PRIVATE_FIELDS \
157   - ngx_queue_t queue; \
158   - struct sockaddr_in6 addr; \
159   - int bufcnt; \
160   - uv_buf_t* bufs; \
161   - ssize_t status; \
162   - uv_udp_send_cb send_cb; \
163   - uv_buf_t bufsml[UV_REQ_BUFSML_SIZE]; \
  160 +#define UV_UDP_SEND_PRIVATE_FIELDS \
  161 + ngx_queue_t queue; \
  162 + struct sockaddr_in6 addr; \
  163 + int bufcnt; \
  164 + uv_buf_t* bufs; \
  165 + ssize_t status; \
  166 + uv_udp_send_cb send_cb; \
  167 + uv_buf_t bufsml[UV_REQ_BUFSML_SIZE]; \
164 168
165 169 #define UV_PRIVATE_REQ_TYPES /* empty */
166 170
167 171
168 172 /* TODO: union or classes please! */
169   -#define UV_HANDLE_PRIVATE_FIELDS \
170   - int flags; \
171   - uv_handle_t* next_closing; \
  173 +#define UV_HANDLE_PRIVATE_FIELDS \
  174 + int flags; \
  175 + uv_handle_t* next_closing; \
172 176
173 177
174   -#define UV_STREAM_PRIVATE_FIELDS \
175   - uv_connect_t *connect_req; \
176   - uv_shutdown_t *shutdown_req; \
177   - uv__io_t read_watcher; \
178   - uv__io_t write_watcher; \
179   - ngx_queue_t write_queue; \
180   - ngx_queue_t write_completed_queue; \
181   - uv_connection_cb connection_cb; \
182   - int delayed_error; \
183   - int accepted_fd; \
184   - int fd; \
  178 +#define UV_STREAM_PRIVATE_FIELDS \
  179 + uv_connect_t *connect_req; \
  180 + uv_shutdown_t *shutdown_req; \
  181 + uv__io_t read_watcher; \
  182 + uv__io_t write_watcher; \
  183 + ngx_queue_t write_queue; \
  184 + ngx_queue_t write_completed_queue; \
  185 + uv_connection_cb connection_cb; \
  186 + int delayed_error; \
  187 + int accepted_fd; \
  188 + int fd; \
185 189
186 190
187 191 /* UV_TCP, idle_handle is for UV_TCP_SINGLE_ACCEPT handles */
188   -#define UV_TCP_PRIVATE_FIELDS \
189   - uv_idle_t* idle_handle; \
  192 +#define UV_TCP_PRIVATE_FIELDS \
  193 + uv_idle_t* idle_handle; \
190 194
191 195
192 196 /* UV_UDP */
193   -#define UV_UDP_PRIVATE_FIELDS \
194   - int fd; \
195   - uv_alloc_cb alloc_cb; \
196   - uv_udp_recv_cb recv_cb; \
197   - uv__io_t read_watcher; \
198   - uv__io_t write_watcher; \
199   - ngx_queue_t write_queue; \
200   - ngx_queue_t write_completed_queue; \
  197 +#define UV_UDP_PRIVATE_FIELDS \
  198 + int fd; \
  199 + uv_alloc_cb alloc_cb; \
  200 + uv_udp_recv_cb recv_cb; \
  201 + uv__io_t read_watcher; \
  202 + uv__io_t write_watcher; \
  203 + ngx_queue_t write_queue; \
  204 + ngx_queue_t write_completed_queue; \
201 205
202 206
203 207 /* UV_NAMED_PIPE */
204   -#define UV_PIPE_PRIVATE_FIELDS \
  208 +#define UV_PIPE_PRIVATE_FIELDS \
205 209 const char* pipe_fname; /* strdup'ed */
206 210
207 211
208 212 /* UV_POLL */
209   -#define UV_POLL_PRIVATE_FIELDS \
210   - int fd; \
  213 +#define UV_POLL_PRIVATE_FIELDS \
  214 + int fd; \
211 215 uv__io_t io_watcher;
212 216
213 217
214 218 /* UV_PREPARE */
215   -#define UV_PREPARE_PRIVATE_FIELDS \
216   - uv_prepare_cb prepare_cb; \
  219 +#define UV_PREPARE_PRIVATE_FIELDS \
  220 + uv_prepare_cb prepare_cb; \
217 221 ngx_queue_t queue;
218 222
219 223
220 224 /* UV_CHECK */
221   -#define UV_CHECK_PRIVATE_FIELDS \
222   - uv_check_cb check_cb; \
  225 +#define UV_CHECK_PRIVATE_FIELDS \
  226 + uv_check_cb check_cb; \
223 227 ngx_queue_t queue;
224 228
225 229
226 230 /* UV_IDLE */
227   -#define UV_IDLE_PRIVATE_FIELDS \
228   - uv_idle_cb idle_cb; \
  231 +#define UV_IDLE_PRIVATE_FIELDS \
  232 + uv_idle_cb idle_cb; \
229 233 ngx_queue_t queue;
230 234
231 235
@@ -247,58 +251,65 @@ struct uv__io_s {
247 251 } tree_entry; \
248 252 uv_timer_cb timer_cb; \
249 253 uint64_t timeout; \
  254 + uint64_t start_id; \
250 255 uint64_t repeat;
251 256
252   -#define UV_GETADDRINFO_PRIVATE_FIELDS \
253   - uv_getaddrinfo_cb cb; \
254   - struct addrinfo* hints; \
255   - char* hostname; \
256   - char* service; \
257   - struct addrinfo* res; \
  257 +#define UV_GETADDRINFO_PRIVATE_FIELDS \
  258 + uv_getaddrinfo_cb cb; \
  259 + struct addrinfo* hints; \
  260 + char* hostname; \
  261 + char* service; \
  262 + struct addrinfo* res; \
258 263 int retcode;
259 264
260   -#define UV_PROCESS_PRIVATE_FIELDS \
261   - ev_child child_watcher;
  265 +#define UV_PROCESS_PRIVATE_FIELDS \
  266 + ngx_queue_t queue; \
  267 + int errorno; \
262 268
263   -#define UV_FS_PRIVATE_FIELDS \
264   - struct stat statbuf; \
265   - eio_req* eio;
  269 +#define UV_FS_PRIVATE_FIELDS \
  270 + struct stat statbuf; \
  271 + uv_file file; \
  272 + eio_req* eio; \
266 273
267   -#define UV_WORK_PRIVATE_FIELDS \
  274 +#define UV_WORK_PRIVATE_FIELDS \
268 275 eio_req* eio;
269 276
270   -#define UV_TTY_PRIVATE_FIELDS \
271   - struct termios orig_termios; \
  277 +#define UV_TTY_PRIVATE_FIELDS \
  278 + struct termios orig_termios; \
272 279 int mode;
273 280
  281 +#define UV_SIGNAL_PRIVATE_FIELDS \
  282 + ngx_queue_t queue; \
  283 + unsigned int signum; \
  284 +
274 285 /* UV_FS_EVENT_PRIVATE_FIELDS */
275 286 #if defined(__linux__)
276 287
277   -#define UV_FS_EVENT_PRIVATE_FIELDS \
278   - ngx_queue_t watchers; \
279   - uv_fs_event_cb cb; \
280   - int wd; \
281   - void* pad0; \
282   - void* pad1; \
283   -
284   -#elif defined(__APPLE__) \
285   - || defined(__FreeBSD__) \
286   - || defined(__DragonFly__) \
287   - || defined(__OpenBSD__) \
  288 +#define UV_FS_EVENT_PRIVATE_FIELDS \
  289 + ngx_queue_t watchers; \
  290 + uv_fs_event_cb cb; \
  291 + int wd; \
  292 + void* pad0; \
  293 + void* pad1; \
  294 +
  295 +#elif defined(__APPLE__) \
  296 + || defined(__FreeBSD__) \
  297 + || defined(__DragonFly__) \
  298 + || defined(__OpenBSD__) \
288 299 || defined(__NetBSD__)
289 300
290   -#define UV_FS_EVENT_PRIVATE_FIELDS \
291   - ev_io event_watcher; \
292   - uv_fs_event_cb cb; \
293   - int fflags; \
  301 +#define UV_FS_EVENT_PRIVATE_FIELDS \
  302 + ev_io event_watcher; \
  303 + uv_fs_event_cb cb; \
  304 + int fflags; \
294 305 int fd;
295 306
296 307 #elif defined(__sun)
297 308
298 309 #ifdef PORT_SOURCE_FILE
299   -# define UV_FS_EVENT_PRIVATE_FIELDS \
300   - uv_fs_event_cb cb; \
301   - file_obj_t fo; \
  310 +# define UV_FS_EVENT_PRIVATE_FIELDS \
  311 + uv_fs_event_cb cb; \
  312 + file_obj_t fo; \
302 313 int fd;
303 314 #else /* !PORT_SOURCE_FILE */
304 315 # define UV_FS_EVENT_PRIVATE_FIELDS
445 deps/uv/include/uv-private/uv-win.h
@@ -29,12 +29,13 @@ typedef intptr_t ssize_t;
29 29 # define _SSIZE_T_DEFINED
30 30 #endif
31 31
32   -#include <process.h>
33   -#include <stdint.h>
34 32 #include <winsock2.h>
35 33 #include <mswsock.h>
36 34 #include <ws2tcpip.h>
37 35 #include <windows.h>
  36 +
  37 +#include <process.h>
  38 +#include <stdint.h>
38 39 #include <sys/stat.h>
39 40
40 41 #include "tree.h"
@@ -43,7 +44,7 @@ typedef intptr_t ssize_t;
43 44 #define MAX_PIPENAME_LEN 256
44 45
45 46 #ifndef S_IFLNK
46   -# define S_IFLNK 0xA000
  47 +# define S_IFLNK 0xA000
47 48 #endif
48 49
49 50 /*
@@ -51,24 +52,24 @@ typedef intptr_t ssize_t;
51 52 * Mingw32 doesn't have these :-(
52 53 */
53 54 #ifndef WSAID_ACCEPTEX
54   -# define WSAID_ACCEPTEX \
55   - {0xb5367df1, 0xcbac, 0x11cf, \
  55 +# define WSAID_ACCEPTEX \
  56 + {0xb5367df1, 0xcbac, 0x11cf, \
56 57 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
57 58
58   -# define WSAID_CONNECTEX \
59   - {0x25a207b9, 0xddf3, 0x4660, \
  59 +# define WSAID_CONNECTEX \
  60 + {0x25a207b9, 0xddf3, 0x4660, \
60 61 {0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}}
61 62
62   -# define WSAID_GETACCEPTEXSOCKADDRS \
63   - {0xb5367df2, 0xcbac, 0x11cf, \
  63 +# define WSAID_GETACCEPTEXSOCKADDRS \
  64 + {0xb5367df2, 0xcbac, 0x11cf, \
64 65 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
65 66
66   -# define WSAID_DISCONNECTEX \
67   - {0x7fda2e11, 0x8630, 0x436f, \
  67 +# define WSAID_DISCONNECTEX \
  68 + {0x7fda2e11, 0x8630, 0x436f, \
68 69 {0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
69 70
70   -# define WSAID_TRANSMITFILE \
71   - {0xb5367df0, 0xcbac, 0x11cf, \
  71 +# define WSAID_TRANSMITFILE \
  72 + {0xb5367df0, 0xcbac, 0x11cf, \
72 73 {0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
73 74
74 75 typedef BOOL PASCAL (*LPFN_ACCEPTEX)
@@ -246,272 +247,272 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
246 247 /* Counter to keep track of active udp streams */ \
247 248 unsigned int active_udp_streams;
248 249
249   -#define UV_REQ_TYPE_PRIVATE \
250   - /* TODO: remove the req suffix */ \
251   - UV_ACCEPT, \
252   - UV_FS_EVENT_REQ, \
253   - UV_POLL_REQ, \
254   - UV_PROCESS_EXIT, \
255   - UV_PROCESS_CLOSE, \
256   - UV_READ, \
257   - UV_UDP_RECV, \
  250 +#define UV_REQ_TYPE_PRIVATE \
  251 + /* TODO: remove the req suffix */ \
  252 + UV_ACCEPT, \
  253 + UV_FS_EVENT_REQ, \
  254 + UV_POLL_REQ, \
  255 + UV_PROCESS_EXIT, \
  256 + UV_READ, \
  257 + UV_UDP_RECV, \
258 258 UV_WAKEUP,
259 259
260   -#define UV_REQ_PRIVATE_FIELDS \
261   - union { \
262   - /* Used by I/O operations */ \
263   - struct { \
264   - OVERLAPPED overlapped; \
265   - size_t queued_bytes; \
266   - }; \
267   - }; \
  260 +#define UV_REQ_PRIVATE_FIELDS \
  261 + union { \
  262 + /* Used by I/O operations */ \
  263 + struct { \
  264 + OVERLAPPED overlapped; \
  265 + size_t queued_bytes; \
  266 + }; \
  267 + }; \
268 268 struct uv_req_s* next_req;
269 269
270   -#define UV_WRITE_PRIVATE_FIELDS \
271   - int ipc_header; \
272   - uv_buf_t write_buffer; \
273   - HANDLE event_handle; \
  270 +#define UV_WRITE_PRIVATE_FIELDS \
  271 + int ipc_header; \
  272 + uv_buf_t write_buffer; \
  273 + HANDLE event_handle; \
274 274 HANDLE wait_handle;
275 275
276   -#define UV_CONNECT_PRIVATE_FIELDS \
  276 +#define UV_CONNECT_PRIVATE_FIELDS \
277 277 /* empty */
278 278
279   -#define UV_SHUTDOWN_PRIVATE_FIELDS \
  279 +#define UV_SHUTDOWN_PRIVATE_FIELDS \
280 280 /* empty */
281 281
282   -#define UV_UDP_SEND_PRIVATE_FIELDS \
  282 +#define UV_UDP_SEND_PRIVATE_FIELDS \
283 283 /* empty */
284 284
285   -#define UV_PRIVATE_REQ_TYPES \
286   - typedef struct uv_pipe_accept_s { \
287   - UV_REQ_FIELDS \
288   - HANDLE pipeHandle; \
289   - struct uv_pipe_accept_s* next_pending; \
290   - } uv_pipe_accept_t; \
291   - \
292   - typedef struct uv_tcp_accept_s { \
293   - UV_REQ_FIELDS \
294   - SOCKET accept_socket; \
295   - char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \
296   - HANDLE event_handle; \
297   - HANDLE wait_handle; \
298   - struct uv_tcp_accept_s* next_pending; \
299   - } uv_tcp_accept_t; \
300   - \
301   - typedef struct uv_read_s { \
302   - UV_REQ_FIELDS \
303   - HANDLE event_handle; \
304   - HANDLE wait_handle; \
  285 +#define UV_PRIVATE_REQ_TYPES \
  286 + typedef struct uv_pipe_accept_s { \
  287 + UV_REQ_FIELDS \
  288 + HANDLE pipeHandle; \
  289 + struct uv_pipe_accept_s* next_pending; \
  290 + } uv_pipe_accept_t; \
  291 + \
  292 + typedef struct uv_tcp_accept_s { \
  293 + UV_REQ_FIELDS \
  294 + SOCKET accept_socket; \
  295 + char accept_buffer[sizeof(struct sockaddr_storage) * 2 + 32]; \
  296 + HANDLE event_handle; \
  297 + HANDLE wait_handle; \
  298 + struct uv_tcp_accept_s* next_pending; \
  299 + } uv_tcp_accept_t; \
  300 + \
  301 + typedef struct uv_read_s { \
  302 + UV_REQ_FIELDS \
  303 + HANDLE event_handle; \
  304 + HANDLE wait_handle; \
305 305 } uv_read_t;
306 306
307   -#define uv_stream_connection_fields \
308   - unsigned int write_reqs_pending; \
  307 +#define uv_stream_connection_fields \
  308 + unsigned int write_reqs_pending; \
309 309 uv_shutdown_t* shutdown_req;
310 310
311   -#define uv_stream_server_fields \
  311 +#define uv_stream_server_fields \
312 312 uv_connection_cb connection_cb;
313 313
314   -#define UV_STREAM_PRIVATE_FIELDS \
315   - unsigned int reqs_pending; \
316   - int activecnt; \
317   - uv_read_t read_req; \
318   - union { \
319   - struct { uv_stream_connection_fields }; \
320   - struct { uv_stream_server_fields }; \
  314 +#define UV_STREAM_PRIVATE_FIELDS \
  315 + unsigned int reqs_pending; \
  316 + int activecnt; \
  317 + uv_read_t read_req; \
  318 + union { \
  319 + struct { uv_stream_connection_fields }; \
  320 + struct { uv_stream_server_fields }; \
321 321 };
322 322
323   -#define uv_tcp_server_fields \
324   - uv_tcp_accept_t* accept_reqs; \
325   - unsigned int processed_accepts; \
326   - uv_tcp_accept_t* pending_accepts; \
  323 +#define uv_tcp_server_fields \
  324 + uv_tcp_accept_t* accept_reqs; \
  325 + unsigned int processed_accepts; \
  326 + uv_tcp_accept_t* pending_accepts; \
327 327 LPFN_ACCEPTEX func_acceptex;
328 328
329   -#define uv_tcp_connection_fields \
330   - uv_buf_t read_buffer; \
  329 +#define uv_tcp_connection_fields \
  330 + uv_buf_t read_buffer; \
331 331 LPFN_CONNECTEX func_connectex;
332 332
333   -#define UV_TCP_PRIVATE_FIELDS \
334   - SOCKET socket; \
335   - int bind_error; \
336   - union { \
337   - struct { uv_tcp_server_fields }; \
338   - struct { uv_tcp_connection_fields }; \
  333 +#define UV_TCP_PRIVATE_FIELDS \
  334 + SOCKET socket; \
  335 + int bind_error; \
  336 + union { \
  337 + struct { uv_tcp_server_fields }; \
  338 + struct { uv_tcp_connection_fields }; \
339 339 };
340 340
341   -#define UV_UDP_PRIVATE_FIELDS \
342   - SOCKET socket; \
343   - unsigned int reqs_pending; \
344   - int activecnt; \
345   - uv_req_t recv_req; \
346   - uv_buf_t recv_buffer; \
347   - struct sockaddr_storage recv_from; \
348   - int recv_from_len; \
349   - uv_udp_recv_cb recv_cb; \
350   - uv_alloc_cb alloc_cb; \
351   - LPFN_WSARECV func_wsarecv; \
  341 +#define UV_UDP_PRIVATE_FIELDS \
  342 + SOCKET socket; \
  343 + unsigned int reqs_pending; \
  344 + int activecnt; \
  345 + uv_req_t recv_req; \
  346 + uv_buf_t recv_buffer; \
  347 + struct sockaddr_storage recv_from; \
  348 + int recv_from_len; \
  349 + uv_udp_recv_cb recv_cb; \
  350 + uv_alloc_cb alloc_cb; \
  351 + LPFN_WSARECV func_wsarecv; \
352 352 LPFN_WSARECVFROM func_wsarecvfrom;
353 353
354   -#define uv_pipe_server_fields \
355   - int pending_instances; \
356   - uv_pipe_accept_t* accept_reqs; \
  354 +#define uv_pipe_server_fields \
  355 + int pending_instances; \
  356 + uv_pipe_accept_t* accept_reqs; \
357 357 uv_pipe_accept_t* pending_accepts;
358 358
359   -#define uv_pipe_connection_fields \
360   - uv_timer_t* eof_timer; \
361   - uv_write_t ipc_header_write_req; \
362   - int ipc_pid; \
363   - uint64_t remaining_ipc_rawdata_bytes; \
364   - unsigned char reserved[sizeof(void*)]; \
365   - struct { \
366   - WSAPROTOCOL_INFOW* socket_info; \
367   - int tcp_connection; \
368   - } pending_ipc_info; \
  359 +#define uv_pipe_connection_fields \
  360 + uv_timer_t* eof_timer; \
  361 + uv_write_t ipc_header_write_req; \
  362 + int ipc_pid; \
  363 + uint64_t remaining_ipc_rawdata_bytes; \
  364 + unsigned char reserved[sizeof(void*)]; \
  365 + struct { \
  366 + WSAPROTOCOL_INFOW* socket_info; \
  367 + int tcp_connection; \
  368 + } pending_ipc_info; \
369 369 uv_write_t* non_overlapped_writes_tail;
370 370
371   -#define UV_PIPE_PRIVATE_FIELDS \
372   - HANDLE handle; \
373   - wchar_t* name; \
374   - union { \
375   - struct { uv_pipe_server_fields }; \
376   - struct { uv_pipe_connection_fields }; \
  371 +#define UV_PIPE_PRIVATE_FIELDS \
  372 + HANDLE handle; \
  373 + WCHAR* name; \
  374 + union { \
  375 + struct { uv_pipe_server_fields }; \
  376 + struct { uv_pipe_connection_fields }; \
377 377 };
378 378
379 379 /* TODO: put the parser states in an union - TTY handles are always */
380 380 /* half-duplex so read-state can safely overlap write-state. */
381   -#define UV_TTY_PRIVATE_FIELDS \
382   - HANDLE handle; \
383   - HANDLE read_line_handle; \
384   - uv_buf_t read_line_buffer; \
385   - HANDLE read_raw_wait; \
386   - DWORD original_console_mode; \
387   - /* Fields used for translating win */ \
388   - /* keystrokes into vt100 characters */ \
389   - char last_key[8]; \
390   - unsigned char last_key_offset; \
391   - unsigned char last_key_len; \
392   - INPUT_RECORD last_input_record; \
393   - WCHAR last_utf16_high_surrogate; \
394   - /* utf8-to-utf16 conversion state */ \
395   - unsigned char utf8_bytes_left; \
396   - unsigned int utf8_codepoint; \
397   - /* eol conversion state */ \
398   - unsigned char previous_eol; \
399   - /* ansi parser state */ \
400   - unsigned char ansi_parser_state; \
401   - unsigned char ansi_csi_argc; \
402   - unsigned short ansi_csi_argv[4]; \
403   - COORD saved_position; \
  381 +#define UV_TTY_PRIVATE_FIELDS \
  382 + HANDLE handle; \
  383 + HANDLE read_line_handle; \
  384 + uv_buf_t read_line_buffer; \
  385 + HANDLE read_raw_wait; \
  386 + DWORD original_console_mode; \
  387 + /* Fields used for translating win */ \
  388 + /* keystrokes into vt100 characters */ \
  389 + char last_key[8]; \
  390 + unsigned char last_key_offset; \
  391 + unsigned char last_key_len; \
  392 + INPUT_RECORD last_input_record; \
  393 + WCHAR last_utf16_high_surrogate; \
  394 + /* utf8-to-utf16 conversion state */ \
  395 + unsigned char utf8_bytes_left; \
  396 + unsigned int utf8_codepoint; \
  397 + /* eol conversion state */ \
  398 + unsigned char previous_eol; \
  399 + /* ansi parser state */ \
  400 + unsigned char ansi_parser_state; \
  401 + unsigned char ansi_csi_argc; \
  402 + unsigned short ansi_csi_argv[4]; \
  403 + COORD saved_position; \
404 404 WORD saved_attributes;
405 405
406   -#define UV_POLL_PRIVATE_FIELDS \
407   - SOCKET socket; \
408   - /* Used in fast mode */ \
409   - SOCKET peer_socket; \
410   - AFD_POLL_INFO afd_poll_info_1; \
411   - AFD_POLL_INFO afd_poll_info_2; \
412   - /* Used in fast and slow mode. */ \
413   - uv_req_t poll_req_1; \
414   - uv_req_t poll_req_2; \
415   - unsigned char submitted_events_1; \
416   - unsigned char submitted_events_2; \
417   - unsigned char mask_events_1; \
418   - unsigned char mask_events_2; \
  406 +#define UV_POLL_PRIVATE_FIELDS \
  407 + SOCKET socket; \
  408 + /* Used in fast mode */ \
  409 + SOCKET peer_socket; \
  410 + AFD_POLL_INFO afd_poll_info_1; \
  411 + AFD_POLL_INFO afd_poll_info_2; \
  412 + /* Used in fast and slow mode. */ \
  413 + uv_req_t poll_req_1; \
  414 + uv_req_t poll_req_2; \
  415 + unsigned char submitted_events_1; \
  416 + unsigned char submitted_events_2; \
  417 + unsigned char mask_events_1; \
  418 + unsigned char mask_events_2; \
419 419 unsigned char events;
420 420
421   -#define UV_TIMER_PRIVATE_FIELDS \
422   - RB_ENTRY(uv_timer_s) tree_entry; \
423   - int64_t due; \
424   - int64_t repeat; \
  421 +#define UV_TIMER_PRIVATE_FIELDS \
  422 + RB_ENTRY(uv_timer_s) tree_entry; \
  423 + int64_t due; \
  424 + int64_t repeat; \
  425 + int64_t start_id; \
425 426 uv_timer_cb timer_cb;
426 427
427   -#define UV_ASYNC_PRIVATE_FIELDS \
428   - struct uv_req_s async_req; \
429   - uv_async_cb async_cb; \
430   - /* char to avoid alignment issues */ \
  428 +#define UV_ASYNC_PRIVATE_FIELDS \
  429 + struct uv_req_s async_req; \
  430 + uv_async_cb async_cb; \
  431 + /* char to avoid alignment issues */ \
431 432 char volatile async_sent;
432 433
433   -#define UV_PREPARE_PRIVATE_FIELDS \
434   - uv_prepare_t* prepare_prev; \
435   - uv_prepare_t* prepare_next; \
  434 +#define UV_PREPARE_PRIVATE_FIELDS \
  435 + uv_prepare_t* prepare_prev; \
  436 + uv_prepare_t* prepare_next; \
436 437 uv_prepare_cb prepare_cb;
437 438
438   -#define UV_CHECK_PRIVATE_FIELDS \
439   - uv_check_t* check_prev; \
440   - uv_check_t* check_next; \
  439 +#define UV_CHECK_PRIVATE_FIELDS \
  440 + uv_check_t* check_prev; \
  441 + uv_check_t* check_next; \
441 442 uv_check_cb check_cb;
442 443
443   -#define UV_IDLE_PRIVATE_FIELDS \
444   - uv_idle_t* idle_prev; \
445   - uv_idle_t* idle_next; \
  444 +#define UV_IDLE_PRIVATE_FIELDS \
  445 + uv_idle_t* idle_prev; \
  446 + uv_idle_t* idle_next; \
446 447 uv_idle_cb idle_cb;
447 448
448   -#define UV_HANDLE_PRIVATE_FIELDS \
449   - uv_handle_t* endgame_next; \
  449 +#define UV_HANDLE_PRIVATE_FIELDS \
  450 + uv_handle_t* endgame_next; \
450 451 unsigned int flags;
451 452
452   -#define UV_GETADDRINFO_PRIVATE_FIELDS \
453   - uv_getaddrinfo_cb getaddrinfo_cb; \
454   - void* alloc; \
455   - wchar_t* node; \
456   - wchar_t* service; \
457   - struct addrinfoW* hints; \
458   - struct addrinfoW* res; \
  453 +#define UV_GETADDRINFO_PRIVATE_FIELDS \
  454 + uv_getaddrinfo_cb getaddrinfo_cb; \
  455 + void* alloc; \
  456 + WCHAR* node; \
  457 + WCHAR* service; \
  458 + struct addrinfoW* hints; \
  459 + struct addrinfoW* res; \
459 460 int retcode;
460 461
461   -#define UV_PROCESS_PRIVATE_FIELDS \
462   - struct uv_process_exit_s { \
463   - UV_REQ_FIELDS \
464   - } exit_req; \
465   - struct uv_process_close_s { \
466   - UV_REQ_FIELDS \
467   - } close_req; \
468   - BYTE* child_stdio_buffer; \
469   - int exit_signal; \
470   - DWORD spawn_errno; \
471   - HANDLE wait_handle; \
472   - HANDLE process_handle; \
473   - HANDLE close_handle;
474   -
475   -#define UV_FS_PRIVATE_FIELDS \
476   - int flags; \
477   - DWORD sys_errno_; \
478   - union { \
479   - /* TODO: remove me in 0.9. */ \
480   - WCHAR* pathw; \
481   - int fd; \
482   - }; \
483   - union { \
484   - struct { \
485   - int mode; \
486   - WCHAR* new_pathw; \
487   - int file_flags; \
488   - int fd_out; \
489   - void* buf; \
490   - size_t length; \
491   - int64_t offset; \
492   - }; \
493   - struct _stati64 stat; \
494   - struct { \
495   - double atime; \
496   - double mtime; \
497   - }; \
  462 +#define UV_PROCESS_PRIVATE_FIELDS \
  463 + struct uv_process_exit_s { \
  464 + UV_REQ_FIELDS \
  465 + } exit_req; \
  466 + BYTE* child_stdio_buffer; \
  467 + uv_err_t spawn_error; \
  468 + int exit_signal; \
  469 + HANDLE wait_handle; \
  470 + HANDLE process_handle; \
  471 + volatile char exit_cb_pending;
  472 +
  473 +#define UV_FS_PRIVATE_FIELDS \
  474 + int flags; \
  475 + DWORD sys_errno_; \
  476 + union { \
  477 + /* TODO: remove me in 0.9. */ \
  478 + WCHAR* pathw; \
  479 + int fd; \
  480 + }; \
  481 + union { \
  482 + struct { \
  483 + int mode; \
  484 + WCHAR* new_pathw; \
  485 + int file_flags; \
  486 + int fd_out; \
  487 + void* buf; \
  488 + size_t length; \
  489 + int64_t offset; \
  490 + }; \
  491 + struct _stati64 stat; \
  492 + struct { \
  493 + double atime; \
  494 + double mtime; \
  495 + }; \
498 496 };
499 497
500   -#define UV_WORK_PRIVATE_FIELDS \
501   -
502   -#define UV_FS_EVENT_PRIVATE_FIELDS \
503   - struct uv_fs_event_req_s { \
504   - UV_REQ_FIELDS \
505   - } req; \
506   - HANDLE dir_handle; \
507   - int req_pending; \
508   - uv_fs_event_cb cb; \
509   - wchar_t* filew; \
510   - wchar_t* short_filew; \
511   - wchar_t* dirw; \
  498 +#define UV_WORK_PRIVATE_FIELDS \
  499 +
  500 +#define UV_FS_EVENT_PRIVATE_FIELDS \
  501 + struct uv_fs_event_req_s { \
  502 + UV_REQ_FIELDS \
  503 + } req; \
  504 + HANDLE dir_handle; \
  505 + int req_pending; \
  506 + uv_fs_event_cb cb; \
  507 + WCHAR* filew; \
  508 + WCHAR* short_filew; \
  509 + WCHAR* dirw; \
512 510 char* buffer;
513 511
514   -int uv_utf16_to_utf8(const wchar_t* utf16Buffer, size_t utf16Size,
  512 +#define UV_SIGNAL_PRIVATE_FIELDS \
  513 + /* empty */
  514 +
  515 +int uv_utf16_to_utf8(const WCHAR* utf16Buffer, size_t utf16Size,
515 516 char* utf8Buffer, size_t utf8Size);
516   -int uv_utf8_to_utf16(const char* utf8Buffer, wchar_t* utf16Buffer,
  517 +int uv_utf8_to_utf16(const char* utf8Buffer, WCHAR* utf16Buffer,
517 518 size_t utf16Size);
227 deps/uv/include/uv.h
@@ -19,7 +19,7 @@
19 19 * IN THE SOFTWARE.
20 20 */
21 21
22   -/* See uv_loop_new for an introduction. */
  22 +/* See http://nikhilm.github.com/uvbook/ for an introduction. */
23 23
24 24 #ifndef UV_H
25 25 #define UV_H
@@ -53,6 +53,10 @@ extern "C" {
53 53 #include <stdint.h> /* int64_t */
54 54 #include <sys/types.h> /* size_t */
55 55
  56 +#if defined(__SVR4) && !defined(__unix__)
  57 +# define __unix__
  58 +#endif
  59 +
56 60 #if defined(__unix__) || defined(__POSIX__) || defined(__APPLE__)
57 61 # include "uv-private/uv-unix.h"
58 62 #else
@@ -60,64 +64,64 @@ extern "C" {
60 64 #endif
61 65
62 66 /* Expand this list if necessary. */
63   -#define UV_ERRNO_MAP(XX) \
64   - XX( -1, UNKNOWN, "unknown error") \
65   - XX( 0, OK, "success") \
66   - XX( 1, EOF, "end of file") \
67   - XX( 2, EADDRINFO, "getaddrinfo error") \
68   - XX( 3, EACCES, "permission denied") \
69   - XX( 4, EAGAIN, "no more processes") \
70   - XX( 5, EADDRINUSE, "address already in use") \
71   - XX( 6, EADDRNOTAVAIL, "") \
72   - XX( 7, EAFNOSUPPORT, "") \
73   - XX( 8, EALREADY, "") \
74   - XX( 9, EBADF, "bad file descriptor") \
75   - XX( 10, EBUSY, "resource busy or locked") \
76   - XX( 11, ECONNABORTED, "software caused connection abort") \
77   - XX( 12, ECONNREFUSED, "connection refused") \
78   - XX( 13, ECONNRESET, "connection reset by peer") \
79   - XX( 14, EDESTADDRREQ, "destination address required") \
80   - XX( 15, EFAULT, "bad address in system call argument") \
81   - XX( 16, EHOSTUNREACH, "host is unreachable") \
82   - XX( 17, EINTR, "interrupted system call") \
83   - XX( 18, EINVAL, "invalid argument") \
84   - XX( 19, EISCONN, "socket is already connected") \
85   - XX( 20, EMFILE, "too many open files") \
86   - XX( 21, EMSGSIZE, "message too long") \
87   - XX( 22, ENETDOWN, "network is down") \
88   - XX( 23, ENETUNREACH, "network is unreachable") \
89   - XX( 24, ENFILE, "file table overflow") \
90   - XX( 25, ENOBUFS, "no buffer space available") \
91   - XX( 26, ENOMEM, "not enough memory") \
92   - XX( 27, ENOTDIR, "not a directory") \
93   - XX( 28, EISDIR, "illegal operation on a directory") \
94   - XX( 29, ENONET, "machine is not on the network") \
95   - XX( 31, ENOTCONN, "socket is not connected") \
96   - XX( 32, ENOTSOCK, "socket operation on non-socket") \
97   - XX( 33, ENOTSUP, "operation not supported on socket") \
98   - XX( 34, ENOENT, "no such file or directory") \
99   - XX( 35, ENOSYS, "function not implemented") \
100   - XX( 36, EPIPE, "broken pipe") \
101   - XX( 37, EPROTO, "protocol error") \
102   - XX( 38, EPROTONOSUPPORT, "protocol not supported") \
103   - XX( 39, EPROTOTYPE, "protocol wrong type for socket") \
104   - XX( 40, ETIMEDOUT, "connection timed out") \
105   - XX( 41, ECHARSET, "") \
106   - XX( 42, EAIFAMNOSUPPORT, "") \
107   - XX( 44, EAISERVICE, "") \
108   - XX( 45, EAISOCKTYPE, "") \
109   - XX( 46, ESHUTDOWN, "") \
110   - XX( 47, EEXIST, "file already exists") \
111   - XX( 48, ESRCH, "no such process") \
112   - XX( 49, ENAMETOOLONG, "name too long") \
113   - XX( 50, EPERM, "operation not permitted") \
114   - XX( 51, ELOOP, "too many symbolic links encountered") \
115   - XX( 52, EXDEV, "cross-device link not permitted") \
116   - XX( 53, ENOTEMPTY, "directory not empty") \
117   - XX( 54, ENOSPC, "no space left on device") \
118   - XX( 55, EIO, "i/o error") \
119   - XX( 56, EROFS, "read-only file system" ) \
120   - XX( 57, ENODEV, "no such device" ) \
  67 +#define UV_ERRNO_MAP(XX) \
  68 + XX( -1, UNKNOWN, "unknown error") \
  69 + XX( 0, OK, "success") \
  70 + XX( 1, EOF, "end of file") \
  71 + XX( 2, EADDRINFO, "getaddrinfo error") \
  72 + XX( 3, EACCES, "permission denied") \
  73 + XX( 4, EAGAIN, "no more processes") \
  74 + XX( 5, EADDRINUSE, "address already in use") \
  75 + XX( 6, EADDRNOTAVAIL, "") \
  76 + XX( 7, EAFNOSUPPORT, "") \
  77 + XX( 8, EALREADY, "") \
  78 + XX( 9, EBADF, "bad file descriptor") \
  79 + XX( 10, EBUSY, "resource busy or locked") \
  80 + XX( 11, ECONNABORTED, "software caused connection abort") \
  81 + XX( 12, ECONNREFUSED, "connection refused") \
  82 + XX( 13, ECONNRESET, "connection reset by peer") \
  83 + XX( 14, EDESTADDRREQ, "destination address required") \
  84 + XX( 15, EFAULT, "bad address in system call argument") \
  85 + XX( 16, EHOSTUNREACH, "host is unreachable") \
  86 + XX( 17, EINTR, "interrupted system call") \
  87 + XX( 18, EINVAL, "invalid argument") \
  88 + XX( 19, EISCONN, "socket is already connected") \
  89 + XX( 20, EMFILE, "too many open files") \
  90 + XX( 21, EMSGSIZE, "message too long") \
  91 + XX( 22, ENETDOWN, "network is down") \
  92 + XX( 23, ENETUNREACH, "network is unreachable") \
  93 + XX( 24, ENFILE, "file table overflow") \
  94 + XX( 25, ENOBUFS, "no buffer space available") \
  95 + XX( 26, ENOMEM, "not enough memory") \
  96 + XX( 27, ENOTDIR, "not a directory") \
  97 + XX( 28, EISDIR, "illegal operation on a directory") \
  98 + XX( 29, ENONET, "machine is not on the network") \
  99 + XX( 31, ENOTCONN, "socket is not connected") \
  100 + XX( 32, ENOTSOCK, "socket operation on non-socket") \
  101 + XX( 33, ENOTSUP, "operation not supported on socket") \
  102 + XX( 34, ENOENT, "no such file or directory") \
  103 + XX( 35, ENOSYS, "function not implemented") \
  104 + XX( 36, EPIPE, "broken pipe") \