noderb 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +157 -7
- data/ext/noderb_extension/extconf.rb +1 -3
- data/ext/noderb_extension/libuv/BSDmakefile +2 -0
- data/ext/noderb_extension/libuv/all.gyp +326 -0
- data/ext/noderb_extension/libuv/config-mingw.mk +0 -1
- data/ext/noderb_extension/libuv/config-unix.mk +7 -1
- data/ext/noderb_extension/libuv/create-msvs-files.bat +13 -6
- data/ext/noderb_extension/libuv/{build/gyp_uv → gyp_uv} +1 -2
- data/ext/noderb_extension/libuv/include/uv.h +5 -0
- data/ext/noderb_extension/libuv/src/eio/config_cygwin.h +3 -0
- data/ext/noderb_extension/libuv/src/eio/config_freebsd.h +3 -0
- data/ext/noderb_extension/libuv/src/eio/config_sunos.h +3 -0
- data/ext/noderb_extension/libuv/src/eio/ecb.h +1 -1
- data/ext/noderb_extension/libuv/src/eio/eio.c +8 -1
- data/ext/noderb_extension/libuv/src/uv-common.c +1 -0
- data/ext/noderb_extension/libuv/src/uv-sunos.c +1 -1
- data/ext/noderb_extension/libuv/src/uv-unix.c +72 -59
- data/ext/noderb_extension/libuv/src/win/core.c +3 -0
- data/ext/noderb_extension/libuv/src/win/internal.h +11 -0
- data/ext/noderb_extension/libuv/src/win/ntdll.h +130 -0
- data/ext/noderb_extension/libuv/src/win/pipe.c +105 -27
- data/ext/noderb_extension/libuv/src/win/process.c +76 -5
- data/ext/noderb_extension/libuv/src/win/req.c +7 -0
- data/ext/noderb_extension/libuv/src/win/winapi.c +52 -0
- data/ext/noderb_extension/libuv/test/benchmark-pound.c +50 -48
- data/ext/noderb_extension/libuv/test/echo-server.c +2 -2
- data/ext/noderb_extension/libuv/test/test-list.h +2 -0
- data/ext/noderb_extension/libuv/test/test-spawn.c +48 -1
- data/ext/noderb_extension/noderb.c +38 -339
- data/ext/noderb_extension/noderb.h +18 -2
- data/ext/noderb_extension/noderb_common.h +13 -0
- data/ext/noderb_extension/noderb_dns.c +37 -0
- data/ext/noderb_extension/noderb_dns.h +15 -0
- data/ext/noderb_extension/noderb_process.c +126 -0
- data/ext/noderb_extension/noderb_process.h +17 -0
- data/ext/noderb_extension/noderb_tcp.c +127 -0
- data/ext/noderb_extension/noderb_tcp.h +19 -0
- data/ext/noderb_extension/noderb_timers.c +58 -0
- data/ext/noderb_extension/noderb_timers.h +16 -0
- data/ext/noderb_extension/noderb_tools.c +127 -0
- data/ext/noderb_extension/noderb_tools.h +33 -0
- data/lib/noderb/dns.rb +11 -0
- data/lib/noderb/next_tick.rb +2 -1
- data/lib/noderb/tcp.rb +27 -0
- data/lib/noderb/timers.rb +24 -0
- data/lib/noderb/version.rb +1 -1
- data/lib/noderb.rb +6 -1
- metadata +23 -7
- data/ext/noderb_extension/libuv/build/all.gyp +0 -254
- data/ext/noderb_extension/libuv/doc/desired-api.md +0 -159
- /data/ext/noderb_extension/libuv/{build/common.gypi → common.gypi} +0 -0
@@ -48,9 +48,13 @@
|
|
48
48
|
#include <linux/version.h>
|
49
49
|
/* pipe2() requires linux >= 2.6.27 and glibc >= 2.9 */
|
50
50
|
#define HAVE_PIPE2 \
|
51
|
-
defined(LINUX_VERSION_CODE) && defined(__GLIBC_PREREQ) &&
|
51
|
+
defined(LINUX_VERSION_CODE) && defined(__GLIBC_PREREQ) && \
|
52
|
+
LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) && __GLIBC_PREREQ(2, 9))
|
52
53
|
#endif
|
53
54
|
|
55
|
+
/* XXX disabling HAVE_PIPE2 for now can't compile on 2.6.18 */
|
56
|
+
#undef HAVE_PIPE2
|
57
|
+
|
54
58
|
#ifdef __sun
|
55
59
|
# include <sys/types.h>
|
56
60
|
# include <sys/wait.h>
|
@@ -167,6 +171,7 @@ static uv_err_code uv_translate_sys_error(int sys_errno) {
|
|
167
171
|
case 0: return UV_OK;
|
168
172
|
case EACCES: return UV_EACCESS;
|
169
173
|
case EBADF: return UV_EBADF;
|
174
|
+
case EPIPE: return UV_EPIPE;
|
170
175
|
case EAGAIN: return UV_EAGAIN;
|
171
176
|
case ECONNRESET: return UV_ECONNRESET;
|
172
177
|
case EFAULT: return UV_EFAULT;
|
@@ -199,19 +204,31 @@ static uv_err_t uv_err_new(uv_handle_t* handle, int sys_error) {
|
|
199
204
|
|
200
205
|
|
201
206
|
void uv_close(uv_handle_t* handle, uv_close_cb close_cb) {
|
202
|
-
uv_tcp_t* tcp;
|
203
|
-
uv_pipe_t* pipe;
|
204
207
|
uv_async_t* async;
|
205
208
|
uv_timer_t* timer;
|
209
|
+
uv_stream_t* stream;
|
206
210
|
uv_process_t* process;
|
207
211
|
|
208
212
|
handle->close_cb = close_cb;
|
209
213
|
|
210
214
|
switch (handle->type) {
|
215
|
+
case UV_NAMED_PIPE:
|
216
|
+
uv_pipe_cleanup((uv_pipe_t*)handle);
|
217
|
+
/* Fall through. */
|
218
|
+
|
211
219
|
case UV_TCP:
|
212
|
-
|
213
|
-
|
214
|
-
|
220
|
+
stream = (uv_stream_t*)handle;
|
221
|
+
|
222
|
+
uv_read_stop(stream);
|
223
|
+
ev_io_stop(EV_DEFAULT_ &stream->write_watcher);
|
224
|
+
|
225
|
+
uv__close(stream->fd);
|
226
|
+
stream->fd = -1;
|
227
|
+
|
228
|
+
if (stream->accepted_fd >= 0) {
|
229
|
+
uv__close(stream->accepted_fd);
|
230
|
+
stream->accepted_fd = -1;
|
231
|
+
}
|
215
232
|
break;
|
216
233
|
|
217
234
|
case UV_PREPARE:
|
@@ -240,13 +257,6 @@ void uv_close(uv_handle_t* handle, uv_close_cb close_cb) {
|
|
240
257
|
ev_timer_stop(EV_DEFAULT_ &timer->timer_watcher);
|
241
258
|
break;
|
242
259
|
|
243
|
-
case UV_NAMED_PIPE:
|
244
|
-
pipe = (uv_pipe_t*)handle;
|
245
|
-
uv_pipe_cleanup(pipe);
|
246
|
-
uv_read_stop((uv_stream_t*)handle);
|
247
|
-
ev_io_stop(EV_DEFAULT_ &pipe->write_watcher);
|
248
|
-
break;
|
249
|
-
|
250
260
|
case UV_PROCESS:
|
251
261
|
process = (uv_process_t*)handle;
|
252
262
|
ev_child_stop(EV_DEFAULT_UC_ &process->child_watcher);
|
@@ -326,20 +336,20 @@ static int uv__bind(uv_tcp_t* tcp, int domain, struct sockaddr* addr,
|
|
326
336
|
int addrsize) {
|
327
337
|
int saved_errno;
|
328
338
|
int status;
|
329
|
-
int fd;
|
330
339
|
|
331
340
|
saved_errno = errno;
|
332
341
|
status = -1;
|
333
342
|
|
334
|
-
if (tcp->fd
|
335
|
-
if ((fd = uv__socket(domain, SOCK_STREAM, 0)) == -1) {
|
343
|
+
if (tcp->fd < 0) {
|
344
|
+
if ((tcp->fd = uv__socket(domain, SOCK_STREAM, 0)) == -1) {
|
336
345
|
uv_err_new((uv_handle_t*)tcp, errno);
|
337
346
|
goto out;
|
338
347
|
}
|
339
348
|
|
340
|
-
if (uv__stream_open((uv_stream_t*)tcp, fd, UV_READABLE | UV_WRITABLE)) {
|
349
|
+
if (uv__stream_open((uv_stream_t*)tcp, tcp->fd, UV_READABLE | UV_WRITABLE)) {
|
350
|
+
uv__close(tcp->fd);
|
351
|
+
tcp->fd = -1;
|
341
352
|
status = -2;
|
342
|
-
uv__close(fd);
|
343
353
|
goto out;
|
344
354
|
}
|
345
355
|
}
|
@@ -422,14 +432,17 @@ void uv__server_io(EV_P_ ev_io* watcher, int revents) {
|
|
422
432
|
watcher == &stream->write_watcher);
|
423
433
|
assert(revents == EV_READ);
|
424
434
|
|
425
|
-
assert(!(
|
435
|
+
assert(!(stream->flags & UV_CLOSING));
|
426
436
|
|
427
437
|
if (stream->accepted_fd >= 0) {
|
428
438
|
ev_io_stop(EV_DEFAULT_ &stream->read_watcher);
|
429
439
|
return;
|
430
440
|
}
|
431
441
|
|
432
|
-
while
|
442
|
+
/* connection_cb can close the server socket while we're
|
443
|
+
* in the loop so check it on each iteration.
|
444
|
+
*/
|
445
|
+
while (stream->fd != -1) {
|
433
446
|
assert(stream->accepted_fd < 0);
|
434
447
|
fd = uv__accept(stream->fd, (struct sockaddr*)&addr, sizeof addr);
|
435
448
|
|
@@ -444,7 +457,6 @@ void uv__server_io(EV_P_ ev_io* watcher, int revents) {
|
|
444
457
|
uv_err_new((uv_handle_t*)stream, errno);
|
445
458
|
stream->connection_cb((uv_stream_t*)stream, -1);
|
446
459
|
}
|
447
|
-
|
448
460
|
} else {
|
449
461
|
stream->accepted_fd = fd;
|
450
462
|
stream->connection_cb((uv_stream_t*)stream, 0);
|
@@ -508,21 +520,21 @@ int uv_listen(uv_stream_t* stream, int backlog, uv_connection_cb cb) {
|
|
508
520
|
|
509
521
|
static int uv_tcp_listen(uv_tcp_t* tcp, int backlog, uv_connection_cb cb) {
|
510
522
|
int r;
|
511
|
-
int fd;
|
512
523
|
|
513
524
|
if (tcp->delayed_error) {
|
514
525
|
uv_err_new((uv_handle_t*)tcp, tcp->delayed_error);
|
515
526
|
return -1;
|
516
527
|
}
|
517
528
|
|
518
|
-
if (tcp->fd
|
519
|
-
if ((fd = uv__socket(AF_INET, SOCK_STREAM, 0)) == -1) {
|
529
|
+
if (tcp->fd < 0) {
|
530
|
+
if ((tcp->fd = uv__socket(AF_INET, SOCK_STREAM, 0)) == -1) {
|
520
531
|
uv_err_new((uv_handle_t*)tcp, errno);
|
521
532
|
return -1;
|
522
533
|
}
|
523
534
|
|
524
|
-
if (uv__stream_open((uv_stream_t*)tcp, fd, UV_READABLE)) {
|
525
|
-
uv__close(fd);
|
535
|
+
if (uv__stream_open((uv_stream_t*)tcp, tcp->fd, UV_READABLE)) {
|
536
|
+
uv__close(tcp->fd);
|
537
|
+
tcp->fd = -1;
|
526
538
|
return -1;
|
527
539
|
}
|
528
540
|
}
|
@@ -574,23 +586,9 @@ void uv__finish_close(uv_handle_t* handle) {
|
|
574
586
|
|
575
587
|
case UV_NAMED_PIPE:
|
576
588
|
case UV_TCP:
|
577
|
-
|
578
|
-
uv_stream_t*
|
579
|
-
|
580
|
-
stream = (uv_stream_t*)handle;
|
581
|
-
|
582
|
-
assert(!ev_is_active(&stream->read_watcher));
|
583
|
-
assert(!ev_is_active(&stream->write_watcher));
|
584
|
-
|
585
|
-
uv__close(stream->fd);
|
586
|
-
stream->fd = -1;
|
587
|
-
|
588
|
-
if (stream->accepted_fd >= 0) {
|
589
|
-
uv__close(stream->accepted_fd);
|
590
|
-
stream->accepted_fd = -1;
|
591
|
-
}
|
589
|
+
assert(!ev_is_active(&((uv_stream_t*)handle)->read_watcher));
|
590
|
+
assert(!ev_is_active(&((uv_stream_t*)handle)->write_watcher));
|
592
591
|
break;
|
593
|
-
}
|
594
592
|
|
595
593
|
case UV_PROCESS:
|
596
594
|
assert(!ev_is_active(&((uv_process_t*)handle)->child_watcher));
|
@@ -653,9 +651,9 @@ static void uv__drain(uv_stream_t* stream) {
|
|
653
651
|
ev_io_stop(EV_DEFAULT_ &stream->write_watcher);
|
654
652
|
|
655
653
|
/* Shutdown? */
|
656
|
-
if ((
|
657
|
-
!(
|
658
|
-
!(
|
654
|
+
if ((stream->flags & UV_SHUTTING) &&
|
655
|
+
!(stream->flags & UV_CLOSING) &&
|
656
|
+
!(stream->flags & UV_SHUT)) {
|
659
657
|
assert(stream->shutdown_req);
|
660
658
|
|
661
659
|
req = stream->shutdown_req;
|
@@ -874,10 +872,10 @@ int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) {
|
|
874
872
|
"uv_shutdown (unix) only supports uv_handle_t right now");
|
875
873
|
assert(stream->fd >= 0);
|
876
874
|
|
877
|
-
if (!(
|
878
|
-
|
879
|
-
|
880
|
-
|
875
|
+
if (!(stream->flags & UV_WRITABLE) ||
|
876
|
+
stream->flags & UV_SHUT ||
|
877
|
+
stream->flags & UV_CLOSED ||
|
878
|
+
stream->flags & UV_CLOSING) {
|
881
879
|
uv_err_new((uv_handle_t*)stream, EINVAL);
|
882
880
|
return -1;
|
883
881
|
}
|
@@ -906,7 +904,7 @@ static void uv__stream_io(EV_P_ ev_io* watcher, int revents) {
|
|
906
904
|
stream->type == UV_NAMED_PIPE);
|
907
905
|
assert(watcher == &stream->read_watcher ||
|
908
906
|
watcher == &stream->write_watcher);
|
909
|
-
assert(!(
|
907
|
+
assert(!(stream->flags & UV_CLOSING));
|
910
908
|
|
911
909
|
if (stream->connect_req) {
|
912
910
|
uv__stream_connect(stream);
|
@@ -994,10 +992,6 @@ static int uv__connect(uv_connect_t* req,
|
|
994
992
|
|
995
993
|
if (stream->fd <= 0) {
|
996
994
|
if ((sockfd = uv__socket(addr->sa_family, SOCK_STREAM, 0)) == -1) {
|
997
|
-
|
998
|
-
}
|
999
|
-
|
1000
|
-
if (sockfd < 0) {
|
1001
995
|
uv_err_new((uv_handle_t*)stream, errno);
|
1002
996
|
return -1;
|
1003
997
|
}
|
@@ -1990,9 +1984,8 @@ int uv_pipe_connect(uv_connect_t* req,
|
|
1990
1984
|
goto out;
|
1991
1985
|
}
|
1992
1986
|
|
1993
|
-
handle
|
1994
|
-
|
1995
|
-
ev_io_init(&handle->write_watcher, uv__stream_io, sockfd, EV_WRITE);
|
1987
|
+
uv__stream_open((uv_stream_t*)handle, sockfd, UV_READABLE | UV_WRITABLE);
|
1988
|
+
|
1996
1989
|
ev_io_start(EV_DEFAULT_ &handle->read_watcher);
|
1997
1990
|
ev_io_start(EV_DEFAULT_ &handle->write_watcher);
|
1998
1991
|
|
@@ -2075,6 +2068,8 @@ static int uv__socket(int domain, int type, int protocol) {
|
|
2075
2068
|
static int uv__accept(int sockfd, struct sockaddr* saddr, socklen_t slen) {
|
2076
2069
|
int peerfd;
|
2077
2070
|
|
2071
|
+
assert(sockfd >= 0);
|
2072
|
+
|
2078
2073
|
do {
|
2079
2074
|
#if defined(SOCK_NONBLOCK) && defined(SOCK_CLOEXEC)
|
2080
2075
|
peerfd = accept4(sockfd, saddr, &slen, SOCK_NONBLOCK | SOCK_CLOEXEC);
|
@@ -2202,6 +2197,9 @@ static void uv__chld(EV_P_ ev_child* watcher, int revents) {
|
|
2202
2197
|
}
|
2203
2198
|
}
|
2204
2199
|
|
2200
|
+
#ifndef SPAWN_WAIT_EXEC
|
2201
|
+
# define SPAWN_WAIT_EXEC 1
|
2202
|
+
#endif
|
2205
2203
|
|
2206
2204
|
int uv_spawn(uv_process_t* process, uv_process_options_t options) {
|
2207
2205
|
/*
|
@@ -2212,8 +2210,10 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
|
|
2212
2210
|
int stdin_pipe[2] = { -1, -1 };
|
2213
2211
|
int stdout_pipe[2] = { -1, -1 };
|
2214
2212
|
int stderr_pipe[2] = { -1, -1 };
|
2213
|
+
#if SPAWN_WAIT_EXEC
|
2215
2214
|
int signal_pipe[2] = { -1, -1 };
|
2216
2215
|
struct pollfd pfd;
|
2216
|
+
#endif
|
2217
2217
|
int status;
|
2218
2218
|
pid_t pid;
|
2219
2219
|
|
@@ -2231,6 +2231,8 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
|
|
2231
2231
|
if (pipe(stdin_pipe) < 0) {
|
2232
2232
|
goto error;
|
2233
2233
|
}
|
2234
|
+
uv__cloexec(stdin_pipe[0], 1);
|
2235
|
+
uv__cloexec(stdin_pipe[1], 1);
|
2234
2236
|
}
|
2235
2237
|
|
2236
2238
|
if (options.stdout_stream) {
|
@@ -2242,6 +2244,8 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
|
|
2242
2244
|
if (pipe(stdout_pipe) < 0) {
|
2243
2245
|
goto error;
|
2244
2246
|
}
|
2247
|
+
uv__cloexec(stdout_pipe[0], 1);
|
2248
|
+
uv__cloexec(stdout_pipe[1], 1);
|
2245
2249
|
}
|
2246
2250
|
|
2247
2251
|
if (options.stderr_stream) {
|
@@ -2253,6 +2257,8 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
|
|
2253
2257
|
if (pipe(stderr_pipe) < 0) {
|
2254
2258
|
goto error;
|
2255
2259
|
}
|
2260
|
+
uv__cloexec(stderr_pipe[0], 1);
|
2261
|
+
uv__cloexec(stderr_pipe[1], 1);
|
2256
2262
|
}
|
2257
2263
|
|
2258
2264
|
/* This pipe is used by the parent to wait until
|
@@ -2275,11 +2281,12 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
|
|
2275
2281
|
* marked close-on-exec. Then, after the call to `fork()`,
|
2276
2282
|
* the parent polls the read end until it sees POLLHUP.
|
2277
2283
|
*/
|
2278
|
-
#
|
2284
|
+
#if SPAWN_WAIT_EXEC
|
2285
|
+
# ifdef HAVE_PIPE2
|
2279
2286
|
if (pipe2(signal_pipe, O_CLOEXEC | O_NONBLOCK) < 0) {
|
2280
2287
|
goto error;
|
2281
2288
|
}
|
2282
|
-
#else
|
2289
|
+
# else
|
2283
2290
|
if (pipe(signal_pipe) < 0) {
|
2284
2291
|
goto error;
|
2285
2292
|
}
|
@@ -2287,13 +2294,16 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
|
|
2287
2294
|
uv__cloexec(signal_pipe[1], 1);
|
2288
2295
|
uv__nonblock(signal_pipe[0], 1);
|
2289
2296
|
uv__nonblock(signal_pipe[1], 1);
|
2297
|
+
# endif
|
2290
2298
|
#endif
|
2291
2299
|
|
2292
2300
|
pid = fork();
|
2293
2301
|
|
2294
2302
|
if (pid == -1) {
|
2303
|
+
#if SPAWN_WAIT_EXEC
|
2295
2304
|
uv__close(signal_pipe[0]);
|
2296
2305
|
uv__close(signal_pipe[1]);
|
2306
|
+
#endif
|
2297
2307
|
environ = save_our_env;
|
2298
2308
|
goto error;
|
2299
2309
|
}
|
@@ -2332,6 +2342,7 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
|
|
2332
2342
|
/* Restore environment. */
|
2333
2343
|
environ = save_our_env;
|
2334
2344
|
|
2345
|
+
#if SPAWN_WAIT_EXEC
|
2335
2346
|
/* POLLHUP signals child has exited or execve()'d. */
|
2336
2347
|
uv__close(signal_pipe[1]);
|
2337
2348
|
do {
|
@@ -2343,11 +2354,13 @@ int uv_spawn(uv_process_t* process, uv_process_options_t options) {
|
|
2343
2354
|
while (status == -1 && (errno == EINTR || errno == ENOMEM));
|
2344
2355
|
|
2345
2356
|
uv__close(signal_pipe[0]);
|
2357
|
+
uv__close(signal_pipe[1]);
|
2346
2358
|
|
2347
2359
|
assert((status == 1)
|
2348
2360
|
&& "poll() on pipe read end failed");
|
2349
2361
|
assert((pfd.revents & POLLHUP) == POLLHUP
|
2350
2362
|
&& "no POLLHUP on pipe read end");
|
2363
|
+
#endif
|
2351
2364
|
|
2352
2365
|
process->pid = pid;
|
2353
2366
|
|
@@ -24,7 +24,9 @@
|
|
24
24
|
|
25
25
|
#include "uv.h"
|
26
26
|
#include "../uv-common.h"
|
27
|
+
|
27
28
|
#include "tree.h"
|
29
|
+
#include "ntdll.h"
|
28
30
|
|
29
31
|
|
30
32
|
/*
|
@@ -234,4 +236,13 @@ void uv_set_sys_error(int sys_errno);
|
|
234
236
|
void uv_set_error(uv_err_code code, int sys_errno);
|
235
237
|
|
236
238
|
|
239
|
+
/*
|
240
|
+
* Windows api functions that we need to retrieve dynamically
|
241
|
+
*/
|
242
|
+
void uv_winapi_init();
|
243
|
+
|
244
|
+
extern sRtlNtStatusToDosError pRtlNtStatusToDosError;
|
245
|
+
extern sNtQueryInformationFile pNtQueryInformationFile;
|
246
|
+
|
247
|
+
|
237
248
|
#endif /* UV_WIN_INTERNAL_H_ */
|
@@ -0,0 +1,130 @@
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
2
|
+
*
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
* furnished to do so, subject to the following conditions:
|
9
|
+
*
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
11
|
+
* all copies or substantial portions of the Software.
|
12
|
+
*
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
19
|
+
* IN THE SOFTWARE.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#ifndef UV_WIN_NTDLL_H_
|
23
|
+
#define UV_WIN_NTDLL_H_
|
24
|
+
|
25
|
+
#include <windows.h>
|
26
|
+
|
27
|
+
|
28
|
+
#ifndef _NTDEF_
|
29
|
+
typedef LONG NTSTATUS;
|
30
|
+
typedef NTSTATUS *PNTSTATUS;
|
31
|
+
#endif
|
32
|
+
|
33
|
+
|
34
|
+
#define STATUS_SUCCESS ((NTSTATUS)0x0)
|
35
|
+
|
36
|
+
|
37
|
+
typedef struct _IO_STATUS_BLOCK {
|
38
|
+
union {
|
39
|
+
NTSTATUS Status;
|
40
|
+
PVOID Pointer;
|
41
|
+
} DUMMYUNIONNAME;
|
42
|
+
ULONG_PTR Information;
|
43
|
+
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
|
44
|
+
|
45
|
+
|
46
|
+
typedef struct _FILE_PIPE_LOCAL_INFORMATION {
|
47
|
+
ULONG NamedPipeType;
|
48
|
+
ULONG NamedPipeConfiguration;
|
49
|
+
ULONG MaximumInstances;
|
50
|
+
ULONG CurrentInstances;
|
51
|
+
ULONG InboundQuota;
|
52
|
+
ULONG ReadDataAvailable;
|
53
|
+
ULONG OutboundQuota;
|
54
|
+
ULONG WriteQuotaAvailable;
|
55
|
+
ULONG NamedPipeState;
|
56
|
+
ULONG NamedPipeEnd;
|
57
|
+
} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
|
58
|
+
|
59
|
+
|
60
|
+
typedef enum _FILE_INFORMATION_CLASS {
|
61
|
+
FileDirectoryInformation = 1,
|
62
|
+
FileFullDirectoryInformation,
|
63
|
+
FileBothDirectoryInformation,
|
64
|
+
FileBasicInformation,
|
65
|
+
FileStandardInformation,
|
66
|
+
FileInternalInformation,
|
67
|
+
FileEaInformation,
|
68
|
+
FileAccessInformation,
|
69
|
+
FileNameInformation,
|
70
|
+
FileRenameInformation,
|
71
|
+
FileLinkInformation,
|
72
|
+
FileNamesInformation,
|
73
|
+
FileDispositionInformation,
|
74
|
+
FilePositionInformation,
|
75
|
+
FileFullEaInformation,
|
76
|
+
FileModeInformation,
|
77
|
+
FileAlignmentInformation,
|
78
|
+
FileAllInformation,
|
79
|
+
FileAllocationInformation,
|
80
|
+
FileEndOfFileInformation,
|
81
|
+
FileAlternateNameInformation,
|
82
|
+
FileStreamInformation,
|
83
|
+
FilePipeInformation,
|
84
|
+
FilePipeLocalInformation,
|
85
|
+
FilePipeRemoteInformation,
|
86
|
+
FileMailslotQueryInformation,
|
87
|
+
FileMailslotSetInformation,
|
88
|
+
FileCompressionInformation,
|
89
|
+
FileObjectIdInformation,
|
90
|
+
FileCompletionInformation,
|
91
|
+
FileMoveClusterInformation,
|
92
|
+
FileQuotaInformation,
|
93
|
+
FileReparsePointInformation,
|
94
|
+
FileNetworkOpenInformation,
|
95
|
+
FileAttributeTagInformation,
|
96
|
+
FileTrackingInformation,
|
97
|
+
FileIdBothDirectoryInformation,
|
98
|
+
FileIdFullDirectoryInformation,
|
99
|
+
FileValidDataLengthInformation,
|
100
|
+
FileShortNameInformation,
|
101
|
+
FileIoCompletionNotificationInformation,
|
102
|
+
FileIoStatusBlockRangeInformation,
|
103
|
+
FileIoPriorityHintInformation,
|
104
|
+
FileSfioReserveInformation,
|
105
|
+
FileSfioVolumeInformation,
|
106
|
+
FileHardLinkInformation,
|
107
|
+
FileProcessIdsUsingFileInformation,
|
108
|
+
FileNormalizedNameInformation,
|
109
|
+
FileNetworkPhysicalNameInformation,
|
110
|
+
FileIdGlobalTxDirectoryInformation,
|
111
|
+
FileIsRemoteDeviceInformation,
|
112
|
+
FileAttributeCacheInformation,
|
113
|
+
FileNumaNodeInformation,
|
114
|
+
FileStandardLinkInformation,
|
115
|
+
FileRemoteProtocolInformation,
|
116
|
+
FileMaximumInformation
|
117
|
+
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
|
118
|
+
|
119
|
+
|
120
|
+
typedef ULONG (NTAPI *sRtlNtStatusToDosError)
|
121
|
+
(NTSTATUS Status);
|
122
|
+
|
123
|
+
typedef NTSTATUS (NTAPI *sNtQueryInformationFile)
|
124
|
+
(HANDLE FileHandle,
|
125
|
+
PIO_STATUS_BLOCK IoStatusBlock,
|
126
|
+
PVOID FileInformation,
|
127
|
+
ULONG Length,
|
128
|
+
FILE_INFORMATION_CLASS FileInformationClass);
|
129
|
+
|
130
|
+
#endif /* UV_WIN_NTDLL_H_ */
|