rbuv 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +0 -1
- data/README.md +6 -1
- data/Rakefile +42 -0
- data/deps/libuv/.gitignore +34 -0
- data/deps/libuv/.mailmap +16 -0
- data/deps/libuv/AUTHORS +81 -0
- data/deps/libuv/ChangeLog +45 -0
- data/deps/libuv/LICENSE +41 -0
- data/deps/libuv/Makefile +53 -0
- data/deps/libuv/README.md +118 -0
- data/deps/libuv/build.mk +164 -0
- data/deps/libuv/checksparse.sh +230 -0
- data/deps/libuv/common.gypi +197 -0
- data/deps/libuv/config-mingw.mk +48 -0
- data/deps/libuv/config-unix.mk +167 -0
- data/deps/libuv/gyp_uv +98 -0
- data/deps/libuv/include/uv-private/ngx-queue.h +129 -0
- data/deps/libuv/include/uv-private/stdint-msvc2008.h +247 -0
- data/deps/libuv/include/uv-private/tree.h +768 -0
- data/deps/libuv/include/uv-private/uv-bsd.h +34 -0
- data/deps/libuv/include/uv-private/uv-darwin.h +61 -0
- data/deps/libuv/include/uv-private/uv-linux.h +34 -0
- data/deps/libuv/include/uv-private/uv-sunos.h +44 -0
- data/deps/libuv/include/uv-private/uv-unix.h +332 -0
- data/deps/libuv/include/uv-private/uv-win.h +585 -0
- data/deps/libuv/include/uv.h +1987 -0
- data/deps/libuv/src/fs-poll.c +248 -0
- data/deps/libuv/src/inet.c +298 -0
- data/deps/libuv/src/unix/aix.c +393 -0
- data/deps/libuv/src/unix/async.c +281 -0
- data/deps/libuv/src/unix/core.c +714 -0
- data/deps/libuv/src/unix/cygwin.c +93 -0
- data/deps/libuv/src/unix/darwin-proctitle.m +78 -0
- data/deps/libuv/src/unix/darwin.c +431 -0
- data/deps/libuv/src/unix/dl.c +83 -0
- data/deps/libuv/src/unix/error.c +109 -0
- data/deps/libuv/src/unix/freebsd.c +343 -0
- data/deps/libuv/src/unix/fs.c +869 -0
- data/deps/libuv/src/unix/fsevents.c +299 -0
- data/deps/libuv/src/unix/getaddrinfo.c +159 -0
- data/deps/libuv/src/unix/internal.h +259 -0
- data/deps/libuv/src/unix/kqueue.c +347 -0
- data/deps/libuv/src/unix/linux-core.c +724 -0
- data/deps/libuv/src/unix/linux-inotify.c +236 -0
- data/deps/libuv/src/unix/linux-syscalls.c +388 -0
- data/deps/libuv/src/unix/linux-syscalls.h +150 -0
- data/deps/libuv/src/unix/loop-watcher.c +64 -0
- data/deps/libuv/src/unix/loop.c +114 -0
- data/deps/libuv/src/unix/netbsd.c +353 -0
- data/deps/libuv/src/unix/openbsd.c +304 -0
- data/deps/libuv/src/unix/pipe.c +261 -0
- data/deps/libuv/src/unix/poll.c +108 -0
- data/deps/libuv/src/unix/process.c +501 -0
- data/deps/libuv/src/unix/proctitle.c +103 -0
- data/deps/libuv/src/unix/signal.c +455 -0
- data/deps/libuv/src/unix/stream.c +1380 -0
- data/deps/libuv/src/unix/sunos.c +647 -0
- data/deps/libuv/src/unix/tcp.c +357 -0
- data/deps/libuv/src/unix/thread.c +431 -0
- data/deps/libuv/src/unix/threadpool.c +286 -0
- data/deps/libuv/src/unix/timer.c +153 -0
- data/deps/libuv/src/unix/tty.c +179 -0
- data/deps/libuv/src/unix/udp.c +715 -0
- data/deps/libuv/src/uv-common.c +431 -0
- data/deps/libuv/src/uv-common.h +204 -0
- data/deps/libuv/src/version.c +60 -0
- data/deps/libuv/src/win/async.c +99 -0
- data/deps/libuv/src/win/atomicops-inl.h +56 -0
- data/deps/libuv/src/win/core.c +310 -0
- data/deps/libuv/src/win/dl.c +86 -0
- data/deps/libuv/src/win/error.c +164 -0
- data/deps/libuv/src/win/fs-event.c +506 -0
- data/deps/libuv/src/win/fs.c +1951 -0
- data/deps/libuv/src/win/getaddrinfo.c +365 -0
- data/deps/libuv/src/win/handle-inl.h +164 -0
- data/deps/libuv/src/win/handle.c +153 -0
- data/deps/libuv/src/win/internal.h +346 -0
- data/deps/libuv/src/win/loop-watcher.c +124 -0
- data/deps/libuv/src/win/pipe.c +1656 -0
- data/deps/libuv/src/win/poll.c +615 -0
- data/deps/libuv/src/win/process-stdio.c +503 -0
- data/deps/libuv/src/win/process.c +1048 -0
- data/deps/libuv/src/win/req-inl.h +224 -0
- data/deps/libuv/src/win/req.c +25 -0
- data/deps/libuv/src/win/signal.c +354 -0
- data/deps/libuv/src/win/stream-inl.h +67 -0
- data/deps/libuv/src/win/stream.c +198 -0
- data/deps/libuv/src/win/tcp.c +1422 -0
- data/deps/libuv/src/win/thread.c +666 -0
- data/deps/libuv/src/win/threadpool.c +82 -0
- data/deps/libuv/src/win/timer.c +230 -0
- data/deps/libuv/src/win/tty.c +1857 -0
- data/deps/libuv/src/win/udp.c +744 -0
- data/deps/libuv/src/win/util.c +946 -0
- data/deps/libuv/src/win/winapi.c +152 -0
- data/deps/libuv/src/win/winapi.h +4476 -0
- data/deps/libuv/src/win/winsock.c +560 -0
- data/deps/libuv/src/win/winsock.h +171 -0
- data/deps/libuv/test/benchmark-async-pummel.c +119 -0
- data/deps/libuv/test/benchmark-async.c +139 -0
- data/deps/libuv/test/benchmark-fs-stat.c +136 -0
- data/deps/libuv/test/benchmark-getaddrinfo.c +91 -0
- data/deps/libuv/test/benchmark-list.h +163 -0
- data/deps/libuv/test/benchmark-loop-count.c +90 -0
- data/deps/libuv/test/benchmark-million-async.c +112 -0
- data/deps/libuv/test/benchmark-million-timers.c +77 -0
- data/deps/libuv/test/benchmark-multi-accept.c +432 -0
- data/deps/libuv/test/benchmark-ping-pongs.c +212 -0
- data/deps/libuv/test/benchmark-pound.c +325 -0
- data/deps/libuv/test/benchmark-pump.c +459 -0
- data/deps/libuv/test/benchmark-sizes.c +45 -0
- data/deps/libuv/test/benchmark-spawn.c +163 -0
- data/deps/libuv/test/benchmark-tcp-write-batch.c +141 -0
- data/deps/libuv/test/benchmark-thread.c +64 -0
- data/deps/libuv/test/benchmark-udp-pummel.c +238 -0
- data/deps/libuv/test/blackhole-server.c +118 -0
- data/deps/libuv/test/dns-server.c +329 -0
- data/deps/libuv/test/echo-server.c +384 -0
- data/deps/libuv/test/fixtures/empty_file +0 -0
- data/deps/libuv/test/fixtures/load_error.node +1 -0
- data/deps/libuv/test/run-benchmarks.c +64 -0
- data/deps/libuv/test/run-tests.c +159 -0
- data/deps/libuv/test/runner-unix.c +328 -0
- data/deps/libuv/test/runner-unix.h +36 -0
- data/deps/libuv/test/runner-win.c +318 -0
- data/deps/libuv/test/runner-win.h +43 -0
- data/deps/libuv/test/runner.c +394 -0
- data/deps/libuv/test/runner.h +165 -0
- data/deps/libuv/test/task.h +122 -0
- data/deps/libuv/test/test-active.c +83 -0
- data/deps/libuv/test/test-async.c +136 -0
- data/deps/libuv/test/test-barrier.c +98 -0
- data/deps/libuv/test/test-callback-order.c +77 -0
- data/deps/libuv/test/test-callback-stack.c +204 -0
- data/deps/libuv/test/test-condvar.c +173 -0
- data/deps/libuv/test/test-connection-fail.c +150 -0
- data/deps/libuv/test/test-cwd-and-chdir.c +64 -0
- data/deps/libuv/test/test-delayed-accept.c +189 -0
- data/deps/libuv/test/test-dlerror.c +58 -0
- data/deps/libuv/test/test-embed.c +136 -0
- data/deps/libuv/test/test-error.c +59 -0
- data/deps/libuv/test/test-fail-always.c +29 -0
- data/deps/libuv/test/test-fs-event.c +504 -0
- data/deps/libuv/test/test-fs-poll.c +148 -0
- data/deps/libuv/test/test-fs.c +1899 -0
- data/deps/libuv/test/test-get-currentexe.c +63 -0
- data/deps/libuv/test/test-get-loadavg.c +36 -0
- data/deps/libuv/test/test-get-memory.c +38 -0
- data/deps/libuv/test/test-getaddrinfo.c +120 -0
- data/deps/libuv/test/test-getsockname.c +344 -0
- data/deps/libuv/test/test-hrtime.c +54 -0
- data/deps/libuv/test/test-idle.c +82 -0
- data/deps/libuv/test/test-ipc-send-recv.c +218 -0
- data/deps/libuv/test/test-ipc.c +625 -0
- data/deps/libuv/test/test-list.h +492 -0
- data/deps/libuv/test/test-loop-handles.c +337 -0
- data/deps/libuv/test/test-loop-stop.c +73 -0
- data/deps/libuv/test/test-multiple-listen.c +103 -0
- data/deps/libuv/test/test-mutexes.c +63 -0
- data/deps/libuv/test/test-pass-always.c +28 -0
- data/deps/libuv/test/test-ping-pong.c +250 -0
- data/deps/libuv/test/test-pipe-bind-error.c +144 -0
- data/deps/libuv/test/test-pipe-connect-error.c +98 -0
- data/deps/libuv/test/test-platform-output.c +87 -0
- data/deps/libuv/test/test-poll-close.c +73 -0
- data/deps/libuv/test/test-poll.c +575 -0
- data/deps/libuv/test/test-process-title.c +49 -0
- data/deps/libuv/test/test-ref.c +415 -0
- data/deps/libuv/test/test-run-nowait.c +46 -0
- data/deps/libuv/test/test-run-once.c +49 -0
- data/deps/libuv/test/test-semaphore.c +111 -0
- data/deps/libuv/test/test-shutdown-close.c +105 -0
- data/deps/libuv/test/test-shutdown-eof.c +184 -0
- data/deps/libuv/test/test-signal-multiple-loops.c +270 -0
- data/deps/libuv/test/test-signal.c +152 -0
- data/deps/libuv/test/test-spawn.c +938 -0
- data/deps/libuv/test/test-stdio-over-pipes.c +250 -0
- data/deps/libuv/test/test-tcp-bind-error.c +198 -0
- data/deps/libuv/test/test-tcp-bind6-error.c +159 -0
- data/deps/libuv/test/test-tcp-close-while-connecting.c +81 -0
- data/deps/libuv/test/test-tcp-close.c +130 -0
- data/deps/libuv/test/test-tcp-connect-error-after-write.c +96 -0
- data/deps/libuv/test/test-tcp-connect-error.c +71 -0
- data/deps/libuv/test/test-tcp-connect-timeout.c +86 -0
- data/deps/libuv/test/test-tcp-connect6-error.c +69 -0
- data/deps/libuv/test/test-tcp-flags.c +52 -0
- data/deps/libuv/test/test-tcp-open.c +175 -0
- data/deps/libuv/test/test-tcp-read-stop.c +73 -0
- data/deps/libuv/test/test-tcp-shutdown-after-write.c +132 -0
- data/deps/libuv/test/test-tcp-unexpected-read.c +114 -0
- data/deps/libuv/test/test-tcp-write-to-half-open-connection.c +136 -0
- data/deps/libuv/test/test-tcp-writealot.c +171 -0
- data/deps/libuv/test/test-thread.c +183 -0
- data/deps/libuv/test/test-threadpool-cancel.c +311 -0
- data/deps/libuv/test/test-threadpool.c +77 -0
- data/deps/libuv/test/test-timer-again.c +142 -0
- data/deps/libuv/test/test-timer.c +266 -0
- data/deps/libuv/test/test-tty.c +111 -0
- data/deps/libuv/test/test-udp-dgram-too-big.c +87 -0
- data/deps/libuv/test/test-udp-ipv6.c +158 -0
- data/deps/libuv/test/test-udp-multicast-join.c +140 -0
- data/deps/libuv/test/test-udp-multicast-ttl.c +87 -0
- data/deps/libuv/test/test-udp-open.c +154 -0
- data/deps/libuv/test/test-udp-options.c +87 -0
- data/deps/libuv/test/test-udp-send-and-recv.c +210 -0
- data/deps/libuv/test/test-util.c +97 -0
- data/deps/libuv/test/test-walk-handles.c +78 -0
- data/deps/libuv/uv.gyp +431 -0
- data/deps/libuv/vcbuild.bat +128 -0
- data/ext/rbuv/debug.h +27 -0
- data/ext/rbuv/error.c +7 -0
- data/ext/rbuv/error.h +10 -0
- data/ext/rbuv/extconf.rb +35 -0
- data/ext/rbuv/handle.c +40 -0
- data/ext/rbuv/handle.h +14 -0
- data/ext/rbuv/libuv.mk +12 -0
- data/ext/rbuv/loop.c +50 -0
- data/ext/rbuv/loop.h +13 -0
- data/ext/rbuv/rbuv.c +15 -0
- data/ext/rbuv/rbuv.h +27 -0
- data/ext/rbuv/timer.c +133 -0
- data/ext/rbuv/timer.h +13 -0
- data/lib/rbuv/timer.rb +7 -0
- data/lib/rbuv/version.rb +1 -1
- data/lib/rbuv.rb +24 -2
- data/rbuv.gemspec +5 -1
- data/spec/spec_helper.rb +22 -0
- data/spec/timer_spec.rb +144 -0
- metadata +278 -9
@@ -0,0 +1,97 @@
|
|
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
|
+
#include "uv.h"
|
23
|
+
#include "task.h"
|
24
|
+
|
25
|
+
#include <string.h>
|
26
|
+
|
27
|
+
#define memeq(a, b, c) (memcmp((a), (b), (c)) == 0)
|
28
|
+
|
29
|
+
|
30
|
+
TEST_IMPL(strlcpy) {
|
31
|
+
size_t r;
|
32
|
+
|
33
|
+
{
|
34
|
+
char dst[2] = "A";
|
35
|
+
r = uv_strlcpy(dst, "", 0);
|
36
|
+
ASSERT(r == 0);
|
37
|
+
ASSERT(memeq(dst, "A", 1));
|
38
|
+
}
|
39
|
+
|
40
|
+
{
|
41
|
+
char dst[2] = "A";
|
42
|
+
r = uv_strlcpy(dst, "B", 1);
|
43
|
+
ASSERT(r == 0);
|
44
|
+
ASSERT(memeq(dst, "", 1));
|
45
|
+
}
|
46
|
+
|
47
|
+
{
|
48
|
+
char dst[2] = "A";
|
49
|
+
r = uv_strlcpy(dst, "B", 2);
|
50
|
+
ASSERT(r == 1);
|
51
|
+
ASSERT(memeq(dst, "B", 2));
|
52
|
+
}
|
53
|
+
|
54
|
+
{
|
55
|
+
char dst[3] = "AB";
|
56
|
+
r = uv_strlcpy(dst, "CD", 3);
|
57
|
+
ASSERT(r == 2);
|
58
|
+
ASSERT(memeq(dst, "CD", 3));
|
59
|
+
}
|
60
|
+
|
61
|
+
return 0;
|
62
|
+
}
|
63
|
+
|
64
|
+
|
65
|
+
TEST_IMPL(strlcat) {
|
66
|
+
size_t r;
|
67
|
+
|
68
|
+
{
|
69
|
+
char dst[2] = "A";
|
70
|
+
r = uv_strlcat(dst, "B", 1);
|
71
|
+
ASSERT(r == 1);
|
72
|
+
ASSERT(memeq(dst, "A", 2));
|
73
|
+
}
|
74
|
+
|
75
|
+
{
|
76
|
+
char dst[2] = "A";
|
77
|
+
r = uv_strlcat(dst, "B", 2);
|
78
|
+
ASSERT(r == 1);
|
79
|
+
ASSERT(memeq(dst, "A", 2));
|
80
|
+
}
|
81
|
+
|
82
|
+
{
|
83
|
+
char dst[3] = "A";
|
84
|
+
r = uv_strlcat(dst, "B", 3);
|
85
|
+
ASSERT(r == 2);
|
86
|
+
ASSERT(memeq(dst, "AB", 3));
|
87
|
+
}
|
88
|
+
|
89
|
+
{
|
90
|
+
char dst[5] = "AB";
|
91
|
+
r = uv_strlcat(dst, "CD", 5);
|
92
|
+
ASSERT(r == 4);
|
93
|
+
ASSERT(memeq(dst, "ABCD", 5));
|
94
|
+
}
|
95
|
+
|
96
|
+
return 0;
|
97
|
+
}
|
@@ -0,0 +1,78 @@
|
|
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
|
+
#include "uv.h"
|
23
|
+
#include "task.h"
|
24
|
+
|
25
|
+
#include <stdio.h>
|
26
|
+
#include <stdlib.h>
|
27
|
+
|
28
|
+
static char magic_cookie[] = "magic cookie";
|
29
|
+
static int seen_timer_handle;
|
30
|
+
static uv_timer_t timer;
|
31
|
+
|
32
|
+
|
33
|
+
static void walk_cb(uv_handle_t* handle, void* arg) {
|
34
|
+
ASSERT(arg == (void*)magic_cookie);
|
35
|
+
|
36
|
+
if (handle == (uv_handle_t*)&timer) {
|
37
|
+
seen_timer_handle++;
|
38
|
+
} else {
|
39
|
+
ASSERT(0 && "unexpected handle");
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
static void timer_cb(uv_timer_t* handle, int status) {
|
45
|
+
ASSERT(handle == &timer);
|
46
|
+
ASSERT(status == 0);
|
47
|
+
|
48
|
+
uv_walk(handle->loop, walk_cb, magic_cookie);
|
49
|
+
uv_close((uv_handle_t*)handle, NULL);
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
TEST_IMPL(walk_handles) {
|
54
|
+
uv_loop_t* loop;
|
55
|
+
int r;
|
56
|
+
|
57
|
+
loop = uv_default_loop();
|
58
|
+
|
59
|
+
r = uv_timer_init(loop, &timer);
|
60
|
+
ASSERT(r == 0);
|
61
|
+
|
62
|
+
r = uv_timer_start(&timer, timer_cb, 1, 0);
|
63
|
+
ASSERT(r == 0);
|
64
|
+
|
65
|
+
/* Start event loop, expect to see the timer handle in walk_cb. */
|
66
|
+
ASSERT(seen_timer_handle == 0);
|
67
|
+
r = uv_run(loop, UV_RUN_DEFAULT);
|
68
|
+
ASSERT(r == 0);
|
69
|
+
ASSERT(seen_timer_handle == 1);
|
70
|
+
|
71
|
+
/* Loop is finished, walk_cb should not see our timer handle. */
|
72
|
+
seen_timer_handle = 0;
|
73
|
+
uv_walk(loop, walk_cb, magic_cookie);
|
74
|
+
ASSERT(seen_timer_handle == 0);
|
75
|
+
|
76
|
+
MAKE_VALGRIND_HAPPY();
|
77
|
+
return 0;
|
78
|
+
}
|
data/deps/libuv/uv.gyp
ADDED
@@ -0,0 +1,431 @@
|
|
1
|
+
{
|
2
|
+
'target_defaults': {
|
3
|
+
'conditions': [
|
4
|
+
['OS != "win"', {
|
5
|
+
'defines': [
|
6
|
+
'_LARGEFILE_SOURCE',
|
7
|
+
'_FILE_OFFSET_BITS=64',
|
8
|
+
'_GNU_SOURCE',
|
9
|
+
],
|
10
|
+
'conditions': [
|
11
|
+
['OS=="solaris"', {
|
12
|
+
'cflags': [ '-pthreads' ],
|
13
|
+
}, {
|
14
|
+
'cflags': [ '-pthread' ],
|
15
|
+
}],
|
16
|
+
],
|
17
|
+
}],
|
18
|
+
],
|
19
|
+
},
|
20
|
+
|
21
|
+
'targets': [
|
22
|
+
{
|
23
|
+
'target_name': 'libuv',
|
24
|
+
'type': '<(library)',
|
25
|
+
'include_dirs': [
|
26
|
+
'include',
|
27
|
+
'include/uv-private',
|
28
|
+
'src/',
|
29
|
+
],
|
30
|
+
'direct_dependent_settings': {
|
31
|
+
'include_dirs': [ 'include' ],
|
32
|
+
'conditions': [
|
33
|
+
['OS != "win"', {
|
34
|
+
'defines': [
|
35
|
+
'_LARGEFILE_SOURCE',
|
36
|
+
'_FILE_OFFSET_BITS=64',
|
37
|
+
],
|
38
|
+
}],
|
39
|
+
['OS == "mac"', {
|
40
|
+
'defines': [ '_DARWIN_USE_64_BIT_INODE=1' ],
|
41
|
+
}],
|
42
|
+
['OS == "linux"', {
|
43
|
+
'defines': [ '_POSIX_C_SOURCE=200112' ],
|
44
|
+
}],
|
45
|
+
],
|
46
|
+
},
|
47
|
+
'defines': [
|
48
|
+
'HAVE_CONFIG_H'
|
49
|
+
],
|
50
|
+
'sources': [
|
51
|
+
'common.gypi',
|
52
|
+
'include/uv.h',
|
53
|
+
'include/uv-private/ngx-queue.h',
|
54
|
+
'include/uv-private/tree.h',
|
55
|
+
'src/fs-poll.c',
|
56
|
+
'src/inet.c',
|
57
|
+
'src/uv-common.c',
|
58
|
+
'src/uv-common.h',
|
59
|
+
'src/version.c'
|
60
|
+
],
|
61
|
+
'conditions': [
|
62
|
+
[ 'OS=="win"', {
|
63
|
+
'defines': [
|
64
|
+
'_WIN32_WINNT=0x0600',
|
65
|
+
'_GNU_SOURCE',
|
66
|
+
],
|
67
|
+
'sources': [
|
68
|
+
'include/uv-private/uv-win.h',
|
69
|
+
'src/win/async.c',
|
70
|
+
'src/win/atomicops-inl.h',
|
71
|
+
'src/win/core.c',
|
72
|
+
'src/win/dl.c',
|
73
|
+
'src/win/error.c',
|
74
|
+
'src/win/fs.c',
|
75
|
+
'src/win/fs-event.c',
|
76
|
+
'src/win/getaddrinfo.c',
|
77
|
+
'src/win/handle.c',
|
78
|
+
'src/win/handle-inl.h',
|
79
|
+
'src/win/internal.h',
|
80
|
+
'src/win/loop-watcher.c',
|
81
|
+
'src/win/pipe.c',
|
82
|
+
'src/win/thread.c',
|
83
|
+
'src/win/poll.c',
|
84
|
+
'src/win/process.c',
|
85
|
+
'src/win/process-stdio.c',
|
86
|
+
'src/win/req.c',
|
87
|
+
'src/win/req-inl.h',
|
88
|
+
'src/win/signal.c',
|
89
|
+
'src/win/stream.c',
|
90
|
+
'src/win/stream-inl.h',
|
91
|
+
'src/win/tcp.c',
|
92
|
+
'src/win/tty.c',
|
93
|
+
'src/win/threadpool.c',
|
94
|
+
'src/win/timer.c',
|
95
|
+
'src/win/udp.c',
|
96
|
+
'src/win/util.c',
|
97
|
+
'src/win/winapi.c',
|
98
|
+
'src/win/winapi.h',
|
99
|
+
'src/win/winsock.c',
|
100
|
+
'src/win/winsock.h',
|
101
|
+
],
|
102
|
+
'link_settings': {
|
103
|
+
'libraries': [
|
104
|
+
'-ladvapi32.lib',
|
105
|
+
'-liphlpapi.lib',
|
106
|
+
'-lpsapi.lib',
|
107
|
+
'-lshell32.lib',
|
108
|
+
'-lws2_32.lib'
|
109
|
+
],
|
110
|
+
},
|
111
|
+
}, { # Not Windows i.e. POSIX
|
112
|
+
'cflags': [
|
113
|
+
'-g',
|
114
|
+
'--std=gnu89',
|
115
|
+
'-pedantic',
|
116
|
+
'-Wall',
|
117
|
+
'-Wextra',
|
118
|
+
'-Wno-unused-parameter',
|
119
|
+
],
|
120
|
+
'sources': [
|
121
|
+
'include/uv-private/uv-unix.h',
|
122
|
+
'include/uv-private/uv-linux.h',
|
123
|
+
'include/uv-private/uv-sunos.h',
|
124
|
+
'include/uv-private/uv-darwin.h',
|
125
|
+
'include/uv-private/uv-bsd.h',
|
126
|
+
'src/unix/async.c',
|
127
|
+
'src/unix/core.c',
|
128
|
+
'src/unix/dl.c',
|
129
|
+
'src/unix/error.c',
|
130
|
+
'src/unix/fs.c',
|
131
|
+
'src/unix/getaddrinfo.c',
|
132
|
+
'src/unix/internal.h',
|
133
|
+
'src/unix/loop.c',
|
134
|
+
'src/unix/loop-watcher.c',
|
135
|
+
'src/unix/pipe.c',
|
136
|
+
'src/unix/poll.c',
|
137
|
+
'src/unix/process.c',
|
138
|
+
'src/unix/signal.c',
|
139
|
+
'src/unix/stream.c',
|
140
|
+
'src/unix/tcp.c',
|
141
|
+
'src/unix/thread.c',
|
142
|
+
'src/unix/threadpool.c',
|
143
|
+
'src/unix/timer.c',
|
144
|
+
'src/unix/tty.c',
|
145
|
+
'src/unix/udp.c',
|
146
|
+
],
|
147
|
+
'link_settings': {
|
148
|
+
'libraries': [ '-lm' ],
|
149
|
+
'conditions': [
|
150
|
+
['OS=="solaris"', {
|
151
|
+
'ldflags': [ '-pthreads' ],
|
152
|
+
}, {
|
153
|
+
'ldflags': [ '-pthread' ],
|
154
|
+
}],
|
155
|
+
],
|
156
|
+
},
|
157
|
+
'conditions': [
|
158
|
+
['"<(library)" == "shared_library"', {
|
159
|
+
'cflags': [ '-fPIC' ],
|
160
|
+
}],
|
161
|
+
],
|
162
|
+
}],
|
163
|
+
[ 'OS=="linux" or OS=="mac"', {
|
164
|
+
'sources': [ 'src/unix/proctitle.c' ],
|
165
|
+
}],
|
166
|
+
[ 'OS=="mac"', {
|
167
|
+
'sources': [
|
168
|
+
'src/unix/darwin.c',
|
169
|
+
'src/unix/fsevents.c',
|
170
|
+
'src/unix/darwin-proctitle.m',
|
171
|
+
],
|
172
|
+
'link_settings': {
|
173
|
+
'libraries': [
|
174
|
+
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
|
175
|
+
'$(SDKROOT)/System/Library/Frameworks/CoreServices.framework',
|
176
|
+
'$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework',
|
177
|
+
],
|
178
|
+
},
|
179
|
+
'defines': [
|
180
|
+
'_DARWIN_USE_64_BIT_INODE=1',
|
181
|
+
]
|
182
|
+
}],
|
183
|
+
[ 'OS!="mac"', {
|
184
|
+
# Enable on all platforms except OS X. The antique gcc/clang that
|
185
|
+
# ships with Xcode emits waaaay too many false positives.
|
186
|
+
'cflags': [ '-Wstrict-aliasing' ],
|
187
|
+
}],
|
188
|
+
[ 'OS=="linux"', {
|
189
|
+
'sources': [
|
190
|
+
'src/unix/linux-core.c',
|
191
|
+
'src/unix/linux-inotify.c',
|
192
|
+
'src/unix/linux-syscalls.c',
|
193
|
+
'src/unix/linux-syscalls.h',
|
194
|
+
],
|
195
|
+
'link_settings': {
|
196
|
+
'libraries': [ '-ldl', '-lrt' ],
|
197
|
+
},
|
198
|
+
}],
|
199
|
+
[ 'OS=="solaris"', {
|
200
|
+
'sources': [ 'src/unix/sunos.c' ],
|
201
|
+
'defines': [
|
202
|
+
'__EXTENSIONS__',
|
203
|
+
'_XOPEN_SOURCE=500',
|
204
|
+
],
|
205
|
+
'link_settings': {
|
206
|
+
'libraries': [
|
207
|
+
'-lkstat',
|
208
|
+
'-lnsl',
|
209
|
+
'-lsendfile',
|
210
|
+
'-lsocket',
|
211
|
+
],
|
212
|
+
},
|
213
|
+
}],
|
214
|
+
[ 'OS=="aix"', {
|
215
|
+
'include_dirs': [ 'src/ares/config_aix' ],
|
216
|
+
'sources': [ 'src/unix/aix.c' ],
|
217
|
+
'defines': [
|
218
|
+
'_ALL_SOURCE',
|
219
|
+
'_XOPEN_SOURCE=500',
|
220
|
+
],
|
221
|
+
'link_settings': {
|
222
|
+
'libraries': [
|
223
|
+
'-lperfstat',
|
224
|
+
],
|
225
|
+
},
|
226
|
+
}],
|
227
|
+
[ 'OS=="freebsd" or OS=="dragonflybsd"', {
|
228
|
+
'sources': [ 'src/unix/freebsd.c' ],
|
229
|
+
'link_settings': {
|
230
|
+
'libraries': [
|
231
|
+
'-lkvm',
|
232
|
+
],
|
233
|
+
},
|
234
|
+
}],
|
235
|
+
[ 'OS=="openbsd"', {
|
236
|
+
'sources': [ 'src/unix/openbsd.c' ],
|
237
|
+
}],
|
238
|
+
[ 'OS=="netbsd"', {
|
239
|
+
'sources': [ 'src/unix/netbsd.c' ],
|
240
|
+
'link_settings': {
|
241
|
+
'libraries': [
|
242
|
+
'-lkvm',
|
243
|
+
],
|
244
|
+
},
|
245
|
+
}],
|
246
|
+
[ 'OS in "mac freebsd dragonflybsd openbsd netbsd".split()', {
|
247
|
+
'sources': [ 'src/unix/kqueue.c' ],
|
248
|
+
}],
|
249
|
+
['library=="shared_library"', {
|
250
|
+
'defines': [ 'BUILDING_UV_SHARED=1' ]
|
251
|
+
}]
|
252
|
+
]
|
253
|
+
},
|
254
|
+
|
255
|
+
{
|
256
|
+
'target_name': 'run-tests',
|
257
|
+
'type': 'executable',
|
258
|
+
'dependencies': [ 'libuv' ],
|
259
|
+
'sources': [
|
260
|
+
'test/blackhole-server.c',
|
261
|
+
'test/echo-server.c',
|
262
|
+
'test/run-tests.c',
|
263
|
+
'test/runner.c',
|
264
|
+
'test/runner.h',
|
265
|
+
'test/test-get-loadavg.c',
|
266
|
+
'test/task.h',
|
267
|
+
'test/test-util.c',
|
268
|
+
'test/test-active.c',
|
269
|
+
'test/test-async.c',
|
270
|
+
'test/test-callback-stack.c',
|
271
|
+
'test/test-callback-order.c',
|
272
|
+
'test/test-connection-fail.c',
|
273
|
+
'test/test-cwd-and-chdir.c',
|
274
|
+
'test/test-delayed-accept.c',
|
275
|
+
'test/test-error.c',
|
276
|
+
'test/test-embed.c',
|
277
|
+
'test/test-fail-always.c',
|
278
|
+
'test/test-fs.c',
|
279
|
+
'test/test-fs-event.c',
|
280
|
+
'test/test-get-currentexe.c',
|
281
|
+
'test/test-get-memory.c',
|
282
|
+
'test/test-getaddrinfo.c',
|
283
|
+
'test/test-getsockname.c',
|
284
|
+
'test/test-hrtime.c',
|
285
|
+
'test/test-idle.c',
|
286
|
+
'test/test-ipc.c',
|
287
|
+
'test/test-ipc-send-recv.c',
|
288
|
+
'test/test-list.h',
|
289
|
+
'test/test-loop-handles.c',
|
290
|
+
'test/test-loop-stop.c',
|
291
|
+
'test/test-walk-handles.c',
|
292
|
+
'test/test-multiple-listen.c',
|
293
|
+
'test/test-pass-always.c',
|
294
|
+
'test/test-ping-pong.c',
|
295
|
+
'test/test-pipe-bind-error.c',
|
296
|
+
'test/test-pipe-connect-error.c',
|
297
|
+
'test/test-platform-output.c',
|
298
|
+
'test/test-poll.c',
|
299
|
+
'test/test-poll-close.c',
|
300
|
+
'test/test-process-title.c',
|
301
|
+
'test/test-ref.c',
|
302
|
+
'test/test-run-nowait.c',
|
303
|
+
'test/test-run-once.c',
|
304
|
+
'test/test-semaphore.c',
|
305
|
+
'test/test-shutdown-close.c',
|
306
|
+
'test/test-shutdown-eof.c',
|
307
|
+
'test/test-signal.c',
|
308
|
+
'test/test-signal-multiple-loops.c',
|
309
|
+
'test/test-spawn.c',
|
310
|
+
'test/test-fs-poll.c',
|
311
|
+
'test/test-stdio-over-pipes.c',
|
312
|
+
'test/test-tcp-bind-error.c',
|
313
|
+
'test/test-tcp-bind6-error.c',
|
314
|
+
'test/test-tcp-close.c',
|
315
|
+
'test/test-tcp-close-while-connecting.c',
|
316
|
+
'test/test-tcp-connect-error-after-write.c',
|
317
|
+
'test/test-tcp-shutdown-after-write.c',
|
318
|
+
'test/test-tcp-flags.c',
|
319
|
+
'test/test-tcp-connect-error.c',
|
320
|
+
'test/test-tcp-connect-timeout.c',
|
321
|
+
'test/test-tcp-connect6-error.c',
|
322
|
+
'test/test-tcp-open.c',
|
323
|
+
'test/test-tcp-write-to-half-open-connection.c',
|
324
|
+
'test/test-tcp-writealot.c',
|
325
|
+
'test/test-tcp-unexpected-read.c',
|
326
|
+
'test/test-tcp-read-stop.c',
|
327
|
+
'test/test-threadpool.c',
|
328
|
+
'test/test-threadpool-cancel.c',
|
329
|
+
'test/test-mutexes.c',
|
330
|
+
'test/test-thread.c',
|
331
|
+
'test/test-barrier.c',
|
332
|
+
'test/test-condvar.c',
|
333
|
+
'test/test-timer-again.c',
|
334
|
+
'test/test-timer.c',
|
335
|
+
'test/test-tty.c',
|
336
|
+
'test/test-udp-dgram-too-big.c',
|
337
|
+
'test/test-udp-ipv6.c',
|
338
|
+
'test/test-udp-open.c',
|
339
|
+
'test/test-udp-options.c',
|
340
|
+
'test/test-udp-send-and-recv.c',
|
341
|
+
'test/test-udp-multicast-join.c',
|
342
|
+
'test/test-dlerror.c',
|
343
|
+
'test/test-udp-multicast-ttl.c',
|
344
|
+
],
|
345
|
+
'conditions': [
|
346
|
+
[ 'OS=="win"', {
|
347
|
+
'sources': [
|
348
|
+
'test/runner-win.c',
|
349
|
+
'test/runner-win.h'
|
350
|
+
],
|
351
|
+
'libraries': [ 'ws2_32.lib' ]
|
352
|
+
}, { # POSIX
|
353
|
+
'defines': [ '_GNU_SOURCE' ],
|
354
|
+
'sources': [
|
355
|
+
'test/runner-unix.c',
|
356
|
+
'test/runner-unix.h',
|
357
|
+
],
|
358
|
+
}],
|
359
|
+
[ 'OS=="solaris"', { # make test-fs.c compile, needs _POSIX_C_SOURCE
|
360
|
+
'defines': [
|
361
|
+
'__EXTENSIONS__',
|
362
|
+
'_XOPEN_SOURCE=500',
|
363
|
+
],
|
364
|
+
}],
|
365
|
+
[ 'OS=="aix"', { # make test-fs.c compile, needs _POSIX_C_SOURCE
|
366
|
+
'defines': [
|
367
|
+
'_ALL_SOURCE',
|
368
|
+
'_XOPEN_SOURCE=500',
|
369
|
+
],
|
370
|
+
}],
|
371
|
+
],
|
372
|
+
'msvs-settings': {
|
373
|
+
'VCLinkerTool': {
|
374
|
+
'SubSystem': 1, # /subsystem:console
|
375
|
+
},
|
376
|
+
},
|
377
|
+
},
|
378
|
+
|
379
|
+
{
|
380
|
+
'target_name': 'run-benchmarks',
|
381
|
+
'type': 'executable',
|
382
|
+
'dependencies': [ 'libuv' ],
|
383
|
+
'sources': [
|
384
|
+
'test/benchmark-async.c',
|
385
|
+
'test/benchmark-async-pummel.c',
|
386
|
+
'test/benchmark-fs-stat.c',
|
387
|
+
'test/benchmark-getaddrinfo.c',
|
388
|
+
'test/benchmark-list.h',
|
389
|
+
'test/benchmark-loop-count.c',
|
390
|
+
'test/benchmark-million-async.c',
|
391
|
+
'test/benchmark-million-timers.c',
|
392
|
+
'test/benchmark-multi-accept.c',
|
393
|
+
'test/benchmark-ping-pongs.c',
|
394
|
+
'test/benchmark-pound.c',
|
395
|
+
'test/benchmark-pump.c',
|
396
|
+
'test/benchmark-sizes.c',
|
397
|
+
'test/benchmark-spawn.c',
|
398
|
+
'test/benchmark-thread.c',
|
399
|
+
'test/benchmark-tcp-write-batch.c',
|
400
|
+
'test/benchmark-udp-pummel.c',
|
401
|
+
'test/dns-server.c',
|
402
|
+
'test/echo-server.c',
|
403
|
+
'test/blackhole-server.c',
|
404
|
+
'test/run-benchmarks.c',
|
405
|
+
'test/runner.c',
|
406
|
+
'test/runner.h',
|
407
|
+
'test/task.h',
|
408
|
+
],
|
409
|
+
'conditions': [
|
410
|
+
[ 'OS=="win"', {
|
411
|
+
'sources': [
|
412
|
+
'test/runner-win.c',
|
413
|
+
'test/runner-win.h',
|
414
|
+
],
|
415
|
+
'libraries': [ 'ws2_32.lib' ]
|
416
|
+
}, { # POSIX
|
417
|
+
'defines': [ '_GNU_SOURCE' ],
|
418
|
+
'sources': [
|
419
|
+
'test/runner-unix.c',
|
420
|
+
'test/runner-unix.h',
|
421
|
+
]
|
422
|
+
}]
|
423
|
+
],
|
424
|
+
'msvs-settings': {
|
425
|
+
'VCLinkerTool': {
|
426
|
+
'SubSystem': 1, # /subsystem:console
|
427
|
+
},
|
428
|
+
},
|
429
|
+
}
|
430
|
+
]
|
431
|
+
}
|