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
data/README.md
CHANGED
@@ -1,21 +1,171 @@
|
|
1
1
|
# NodeRb
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
NodeJs - JavaScript + Ruby
|
3
|
+
NodeRb = NodeJs - JavaScript + Ruby
|
6
4
|
|
7
5
|
## Status
|
8
6
|
|
9
7
|
It could not be more prototype than it is.
|
10
8
|
|
11
|
-
## Does it work?
|
12
|
-
|
13
|
-
Somehow.
|
14
|
-
|
15
9
|
## Instalation
|
16
10
|
|
17
11
|
gem install noderb
|
18
12
|
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
### Starting loop
|
16
|
+
|
17
|
+
require "noderb"
|
18
|
+
|
19
|
+
NodeRb.start do
|
20
|
+
# Do something
|
21
|
+
end
|
22
|
+
|
23
|
+
### Running code on next tick
|
24
|
+
|
25
|
+
NodeRb.next_tick do
|
26
|
+
# Do something
|
27
|
+
end
|
28
|
+
|
29
|
+
### Connecting to server
|
30
|
+
|
31
|
+
Connects to specific hostname/IP address and port using TCP.
|
32
|
+
|
33
|
+
class Handler
|
34
|
+
|
35
|
+
include NodeRb::Connection
|
36
|
+
|
37
|
+
def on_connect
|
38
|
+
# Do something
|
39
|
+
write_data("Some data")
|
40
|
+
end
|
41
|
+
|
42
|
+
def on_data data
|
43
|
+
# Do something
|
44
|
+
close_connection
|
45
|
+
end
|
46
|
+
|
47
|
+
def on_close
|
48
|
+
# Do something
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
NodeRb.start_client("host", port, Handler.new)
|
54
|
+
|
55
|
+
### Starting server
|
56
|
+
|
57
|
+
Starts new server on specific hostname/IP address and port using TCP.
|
58
|
+
|
59
|
+
class Handler
|
60
|
+
|
61
|
+
include NodeRb::Connection
|
62
|
+
|
63
|
+
def on_connect
|
64
|
+
# Do something
|
65
|
+
write_data("Some data")
|
66
|
+
end
|
67
|
+
|
68
|
+
def on_data data
|
69
|
+
# Do something
|
70
|
+
close_connection
|
71
|
+
end
|
72
|
+
|
73
|
+
def on_close
|
74
|
+
# Do something
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
NodeRb.start_server("host", port, Handler)
|
80
|
+
|
81
|
+
### Starting child process
|
82
|
+
|
83
|
+
Starts new process in specific directory and with specific environment.
|
84
|
+
|
85
|
+
class Handler
|
86
|
+
|
87
|
+
include NodeRb::Process
|
88
|
+
|
89
|
+
def on_start
|
90
|
+
# Do something
|
91
|
+
write_data("Some data")
|
92
|
+
end
|
93
|
+
|
94
|
+
def on_stdout data
|
95
|
+
# Do something
|
96
|
+
kill_process
|
97
|
+
end
|
98
|
+
|
99
|
+
def on_stderr data
|
100
|
+
# Do something
|
101
|
+
end
|
102
|
+
|
103
|
+
def on_exit status, signal
|
104
|
+
# Do something
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
args = ["argument", "list"]
|
109
|
+
env = ["VAR1=value", "VAR2=value"]
|
110
|
+
|
111
|
+
NodeRb.start_process("executable", args, env, "working_directory", Handler.new)
|
112
|
+
|
113
|
+
### Resolving hostnames
|
114
|
+
|
115
|
+
Resolves hostname to IP address.
|
116
|
+
|
117
|
+
NodeRb.resolve("hostname") do |ip|
|
118
|
+
# Do something with the IP address
|
119
|
+
end
|
120
|
+
|
121
|
+
### Scheduling events
|
122
|
+
|
123
|
+
Runs specified code in the future of *timeout* seconds.
|
124
|
+
|
125
|
+
NodeRb.once(timeout) do
|
126
|
+
# Do something
|
127
|
+
end
|
128
|
+
|
129
|
+
Schedules new repeated event that will be called every *timeout* seconds.
|
130
|
+
|
131
|
+
class Handler
|
132
|
+
|
133
|
+
include NodeRb::Timer
|
134
|
+
|
135
|
+
def call
|
136
|
+
# Do something
|
137
|
+
stop_timer
|
138
|
+
end
|
139
|
+
|
140
|
+
end
|
141
|
+
|
142
|
+
NodeRb.repeat(timeout, Handler.new)
|
143
|
+
|
144
|
+
## ToDo
|
145
|
+
|
146
|
+
* File IO
|
147
|
+
* UDP support
|
148
|
+
* Better documentation
|
149
|
+
* Tests
|
150
|
+
* ensure Windows support
|
151
|
+
* lots, lots more
|
152
|
+
|
153
|
+
## Changelog
|
154
|
+
|
155
|
+
### 0.0.4
|
156
|
+
|
157
|
+
* Hostname resolution
|
158
|
+
* Timers support
|
159
|
+
* Huge code refactorings
|
160
|
+
|
161
|
+
## Compatibility
|
162
|
+
|
163
|
+
* Full
|
164
|
+
** Ruby 1.8
|
165
|
+
** Ruby 1.9
|
166
|
+
* Preliminary
|
167
|
+
** Rubinius
|
168
|
+
|
19
169
|
## Dependencies
|
20
170
|
|
21
171
|
No external dependencies except compiler for native extension.
|
@@ -1,8 +1,6 @@
|
|
1
1
|
require "mkmf"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
`cd libuv; git fetch; git reset --hard #{LIBUV}; make; cd ..; cp libuv/uv.a libuv.a`
|
3
|
+
`cd libuv; make; cd ..; cp libuv/uv.a libuv.a`
|
6
4
|
|
7
5
|
dir_config("uv", File.expand_path("../libuv/include", __FILE__), File.expand_path("../libuv", __FILE__))
|
8
6
|
|
@@ -0,0 +1,326 @@
|
|
1
|
+
{
|
2
|
+
'target_defaults': {
|
3
|
+
'default_configuration': 'Debug',
|
4
|
+
'configurations': {
|
5
|
+
# TODO: hoist these out and put them somewhere common, because
|
6
|
+
# RuntimeLibrary MUST MATCH across the entire project
|
7
|
+
'Debug': {
|
8
|
+
'defines': [ 'DEBUG', '_DEBUG' ],
|
9
|
+
'msvs_settings': {
|
10
|
+
'VCCLCompilerTool': {
|
11
|
+
'RuntimeLibrary': 1, # static debug
|
12
|
+
},
|
13
|
+
},
|
14
|
+
},
|
15
|
+
'Release': {
|
16
|
+
'defines': [ 'NDEBUG' ],
|
17
|
+
'msvs_settings': {
|
18
|
+
'VCCLCompilerTool': {
|
19
|
+
'RuntimeLibrary': 0, # static release
|
20
|
+
},
|
21
|
+
},
|
22
|
+
}
|
23
|
+
},
|
24
|
+
'msvs_settings': {
|
25
|
+
'VCCLCompilerTool': {
|
26
|
+
},
|
27
|
+
'VCLibrarianTool': {
|
28
|
+
},
|
29
|
+
'VCLinkerTool': {
|
30
|
+
'GenerateDebugInformation': 'true',
|
31
|
+
},
|
32
|
+
},
|
33
|
+
'conditions': [
|
34
|
+
['OS == "win"', {
|
35
|
+
'defines': [
|
36
|
+
'WIN32'
|
37
|
+
],
|
38
|
+
}]
|
39
|
+
],
|
40
|
+
},
|
41
|
+
|
42
|
+
'targets': [
|
43
|
+
{
|
44
|
+
'target_name': 'uv',
|
45
|
+
'type': 'static_library',
|
46
|
+
'include_dirs': [ 'include' ],
|
47
|
+
'direct_dependent_settings': {
|
48
|
+
'include_dirs': [ 'include' ],
|
49
|
+
},
|
50
|
+
|
51
|
+
'defines': [
|
52
|
+
'HAVE_CONFIG_H'
|
53
|
+
],
|
54
|
+
'sources': [
|
55
|
+
'include/ares.h',
|
56
|
+
'include/ares_version.h',
|
57
|
+
'include/uv.h',
|
58
|
+
'src/uv-common.c',
|
59
|
+
'src/uv-common.h',
|
60
|
+
'src/ares/ares__close_sockets.c',
|
61
|
+
'src/ares/ares__get_hostent.c',
|
62
|
+
'src/ares/ares__read_line.c',
|
63
|
+
'src/ares/ares__timeval.c',
|
64
|
+
'src/ares/ares_cancel.c',
|
65
|
+
'src/ares/ares_data.c',
|
66
|
+
'src/ares/ares_data.h',
|
67
|
+
'src/ares/ares_destroy.c',
|
68
|
+
'src/ares/ares_dns.h',
|
69
|
+
'src/ares/ares_expand_name.c',
|
70
|
+
'src/ares/ares_expand_string.c',
|
71
|
+
'src/ares/ares_fds.c',
|
72
|
+
'src/ares/ares_free_hostent.c',
|
73
|
+
'src/ares/ares_free_string.c',
|
74
|
+
'src/ares/ares_gethostbyaddr.c',
|
75
|
+
'src/ares/ares_gethostbyname.c',
|
76
|
+
'src/ares/ares_getnameinfo.c',
|
77
|
+
'src/ares/ares_getopt.c',
|
78
|
+
'src/ares/ares_getopt.h',
|
79
|
+
'src/ares/ares_getsock.c',
|
80
|
+
'src/ares/ares_init.c',
|
81
|
+
'src/ares/ares_ipv6.h',
|
82
|
+
'src/ares/ares_library_init.c',
|
83
|
+
'src/ares/ares_library_init.h',
|
84
|
+
'src/ares/ares_llist.c',
|
85
|
+
'src/ares/ares_llist.h',
|
86
|
+
'src/ares/ares_mkquery.c',
|
87
|
+
'src/ares/ares_nowarn.c',
|
88
|
+
'src/ares/ares_nowarn.h',
|
89
|
+
'src/ares/ares_options.c',
|
90
|
+
'src/ares/ares_parse_a_reply.c',
|
91
|
+
'src/ares/ares_parse_aaaa_reply.c',
|
92
|
+
'src/ares/ares_parse_mx_reply.c',
|
93
|
+
'src/ares/ares_parse_ns_reply.c',
|
94
|
+
'src/ares/ares_parse_ptr_reply.c',
|
95
|
+
'src/ares/ares_parse_srv_reply.c',
|
96
|
+
'src/ares/ares_parse_txt_reply.c',
|
97
|
+
'src/ares/ares_private.h',
|
98
|
+
'src/ares/ares_process.c',
|
99
|
+
'src/ares/ares_query.c',
|
100
|
+
'src/ares/ares_rules.h',
|
101
|
+
'src/ares/ares_search.c',
|
102
|
+
'src/ares/ares_send.c',
|
103
|
+
'src/ares/ares_setup.h',
|
104
|
+
'src/ares/ares_strcasecmp.c',
|
105
|
+
'src/ares/ares_strcasecmp.h',
|
106
|
+
'src/ares/ares_strdup.c',
|
107
|
+
'src/ares/ares_strdup.h',
|
108
|
+
'src/ares/ares_strerror.c',
|
109
|
+
'src/ares/ares_timeout.c',
|
110
|
+
'src/ares/ares_version.c',
|
111
|
+
'src/ares/ares_writev.c',
|
112
|
+
'src/ares/ares_writev.h',
|
113
|
+
'src/ares/bitncmp.c',
|
114
|
+
'src/ares/bitncmp.h',
|
115
|
+
'src/ares/inet_net_pton.c',
|
116
|
+
'src/ares/inet_net_pton.h',
|
117
|
+
'src/ares/inet_ntop.c',
|
118
|
+
'src/ares/inet_ntop.h',
|
119
|
+
'src/ares/nameser.h',
|
120
|
+
'src/ares/setup_once.h',
|
121
|
+
],
|
122
|
+
'conditions': [
|
123
|
+
[ 'OS=="win"', {
|
124
|
+
'include_dirs': [
|
125
|
+
'src/ares/config_win32'
|
126
|
+
],
|
127
|
+
'sources': [ 'src/ares/windows_port.c' ],
|
128
|
+
'defines': [
|
129
|
+
'_WIN32_WINNT=0x0502',
|
130
|
+
'EIO_STACKSIZE=262144',
|
131
|
+
'_GNU_SOURCE',
|
132
|
+
],
|
133
|
+
'sources': [
|
134
|
+
'include/tree.h',
|
135
|
+
'include/uv-win.h',
|
136
|
+
'src/ares/config_win32/ares_config.h',
|
137
|
+
'src/win/async.c',
|
138
|
+
'src/win/cares.c',
|
139
|
+
'src/win/core.c',
|
140
|
+
'src/win/error.c',
|
141
|
+
'src/win/getaddrinfo.c',
|
142
|
+
'src/win/handle.c',
|
143
|
+
'src/win/internal.h',
|
144
|
+
'src/win/loop-watcher.c',
|
145
|
+
'src/win/ntdll.h',
|
146
|
+
'src/win/pipe.c',
|
147
|
+
'src/win/process.c',
|
148
|
+
'src/win/req.c',
|
149
|
+
'src/win/stdio.c',
|
150
|
+
'src/win/stream.c',
|
151
|
+
'src/win/tcp.c',
|
152
|
+
'src/win/timer.c',
|
153
|
+
'src/win/util.c',
|
154
|
+
'src/win/winapi.c',
|
155
|
+
]
|
156
|
+
}, { # Not Windows i.e. POSIX
|
157
|
+
'cflags': [
|
158
|
+
'-g',
|
159
|
+
'--std=gnu89',
|
160
|
+
'-pedantic',
|
161
|
+
'-Wall',
|
162
|
+
'-Wextra',
|
163
|
+
'-Wno-unused-parameter'
|
164
|
+
],
|
165
|
+
'sources': [
|
166
|
+
'include/eio.h',
|
167
|
+
'include/ev.h',
|
168
|
+
'include/ngx-queue.h',
|
169
|
+
'include/uv-unix.h',
|
170
|
+
'src/uv-eio.c',
|
171
|
+
'src/uv-eio.h',
|
172
|
+
'src/uv-unix.c',
|
173
|
+
'src/ares/config_cygwin/ares_config.h',
|
174
|
+
'src/ares/config_darwin/ares_config.h',
|
175
|
+
'src/ares/config_freebsd/ares_config.h',
|
176
|
+
'src/ares/config_linux/ares_config.h',
|
177
|
+
'src/ares/config_openbsd/ares_config.h',
|
178
|
+
'src/ares/config_sunos/ares_config.h',
|
179
|
+
'src/eio/config_cygwin.h',
|
180
|
+
'src/eio/config_darwin.h',
|
181
|
+
'src/eio/config_freebsd.h',
|
182
|
+
'src/eio/config_linux.h',
|
183
|
+
'src/eio/config_sunos.h',
|
184
|
+
'src/eio/ecb.h',
|
185
|
+
'src/eio/eio.c',
|
186
|
+
'src/eio/xthread.h',
|
187
|
+
'src/ev/config_cygwin.h',
|
188
|
+
'src/ev/config_darwin.h',
|
189
|
+
'src/ev/config_freebsd.h',
|
190
|
+
'src/ev/config_linux.h',
|
191
|
+
'src/ev/config_sunos.h',
|
192
|
+
'src/ev/ev.c',
|
193
|
+
'src/ev/ev_vars.h',
|
194
|
+
'src/ev/ev_wrap.h',
|
195
|
+
'src/ev/event.h',
|
196
|
+
],
|
197
|
+
'include_dirs': [
|
198
|
+
'src/ev'
|
199
|
+
],
|
200
|
+
'defines': [
|
201
|
+
'_LARGEFILE_SOURCE',
|
202
|
+
'_FILE_OFFSET_BITS=64',
|
203
|
+
'_GNU_SOURCE',
|
204
|
+
'EIO_STACKSIZE=262144'
|
205
|
+
],
|
206
|
+
'libraries': [ '-lm' ]
|
207
|
+
}],
|
208
|
+
[ 'OS=="mac"', {
|
209
|
+
'include_dirs': [ 'src/ares/config_darwin' ],
|
210
|
+
'sources': [ 'src/uv-darwin.c' ],
|
211
|
+
'direct_dependent_settings': {
|
212
|
+
'libraries': [ '-framework CoreServices' ],
|
213
|
+
},
|
214
|
+
'defines': [
|
215
|
+
'EV_CONFIG_H="config_darwin.h"',
|
216
|
+
'EIO_CONFIG_H="config_darwin.h"',
|
217
|
+
]
|
218
|
+
}],
|
219
|
+
[ 'OS=="linux"', {
|
220
|
+
'include_dirs': [ 'src/ares/config_linux' ],
|
221
|
+
'sources': [ 'src/uv-linux.c' ],
|
222
|
+
'defines': [
|
223
|
+
'EV_CONFIG_H="config_linux.h"',
|
224
|
+
'EIO_CONFIG_H="config_linux.h"',
|
225
|
+
],
|
226
|
+
'direct_dependent_settings': {
|
227
|
+
'libraries': [ '-lrt' ],
|
228
|
+
},
|
229
|
+
}],
|
230
|
+
# TODO add OS=='sun'
|
231
|
+
]
|
232
|
+
},
|
233
|
+
|
234
|
+
{
|
235
|
+
'target_name': 'run-tests',
|
236
|
+
'type': 'executable',
|
237
|
+
'dependencies': [ 'uv' ],
|
238
|
+
'sources': [
|
239
|
+
'test/echo-server.c',
|
240
|
+
'test/run-tests.c',
|
241
|
+
'test/runner.c',
|
242
|
+
'test/runner.h',
|
243
|
+
'test/task.h',
|
244
|
+
'test/test-async.c',
|
245
|
+
'test/test-callback-stack.c',
|
246
|
+
'test/test-connection-fail.c',
|
247
|
+
'test/test-delayed-accept.c',
|
248
|
+
'test/test-fail-always.c',
|
249
|
+
'test/test-get-currentexe.c',
|
250
|
+
'test/test-getaddrinfo.c',
|
251
|
+
'test/test-gethostbyname.c',
|
252
|
+
'test/test-getsockname.c',
|
253
|
+
'test/test-hrtime.c',
|
254
|
+
'test/test-idle.c',
|
255
|
+
'test/test-list.h',
|
256
|
+
'test/test-loop-handles.c',
|
257
|
+
'test/test-pass-always.c',
|
258
|
+
'test/test-ping-pong.c',
|
259
|
+
'test/test-pipe-bind-error.c',
|
260
|
+
'test/test-ref.c',
|
261
|
+
'test/test-shutdown-eof.c',
|
262
|
+
'test/test-spawn.c',
|
263
|
+
'test/test-tcp-bind-error.c',
|
264
|
+
'test/test-tcp-bind6-error.c',
|
265
|
+
'test/test-tcp-writealot.c',
|
266
|
+
'test/test-timer-again.c',
|
267
|
+
'test/test-timer.c',
|
268
|
+
],
|
269
|
+
'conditions': [
|
270
|
+
[ 'OS=="win"', {
|
271
|
+
'sources': [
|
272
|
+
'test/runner-win.c',
|
273
|
+
'test/runner-win.h'
|
274
|
+
],
|
275
|
+
'libraries': [ 'ws2_32.lib' ]
|
276
|
+
}, { # POSIX
|
277
|
+
'defines': [ '_GNU_SOURCE' ],
|
278
|
+
'ldflags': [ '-pthread' ],
|
279
|
+
'sources': [
|
280
|
+
'test/runner-unix.c',
|
281
|
+
'test/runner-unix.h',
|
282
|
+
]
|
283
|
+
}]
|
284
|
+
]
|
285
|
+
},
|
286
|
+
|
287
|
+
{
|
288
|
+
'target_name': 'run-benchmarks',
|
289
|
+
'type': 'executable',
|
290
|
+
'dependencies': [ 'uv' ],
|
291
|
+
'sources': [
|
292
|
+
'test/benchmark-ares.c',
|
293
|
+
'test/benchmark-getaddrinfo.c',
|
294
|
+
'test/benchmark-list.h',
|
295
|
+
'test/benchmark-ping-pongs.c',
|
296
|
+
'test/benchmark-pound.c',
|
297
|
+
'test/benchmark-pump.c',
|
298
|
+
'test/benchmark-sizes.c',
|
299
|
+
'test/benchmark-spawn.c',
|
300
|
+
'test/dns-server.c',
|
301
|
+
'test/echo-server.c',
|
302
|
+
'test/run-benchmarks.c',
|
303
|
+
'test/runner.c',
|
304
|
+
'test/runner.h',
|
305
|
+
'test/task.h',
|
306
|
+
],
|
307
|
+
'conditions': [
|
308
|
+
[ 'OS=="win"', {
|
309
|
+
'sources': [
|
310
|
+
'test/runner-win.c',
|
311
|
+
'test/runner-win.h',
|
312
|
+
],
|
313
|
+
'libraries': [ 'ws2_32.lib' ]
|
314
|
+
}, { # POSIX
|
315
|
+
'defines': [ '_GNU_SOURCE' ],
|
316
|
+
'ldflags': [ '-pthread' ],
|
317
|
+
'sources': [
|
318
|
+
'test/runner-unix.c',
|
319
|
+
'test/runner-unix.h',
|
320
|
+
]
|
321
|
+
}]
|
322
|
+
]
|
323
|
+
}
|
324
|
+
]
|
325
|
+
}
|
326
|
+
|
@@ -46,7 +46,6 @@ src/uv-common.o: src/uv-common.c include/uv.h include/uv-win.h
|
|
46
46
|
$(CC) $(CFLAGS) -c src/uv-common.c -o src/uv-common.o
|
47
47
|
|
48
48
|
EIO_CPPFLAGS += $(CPPFLAGS)
|
49
|
-
EIO_CPPFLAGS += -DEIO_CONFIG_H=\"$(EIO_CONFIG)\"
|
50
49
|
EIO_CPPFLAGS += -DEIO_STACKSIZE=65536
|
51
50
|
EIO_CPPFLAGS += -D_GNU_SOURCE
|
52
51
|
|
@@ -74,8 +74,14 @@ endif
|
|
74
74
|
|
75
75
|
# Need _GNU_SOURCE for strdup?
|
76
76
|
RUNNER_CFLAGS=$(CFLAGS) -D_GNU_SOURCE
|
77
|
+
RUNNER_LINKFLAGS=$(LINKFLAGS)
|
78
|
+
|
79
|
+
ifeq (SunOS,$(uname_S))
|
80
|
+
RUNNER_LINKFLAGS += -pthreads
|
81
|
+
else
|
82
|
+
RUNNER_LINKFLAGS += -pthread
|
83
|
+
endif
|
77
84
|
|
78
|
-
RUNNER_LINKFLAGS=$(LINKFLAGS) -pthread
|
79
85
|
RUNNER_LIBS=
|
80
86
|
RUNNER_SRC=test/runner-unix.c
|
81
87
|
|
@@ -1,14 +1,21 @@
|
|
1
|
-
@
|
1
|
+
@echo off
|
2
2
|
|
3
3
|
cd %~dp0
|
4
4
|
|
5
|
-
|
6
|
-
|
5
|
+
if exist build\gyp goto have_gyp
|
7
6
|
|
7
|
+
echo svn co http://gyp.googlecode.com/svn/trunk@983 build/gyp
|
8
8
|
svn co http://gyp.googlecode.com/svn/trunk@983 build/gyp
|
9
|
+
if errorlevel 1 goto gyp_install_failed
|
10
|
+
goto have_gyp
|
9
11
|
|
10
|
-
:
|
11
|
-
|
12
|
-
|
12
|
+
:gyp_install_failed
|
13
|
+
echo Failed to download gyp. Make sure you have subversion installed, or
|
14
|
+
echo manually install gyp into %~dp0build\gyp.
|
15
|
+
goto exit
|
13
16
|
|
17
|
+
:have_gyp
|
18
|
+
python gyp_uv
|
19
|
+
if not errorlevel 1 echo Done.
|
14
20
|
|
21
|
+
:exit
|
@@ -5,8 +5,7 @@ import shlex
|
|
5
5
|
import sys
|
6
6
|
|
7
7
|
script_dir = os.path.dirname(__file__)
|
8
|
-
uv_root = os.path.
|
9
|
-
print("uv_root " + uv_root)
|
8
|
+
uv_root = os.path.abspath(script_dir)
|
10
9
|
|
11
10
|
sys.path.insert(0, os.path.join(uv_root, 'build', 'gyp', 'pylib'))
|
12
11
|
import gyp
|
@@ -122,6 +122,7 @@ typedef enum {
|
|
122
122
|
UV_ENOTCONN,
|
123
123
|
UV_ENOTSOCK,
|
124
124
|
UV_ENOTSUP,
|
125
|
+
UV_EPIPE,
|
125
126
|
UV_EPROTO,
|
126
127
|
UV_EPROTONOSUPPORT,
|
127
128
|
UV_EPROTOTYPE,
|
@@ -228,6 +229,10 @@ int uv_is_active(uv_handle_t* handle);
|
|
228
229
|
/*
|
229
230
|
* Request handle to be closed. close_cb will be called asynchronously after
|
230
231
|
* this call. This MUST be called on each handle before memory is released.
|
232
|
+
*
|
233
|
+
* Note that handles that wrap file descriptors are closed immediately but
|
234
|
+
* close_cb will still be deferred to the next iteration of the event loop.
|
235
|
+
* It gives you a chance to free up any resources associated with the handle.
|
231
236
|
*/
|
232
237
|
void uv_close(uv_handle_t* handle, uv_close_cb close_cb);
|
233
238
|
|
@@ -67,7 +67,7 @@
|
|
67
67
|
|
68
68
|
#ifndef ECB_MEMORY_FENCE
|
69
69
|
#if ECB_GCC_VERSION(2,5)
|
70
|
-
#if __x86
|
70
|
+
#if defined(__x86) || defined(__i386)
|
71
71
|
#define ECB_MEMORY_FENCE __asm__ __volatile__ ("lock; orb $0, -1(%%esp)" : : : "memory")
|
72
72
|
#define ECB_MEMORY_FENCE_ACQUIRE ECB_MEMORY_FENCE /* non-lock xchg might be enough */
|
73
73
|
#define ECB_MEMORY_FENCE_RELEASE do { } while (0) /* unlikely to change in future cpus */
|
@@ -110,6 +110,8 @@ static void eio_destroy (eio_req *req);
|
|
110
110
|
|
111
111
|
#ifdef _WIN32
|
112
112
|
|
113
|
+
#include <direct.h>
|
114
|
+
|
113
115
|
#undef PAGESIZE
|
114
116
|
#define PAGESIZE 4096 /* GetSystemInfo? */
|
115
117
|
|
@@ -140,6 +142,9 @@ static void eio_destroy (eio_req *req);
|
|
140
142
|
#define statvfs(path,buf) EIO_ENOSYS ()
|
141
143
|
#define fstatvfs(fd,buf) EIO_ENOSYS ()
|
142
144
|
|
145
|
+
#define getcwd(buf,s) _getcwd(buf, s)
|
146
|
+
#define rmdir(path) _rmdir(path)
|
147
|
+
|
143
148
|
/* rename() uses MoveFile, which fails to overwrite */
|
144
149
|
#define rename(old,neu) eio__rename (old, neu)
|
145
150
|
|
@@ -187,7 +192,9 @@ static void eio_destroy (eio_req *req);
|
|
187
192
|
}
|
188
193
|
|
189
194
|
/* POSIX API only */
|
190
|
-
#
|
195
|
+
#ifndef CreateHardLink
|
196
|
+
# define CreateHardLink(neu,old,flags) 0
|
197
|
+
#endif
|
191
198
|
#define CreateSymbolicLink(neu,old,flags) 0
|
192
199
|
|
193
200
|
struct statvfs
|
@@ -76,6 +76,7 @@ const char* uv_err_name(uv_err_t err) {
|
|
76
76
|
case UV_ENOTCONN: return "ENOTCONN";
|
77
77
|
case UV_ENOTSOCK: return "ENOTSOCK";
|
78
78
|
case UV_ENOTSUP: return "ENOTSUP";
|
79
|
+
case UV_EPIPE: return "EPIPE";
|
79
80
|
case UV_EPROTO: return "EPROTO";
|
80
81
|
case UV_EPROTONOSUPPORT: return "EPROTONOSUPPORT";
|
81
82
|
case UV_EPROTOTYPE: return "EPROTOTYPE";
|