uvrb 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitmodules +1 -1
- data/.travis.yml +6 -3
- data/README.rdoc +5 -10
- data/Rakefile +4 -4
- data/features/async.feature +2 -2
- data/features/idle.feature +1 -1
- data/features/pipe.feature +3 -4
- data/features/step_definitions/additional_cli_steps.rb +8 -6
- data/lib/uv.rb +222 -195
- data/lib/uv/assertions.rb +13 -7
- data/lib/uv/handle.rb +7 -4
- data/lib/uv/loop.rb +25 -61
- data/lib/uv/pipe.rb +10 -0
- data/lib/uv/resource.rb +1 -1
- data/lib/uv/tasks.rb +3 -3
- data/lib/uv/tasks/mac.rb +2 -2
- data/lib/uv/tasks/unix.rb +1 -1
- data/lib/uv/tasks/win.rb +11 -2
- data/lib/uv/timer.rb +1 -1
- data/lib/uv/types.rb +48 -69
- data/lib/uv/types/windows.rb +12 -0
- data/lib/uv/version.rb +1 -1
- data/lib/uv/work.rb +41 -0
- data/spec/uv/loop_spec.rb +2 -11
- data/spec/uv/pipe_spec.rb +10 -2
- data/uvrb.gemspec +36 -9
- metadata +20 -17
data/.gitmodules
CHANGED
data/.travis.yml
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 1.9.
|
4
|
-
-
|
3
|
+
- "1.9.3"
|
4
|
+
- "2.0.0"
|
5
|
+
- rbx-19mode
|
6
|
+
# - jruby-19mode # jruby loads too slowly to run the cucumber tests properly.
|
7
|
+
# - jruby-20mode # so I am ignoring jruby builds on travis
|
5
8
|
branches:
|
6
9
|
only:
|
7
10
|
- master
|
@@ -10,4 +13,4 @@ before_install:
|
|
10
13
|
- git submodule update --init --recursive
|
11
14
|
- echo "yes" | gem uninstall ffi -a
|
12
15
|
before_script:
|
13
|
-
- rake
|
16
|
+
- rake compile
|
data/README.rdoc
CHANGED
@@ -36,16 +36,10 @@ or
|
|
36
36
|
cd ...
|
37
37
|
bundle install
|
38
38
|
|
39
|
-
|
39
|
+
=== Prerequisites
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
git submodule update --init
|
44
|
-
rake libuv
|
45
|
-
|
46
|
-
Or to compile libuv on mac, you can install provided Homebrew formula by running:
|
47
|
-
|
48
|
-
brew install Formula/libuv.rb --HEAD
|
41
|
+
* The installation requires subversion to be installed on your system and available on the PATH
|
42
|
+
* Windows users will require a copy of Visual Studio 2010 or later installed. {Express}[http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products] works fine.
|
49
43
|
|
50
44
|
== What's supported
|
51
45
|
|
@@ -62,9 +56,10 @@ Or to compile libuv on mac, you can install provided Homebrew formula by running
|
|
62
56
|
* File
|
63
57
|
* FSEvent
|
64
58
|
* Errors
|
59
|
+
* work queue
|
65
60
|
|
66
61
|
== TODO
|
67
62
|
|
68
|
-
* Port rest of libuv - ares, getaddrinfo, process,
|
63
|
+
* Port rest of libuv - ares, getaddrinfo, process, mutexes and locks
|
69
64
|
* Tests tests tests
|
70
65
|
* Docs docs docs
|
data/Rakefile
CHANGED
@@ -9,8 +9,9 @@ require 'ffi'
|
|
9
9
|
require 'rake/clean'
|
10
10
|
require 'uv/tasks'
|
11
11
|
|
12
|
-
|
12
|
+
task :default => :test
|
13
13
|
|
14
|
+
RSpec::Core::RakeTask.new(:spec)
|
14
15
|
Cucumber::Rake::Task.new(:features)
|
15
16
|
|
16
17
|
RDoc::Task.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:force") do |rd|
|
@@ -21,9 +22,8 @@ RDoc::Task.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:
|
|
21
22
|
end
|
22
23
|
|
23
24
|
task :test => [:spec, :features]
|
24
|
-
task :default => :test
|
25
25
|
|
26
26
|
desc "Compile libuv from submodule"
|
27
|
-
task :
|
27
|
+
task :compile => ["ext/libuv.#{FFI::Platform::LIBSUFFIX}"]
|
28
28
|
|
29
|
-
CLOBBER.include("ext/libuv.#{FFI::Platform::LIBSUFFIX}")
|
29
|
+
CLOBBER.include("ext/libuv.#{FFI::Platform::LIBSUFFIX}")
|
data/features/async.feature
CHANGED
data/features/idle.feature
CHANGED
data/features/pipe.feature
CHANGED
@@ -32,7 +32,7 @@ Feature: Named pipes
|
|
32
32
|
|
33
33
|
stopper = loop.timer
|
34
34
|
|
35
|
-
stopper.start(
|
35
|
+
stopper.start(5000, 0) do |e|
|
36
36
|
raise e if e
|
37
37
|
|
38
38
|
server.close {}
|
@@ -77,6 +77,7 @@ Feature: Named pipes
|
|
77
77
|
end
|
78
78
|
"""
|
79
79
|
When I run `ruby ipc_server_example.rb` interactively
|
80
|
+
And I wait for 1 seconds
|
80
81
|
And I run `ruby ipc_client_example.rb`
|
81
82
|
Then the output should contain ping pong exchange
|
82
83
|
|
@@ -85,7 +86,6 @@ Feature: Named pipes
|
|
85
86
|
And a file named "pipe_producer_example.rb" with:
|
86
87
|
"""
|
87
88
|
require 'uvrb'
|
88
|
-
|
89
89
|
loop = UV::Loop.default
|
90
90
|
|
91
91
|
pipe = File.open("/tmp/exchange-pipe.pipe", File::RDWR|File::NONBLOCK)
|
@@ -103,7 +103,7 @@ Feature: Named pipes
|
|
103
103
|
|
104
104
|
stopper = loop.timer
|
105
105
|
|
106
|
-
stopper.start(
|
106
|
+
stopper.start(3000, 0) do |e|
|
107
107
|
raise e if e
|
108
108
|
|
109
109
|
heartbeat.close {}
|
@@ -118,7 +118,6 @@ Feature: Named pipes
|
|
118
118
|
And a file named "pipe_consumer_example.rb" with:
|
119
119
|
"""
|
120
120
|
require 'uvrb'
|
121
|
-
|
122
121
|
loop = UV::Loop.default
|
123
122
|
|
124
123
|
pipe = File.open("/tmp/exchange-pipe.pipe", File::RDWR|File::NONBLOCK)
|
@@ -10,11 +10,13 @@ Then /^the output should contain consumed workload$/ do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
Given /^a named pipe "(.*?)"$/ do |path|
|
13
|
-
|
14
|
-
|
15
|
-
f.close
|
16
|
-
else
|
13
|
+
require 'ffi'
|
14
|
+
if not FFI::Platform.windows?
|
17
15
|
system "/usr/bin/mkfifo", path
|
16
|
+
at_exit { File.unlink(path) }
|
18
17
|
end
|
19
|
-
|
20
|
-
|
18
|
+
end
|
19
|
+
|
20
|
+
Given /^I wait for (\d+) seconds?$/ do |n|
|
21
|
+
sleep(n.to_i)
|
22
|
+
end
|
data/lib/uv.rb
CHANGED
@@ -1,9 +1,23 @@
|
|
1
|
+
require 'forwardable'
|
1
2
|
require 'ffi'
|
2
3
|
|
3
4
|
module UV
|
5
|
+
extend Forwardable
|
4
6
|
extend FFI::Library
|
5
7
|
FFI::DEBUG = 10
|
6
|
-
|
8
|
+
|
9
|
+
# In windows the attach functions have to be done before loading the next library
|
10
|
+
module LIBC
|
11
|
+
extend FFI::Library
|
12
|
+
ffi_lib(FFI::Library::LIBC).first
|
13
|
+
|
14
|
+
attach_function :malloc, [:size_t], :pointer, :blocking => true
|
15
|
+
attach_function :free, [:pointer], :void, :blocking => true
|
16
|
+
end
|
17
|
+
|
18
|
+
def_delegators :LIBC, :malloc, :free
|
19
|
+
module_function :malloc, :free
|
20
|
+
|
7
21
|
begin
|
8
22
|
# bias the library discovery to a path inside the gem first, then
|
9
23
|
# to the usual system paths
|
@@ -24,205 +38,217 @@ module UV
|
|
24
38
|
|
25
39
|
require 'uv/types'
|
26
40
|
|
27
|
-
attach_function :
|
28
|
-
attach_function :
|
29
|
-
|
30
|
-
|
31
|
-
attach_function :
|
32
|
-
attach_function :
|
33
|
-
attach_function :
|
34
|
-
attach_function :
|
35
|
-
|
36
|
-
attach_function :
|
37
|
-
attach_function :
|
38
|
-
|
39
|
-
|
40
|
-
attach_function :
|
41
|
-
|
42
|
-
attach_function :
|
43
|
-
attach_function :
|
44
|
-
attach_function :
|
45
|
-
|
46
|
-
attach_function :
|
47
|
-
attach_function :
|
48
|
-
attach_function :
|
49
|
-
|
50
|
-
attach_function :
|
51
|
-
attach_function :
|
52
|
-
attach_function :
|
53
|
-
|
54
|
-
attach_function :
|
55
|
-
attach_function :
|
56
|
-
attach_function :
|
57
|
-
|
58
|
-
attach_function :
|
59
|
-
attach_function :
|
60
|
-
|
61
|
-
attach_function :
|
62
|
-
attach_function :
|
63
|
-
attach_function :
|
64
|
-
attach_function :
|
65
|
-
attach_function :
|
66
|
-
attach_function :
|
67
|
-
attach_function :
|
68
|
-
|
69
|
-
attach_function :
|
70
|
-
attach_function :
|
71
|
-
|
72
|
-
attach_function :
|
73
|
-
attach_function :
|
74
|
-
attach_function :
|
75
|
-
attach_function :
|
76
|
-
attach_function :
|
77
|
-
attach_function :
|
78
|
-
attach_function :
|
79
|
-
attach_function :
|
80
|
-
|
81
|
-
attach_function :
|
82
|
-
attach_function :
|
83
|
-
attach_function :
|
84
|
-
attach_function :
|
85
|
-
|
86
|
-
attach_function :
|
87
|
-
attach_function :
|
88
|
-
attach_function :
|
89
|
-
attach_function :
|
90
|
-
|
91
|
-
attach_function :
|
92
|
-
|
93
|
-
attach_function :
|
94
|
-
|
95
|
-
attach_function :
|
96
|
-
attach_function :
|
97
|
-
attach_function :
|
98
|
-
|
99
|
-
|
100
|
-
attach_function :
|
101
|
-
|
102
|
-
|
103
|
-
attach_function :
|
104
|
-
attach_function :
|
105
|
-
attach_function :
|
106
|
-
|
107
|
-
|
108
|
-
attach_function :
|
109
|
-
attach_function :
|
110
|
-
|
111
|
-
|
112
|
-
attach_function :
|
113
|
-
|
114
|
-
attach_function :
|
115
|
-
|
116
|
-
attach_function :
|
117
|
-
attach_function :
|
118
|
-
attach_function :
|
119
|
-
|
120
|
-
|
121
|
-
attach_function :
|
122
|
-
|
123
|
-
|
124
|
-
attach_function :
|
125
|
-
attach_function :
|
126
|
-
|
127
|
-
attach_function :
|
128
|
-
attach_function :
|
129
|
-
|
130
|
-
attach_function :
|
131
|
-
attach_function :
|
132
|
-
|
133
|
-
attach_function :
|
134
|
-
attach_function :
|
135
|
-
|
136
|
-
attach_function :
|
137
|
-
attach_function :
|
138
|
-
attach_function :
|
139
|
-
attach_function :
|
140
|
-
attach_function :
|
141
|
-
attach_function :
|
142
|
-
|
143
|
-
attach_function :
|
144
|
-
attach_function :
|
145
|
-
|
146
|
-
|
147
|
-
attach_function :
|
148
|
-
attach_function :
|
149
|
-
attach_function :
|
150
|
-
attach_function :
|
151
|
-
attach_function :
|
152
|
-
|
153
|
-
attach_function :
|
154
|
-
attach_function :
|
155
|
-
attach_function :
|
156
|
-
|
157
|
-
attach_function :
|
158
|
-
attach_function :
|
159
|
-
attach_function :
|
160
|
-
attach_function :
|
161
|
-
attach_function :
|
162
|
-
attach_function :
|
163
|
-
attach_function :
|
164
|
-
attach_function :
|
165
|
-
attach_function :
|
166
|
-
attach_function :
|
167
|
-
attach_function :
|
168
|
-
attach_function :
|
169
|
-
attach_function :
|
170
|
-
attach_function :
|
171
|
-
attach_function :
|
172
|
-
attach_function :
|
173
|
-
|
174
|
-
attach_function :
|
175
|
-
|
176
|
-
attach_function :
|
177
|
-
attach_function :
|
178
|
-
attach_function :
|
179
|
-
attach_function :
|
180
|
-
|
181
|
-
attach_function :
|
182
|
-
attach_function :
|
183
|
-
|
184
|
-
attach_function :
|
185
|
-
|
186
|
-
attach_function :
|
187
|
-
attach_function :
|
188
|
-
attach_function :
|
189
|
-
|
190
|
-
# attach_function :
|
191
|
-
# attach_function :
|
192
|
-
|
193
|
-
attach_function :
|
194
|
-
attach_function :
|
195
|
-
attach_function :
|
196
|
-
attach_function :
|
197
|
-
attach_function :
|
198
|
-
|
199
|
-
attach_function :
|
200
|
-
attach_function :
|
201
|
-
attach_function :
|
202
|
-
attach_function :
|
203
|
-
attach_function :
|
204
|
-
attach_function :
|
205
|
-
|
206
|
-
attach_function :
|
207
|
-
|
208
|
-
attach_function :
|
209
|
-
attach_function :
|
210
|
-
attach_function :
|
211
|
-
|
212
|
-
|
213
|
-
attach_function :
|
214
|
-
attach_function :
|
215
|
-
attach_function :
|
216
|
-
|
217
|
-
attach_function :
|
218
|
-
attach_function :
|
41
|
+
attach_function :version_number, :uv_version, [], :uint, :blocking => true
|
42
|
+
attach_function :version_string, :uv_version_string, [], :string, :blocking => true
|
43
|
+
|
44
|
+
attach_function :loop_new, :uv_loop_new, [], :uv_loop_t, :blocking => true
|
45
|
+
attach_function :loop_delete, :uv_loop_delete, [:uv_loop_t], :void, :blocking => true
|
46
|
+
attach_function :default_loop, :uv_default_loop, [], :uv_loop_t, :blocking => true
|
47
|
+
attach_function :run, :uv_run, [:uv_loop_t, :uv_run_mode], :int, :blocking => true
|
48
|
+
attach_function :stop, :uv_stop, [:uv_loop_t], :void, :blocking => true
|
49
|
+
#attach_function :run_once, :uv_run_once, [:uv_loop_t], :int
|
50
|
+
attach_function :update_time, :uv_update_time, [:uv_loop_t], :void, :blocking => true
|
51
|
+
attach_function :now, :uv_now, [:uv_loop_t], :int64, :blocking => true
|
52
|
+
|
53
|
+
attach_function :backend_timeout, :uv_backend_timeout, [:uv_loop_t], :int, :blocking => true
|
54
|
+
attach_function :backend_fd, :uv_backend_fd, [:uv_loop_t], :int, :blocking => true
|
55
|
+
|
56
|
+
#attach_function :last_error, :uv_last_error, [:uv_loop_t], :int
|
57
|
+
attach_function :strerror, :uv_strerror, [:int], :string, :blocking => true
|
58
|
+
attach_function :err_name, :uv_err_name, [:int], :string, :blocking => true
|
59
|
+
|
60
|
+
attach_function :ref, :uv_ref, [:uv_handle_t], :void, :blocking => true
|
61
|
+
attach_function :unref, :uv_unref, [:uv_handle_t], :void, :blocking => true
|
62
|
+
attach_function :has_ref, :uv_has_ref, [:uv_handle_t], :int, :blocking => true
|
63
|
+
attach_function :is_active, :uv_is_active, [:uv_handle_t], :int, :blocking => true
|
64
|
+
attach_function :walk, :uv_walk, [:uv_loop_t, :uv_walk_cb, :pointer], :void, :blocking => true
|
65
|
+
attach_function :close, :uv_close, [:uv_handle_t, :uv_close_cb], :void, :blocking => true
|
66
|
+
attach_function :is_closing, :uv_is_closing, [:uv_handle_t], :int, :blocking => true
|
67
|
+
|
68
|
+
attach_function :buf_init, :uv_buf_init, [:pointer, :size_t], :uv_buf_t, :blocking => true
|
69
|
+
attach_function :strlcpy, :uv_strlcpy, [:string, :string, :size_t], :size_t, :blocking => true
|
70
|
+
attach_function :strlcat, :uv_strlcat, [:string, :string, :size_t], :size_t, :blocking => true
|
71
|
+
|
72
|
+
attach_function :listen, :uv_listen, [:uv_stream_t, :int, :uv_connection_cb], :int, :blocking => true
|
73
|
+
attach_function :accept, :uv_accept, [:uv_stream_t, :uv_stream_t], :int, :blocking => true
|
74
|
+
attach_function :read_start, :uv_read_start, [:uv_stream_t, :uv_alloc_cb, :uv_read_cb], :int, :blocking => true
|
75
|
+
attach_function :read_stop, :uv_read_stop, [:uv_stream_t], :int, :blocking => true
|
76
|
+
attach_function :read2_start, :uv_read2_start, [:uv_stream_t, :uv_alloc_cb, :uv_read2_cb], :int, :blocking => true
|
77
|
+
attach_function :write, :uv_write, [:uv_write_t, :uv_stream_t, :pointer, :int, :uv_write_cb], :int, :blocking => true
|
78
|
+
attach_function :write2, :uv_write2, [:uv_write_t, :uv_stream_t, :pointer, :int, :uv_stream_t, :uv_write_cb], :int, :blocking => true
|
79
|
+
attach_function :is_readable, :uv_is_readable, [:uv_stream_t], :int, :blocking => true
|
80
|
+
attach_function :is_writable, :uv_is_writable, [:uv_stream_t], :int, :blocking => true
|
81
|
+
attach_function :shutdown, :uv_shutdown, [:uv_shutdown_t, :uv_stream_t, :uv_shutdown_cb], :int, :blocking => true
|
82
|
+
|
83
|
+
attach_function :tcp_init, :uv_tcp_init, [:uv_loop_t, :uv_tcp_t], :int, :blocking => true
|
84
|
+
#attach_function :tcp_open, :uv_tcp_open, [:uv_tcp_t, :uv_os_sock_t], :int
|
85
|
+
attach_function :tcp_nodelay, :uv_tcp_nodelay, [:uv_tcp_t, :int], :int, :blocking => true
|
86
|
+
attach_function :tcp_keepalive, :uv_tcp_keepalive, [:uv_tcp_t, :int, :uint], :int, :blocking => true
|
87
|
+
attach_function :tcp_simultaneous_accepts, :uv_tcp_simultaneous_accepts, [:uv_tcp_t, :int], :int, :blocking => true
|
88
|
+
attach_function :tcp_bind, :uv_tcp_bind, [:uv_tcp_t, :sockaddr_in], :int, :blocking => true
|
89
|
+
attach_function :tcp_bind6, :uv_tcp_bind6, [:uv_tcp_t, :sockaddr_in6], :int, :blocking => true
|
90
|
+
attach_function :tcp_getsockname, :uv_tcp_getsockname, [:uv_tcp_t, :pointer, :pointer], :int, :blocking => true
|
91
|
+
attach_function :tcp_getpeername, :uv_tcp_getpeername, [:uv_tcp_t, :pointer, :pointer], :int, :blocking => true
|
92
|
+
attach_function :tcp_connect, :uv_tcp_connect, [:uv_connect_t, :uv_tcp_t, :sockaddr_in, :uv_connect_cb], :int, :blocking => true
|
93
|
+
attach_function :tcp_connect6, :uv_tcp_connect6, [:uv_connect_t, :uv_tcp_t, :sockaddr_in6, :uv_connect_cb], :int, :blocking => true
|
94
|
+
|
95
|
+
attach_function :udp_init, :uv_udp_init, [:uv_loop_t, :uv_udp_t], :int, :blocking => true
|
96
|
+
attach_function :udp_bind, :uv_udp_bind, [:uv_udp_t, :sockaddr_in, :uint], :int, :blocking => true
|
97
|
+
attach_function :udp_bind6, :uv_udp_bind6, [:uv_udp_t, :sockaddr_in6, :uint], :int, :blocking => true
|
98
|
+
attach_function :udp_getsockname, :uv_udp_getsockname, [:uv_udp_t, :pointer, :pointer], :int, :blocking => true
|
99
|
+
attach_function :udp_set_membership, :uv_udp_set_membership, [:uv_udp_t, :string, :string, :uv_membership], :int, :blocking => true
|
100
|
+
attach_function :udp_set_multicast_loop, :uv_udp_set_multicast_loop, [:uv_udp_t, :int], :int, :blocking => true
|
101
|
+
attach_function :udp_set_multicast_ttl, :uv_udp_set_multicast_ttl, [:uv_udp_t, :int], :int, :blocking => true
|
102
|
+
attach_function :udp_set_broadcast, :uv_udp_set_broadcast, [:uv_udp_t, :int], :int, :blocking => true
|
103
|
+
attach_function :udp_set_ttl, :uv_udp_set_ttl, [:uv_udp_t, :int], :int, :blocking => true
|
104
|
+
attach_function :udp_send, :uv_udp_send, [:uv_udp_send_t, :uv_udp_t, :pointer, :int, :sockaddr_in, :uv_udp_send_cb], :int, :blocking => true
|
105
|
+
attach_function :udp_send6, :uv_udp_send6, [:uv_udp_send_t, :uv_udp_t, :pointer, :int, :sockaddr_in6, :uv_udp_send_cb], :int, :blocking => true
|
106
|
+
attach_function :udp_recv_start, :uv_udp_recv_start, [:uv_udp_t, :uv_alloc_cb, :uv_udp_recv_cb], :int, :blocking => true
|
107
|
+
attach_function :udp_recv_stop, :uv_udp_recv_stop, [:uv_udp_t], :int, :blocking => true
|
108
|
+
|
109
|
+
attach_function :tty_init, :uv_tty_init, [:uv_loop_t, :uv_tty_t, :uv_file, :int], :int, :blocking => true
|
110
|
+
attach_function :tty_set_mode, :uv_tty_set_mode, [:uv_tty_t, :int], :int, :blocking => true
|
111
|
+
attach_function :tty_reset_mode, :uv_tty_reset_mode, [], :void, :blocking => true
|
112
|
+
attach_function :tty_get_winsize, :uv_tty_get_winsize, [:uv_tty_t, :pointer, :pointer], :int, :blocking => true
|
113
|
+
|
114
|
+
attach_function :guess_handle, :uv_guess_handle, [:uv_file], :uv_handle_type, :blocking => true
|
115
|
+
|
116
|
+
attach_function :pipe_init, :uv_pipe_init, [:uv_loop_t, :uv_pipe_t, :int], :int, :blocking => true
|
117
|
+
attach_function :pipe_open, :uv_pipe_open, [:uv_pipe_t, :uv_file], :void, :blocking => true
|
118
|
+
attach_function :pipe_bind, :uv_pipe_bind, [:uv_pipe_t, :string], :int, :blocking => true
|
119
|
+
attach_function :pipe_connect, :uv_pipe_connect, [:uv_connect_t, :uv_pipe_t, :string, :uv_connect_cb], :void, :blocking => true
|
120
|
+
attach_function :pipe_pending_instances, :uv_pipe_pending_instances, [:uv_pipe_t, :int], :void, :blocking => true
|
121
|
+
|
122
|
+
attach_function :prepare_init, :uv_prepare_init, [:uv_loop_t, :uv_prepare_t], :int, :blocking => true
|
123
|
+
attach_function :prepare_start, :uv_prepare_start, [:uv_prepare_t, :uv_prepare_cb], :int, :blocking => true
|
124
|
+
attach_function :prepare_stop, :uv_prepare_stop, [:uv_prepare_t], :int, :blocking => true
|
125
|
+
|
126
|
+
attach_function :check_init, :uv_check_init, [:uv_loop_t, :uv_check_t], :int, :blocking => true
|
127
|
+
attach_function :check_start, :uv_check_start, [:uv_check_t, :uv_check_cb], :int, :blocking => true
|
128
|
+
attach_function :check_stop, :uv_check_stop, [:uv_check_t], :int, :blocking => true
|
129
|
+
|
130
|
+
attach_function :idle_init, :uv_idle_init, [:uv_loop_t, :uv_idle_t], :int, :blocking => true
|
131
|
+
attach_function :idle_start, :uv_idle_start, [:uv_idle_t, :uv_idle_cb], :int, :blocking => true
|
132
|
+
attach_function :idle_stop, :uv_idle_stop, [:uv_idle_t], :int, :blocking => true
|
133
|
+
|
134
|
+
attach_function :async_init, :uv_async_init, [:uv_loop_t, :uv_async_t, :uv_async_cb], :int, :blocking => true
|
135
|
+
attach_function :async_send, :uv_async_send, [:uv_async_t], :int, :blocking => true
|
136
|
+
|
137
|
+
attach_function :timer_init, :uv_timer_init, [:uv_loop_t, :uv_timer_t], :int, :blocking => true
|
138
|
+
attach_function :timer_start, :uv_timer_start, [:uv_timer_t, :uv_timer_cb, :int64_t, :int64_t], :int, :blocking => true
|
139
|
+
attach_function :timer_stop, :uv_timer_stop, [:uv_timer_t], :int, :blocking => true
|
140
|
+
attach_function :timer_again, :uv_timer_again, [:uv_timer_t], :int, :blocking => true
|
141
|
+
attach_function :timer_set_repeat, :uv_timer_set_repeat, [:uv_timer_t, :int64_t], :void, :blocking => true
|
142
|
+
attach_function :timer_get_repeat, :uv_timer_get_repeat, [:uv_timer_t], :int64_t, :blocking => true
|
143
|
+
|
144
|
+
#attach_function :ares_init_options, :uv_ares_init_options, [:uv_loop_t, :ares_channel, :ares_options, :int], :int
|
145
|
+
#attach_function :ares_destroy, :uv_ares_destroy, [:uv_loop_t, :ares_channel], :void
|
146
|
+
|
147
|
+
attach_function :getaddrinfo, :uv_getaddrinfo, [:uv_loop_t, :uv_getaddrinfo_t, :uv_getaddrinfo_cb, :string, :string, :addrinfo], :int, :blocking => true
|
148
|
+
attach_function :freeaddrinfo, :uv_freeaddrinfo, [:addrinfo], :void, :blocking => true
|
149
|
+
|
150
|
+
attach_function :spawn, :uv_spawn, [:uv_loop_t, :uv_process_t, :uv_options_t], :int, :blocking => true
|
151
|
+
attach_function :process_kill, :uv_process_kill, [:uv_process_t, :int], :int, :blocking => true
|
152
|
+
attach_function :kill, :uv_kill, [:int, :int], :int, :blocking => true
|
153
|
+
attach_function :queue_work, :uv_queue_work, [:uv_loop_t, :uv_work_t, :uv_work_cb, :uv_after_work_cb], :int, :blocking => true
|
154
|
+
attach_function :cancel, :uv_cancel, [:pointer], :int, :blocking => true
|
155
|
+
attach_function :setup_args, :uv_setup_args, [:int, :varargs], :pointer, :blocking => true
|
156
|
+
attach_function :get_process_title, :uv_get_process_title, [:pointer, :size_t], :int, :blocking => true
|
157
|
+
attach_function :set_process_title, :uv_set_process_title, [:string], :int, :blocking => true
|
158
|
+
attach_function :resident_set_memory, :uv_resident_set_memory, [:size_t], :int, :blocking => true
|
159
|
+
|
160
|
+
attach_function :uptime, :uv_uptime, [:pointer], :int, :blocking => true
|
161
|
+
attach_function :cpu_info, :uv_cpu_info, [:uv_cpu_info_t, :pointer], :int, :blocking => true
|
162
|
+
attach_function :loadavg, :uv_loadavg, [:pointer], :void, :blocking => true
|
163
|
+
attach_function :free_cpu_info, :uv_free_cpu_info, [:uv_cpu_info_t, :int], :void, :blocking => true
|
164
|
+
attach_function :interface_addresses, :uv_interface_addresses, [:uv_interface_address_t, :pointer], :int, :blocking => true
|
165
|
+
attach_function :free_interface_addresses, :uv_free_interface_addresses, [:uv_interface_address_t, :int], :void, :blocking => true
|
166
|
+
|
167
|
+
#attach_function :fs_req_result, :uv_fs_req_result, [:uv_fs_t], :ssize_t
|
168
|
+
#attach_function :fs_req_stat, :uv_fs_req_stat, [:uv_fs_t], :uv_fs_stat_t
|
169
|
+
#attach_function :fs_req_pointer, :uv_fs_req_pointer, [:uv_fs_t], :pointer
|
170
|
+
|
171
|
+
attach_function :fs_req_cleanup, :uv_fs_req_cleanup, [:uv_fs_t], :void, :blocking => true
|
172
|
+
attach_function :fs_close, :uv_fs_close, [:uv_loop_t, :uv_fs_t, :uv_file, :uv_fs_cb], :int, :blocking => true
|
173
|
+
attach_function :fs_open, :uv_fs_open, [:uv_loop_t, :uv_fs_t, :string, :int, :int, :uv_fs_cb], :int, :blocking => true
|
174
|
+
attach_function :fs_read, :uv_fs_read, [:uv_loop_t, :uv_fs_t, :uv_file, :string, :size_t, :off_t, :uv_fs_cb], :int, :blocking => true
|
175
|
+
attach_function :fs_unlink, :uv_fs_unlink, [:uv_loop_t, :uv_fs_t, :string, :uv_fs_cb], :int, :blocking => true
|
176
|
+
attach_function :fs_write, :uv_fs_write, [:uv_loop_t, :uv_fs_t, :uv_file, :string, :size_t, :off_t, :uv_fs_cb], :int, :blocking => true
|
177
|
+
attach_function :fs_mkdir, :uv_fs_mkdir, [:uv_loop_t, :uv_fs_t, :string, :int, :uv_fs_cb], :int, :blocking => true
|
178
|
+
attach_function :fs_rmdir, :uv_fs_rmdir, [:uv_loop_t, :uv_fs_t, :string, :uv_fs_cb], :int, :blocking => true
|
179
|
+
attach_function :fs_readdir, :uv_fs_readdir, [:uv_loop_t, :uv_fs_t, :string, :int, :uv_fs_cb], :int, :blocking => true
|
180
|
+
attach_function :fs_stat, :uv_fs_stat, [:uv_loop_t, :uv_fs_t, :string, :uv_fs_cb], :int, :blocking => true
|
181
|
+
attach_function :fs_fstat, :uv_fs_fstat, [:uv_loop_t, :uv_fs_t, :uv_file, :uv_fs_cb], :int, :blocking => true
|
182
|
+
attach_function :fs_rename, :uv_fs_rename, [:uv_loop_t, :uv_fs_t, :string, :string, :uv_fs_cb], :int, :blocking => true
|
183
|
+
attach_function :fs_fsync, :uv_fs_fsync, [:uv_loop_t, :uv_fs_t, :uv_file, :uv_fs_cb], :int, :blocking => true
|
184
|
+
attach_function :fs_fdatasync, :uv_fs_fdatasync, [:uv_loop_t, :uv_fs_t, :uv_file, :uv_fs_cb], :int, :blocking => true
|
185
|
+
attach_function :fs_ftruncate, :uv_fs_ftruncate, [:uv_loop_t, :uv_fs_t, :uv_file, :off_t, :uv_fs_cb], :int, :blocking => true
|
186
|
+
attach_function :fs_sendfile, :uv_fs_sendfile, [:uv_loop_t, :uv_fs_t, :uv_file, :uv_file, :off_t, :size_t, :uv_fs_cb], :int, :blocking => true
|
187
|
+
attach_function :fs_chmod, :uv_fs_chmod, [:uv_loop_t, :uv_fs_t, :string, :int, :uv_fs_cb], :int, :blocking => true
|
188
|
+
attach_function :fs_utime, :uv_fs_utime, [:uv_loop_t, :uv_fs_t, :string, :double, :double, :uv_fs_cb], :int, :blocking => true
|
189
|
+
attach_function :fs_futime, :uv_fs_futime, [:uv_loop_t, :uv_fs_t, :uv_file, :double, :double, :uv_fs_cb], :int, :blocking => true
|
190
|
+
attach_function :fs_lstat, :uv_fs_lstat, [:uv_loop_t, :uv_fs_t, :string, :uv_fs_cb], :int, :blocking => true
|
191
|
+
attach_function :fs_link, :uv_fs_link, [:uv_loop_t, :uv_fs_t, :string, :string, :uv_fs_cb], :int, :blocking => true
|
192
|
+
attach_function :fs_symlink, :uv_fs_symlink, [:uv_loop_t, :uv_fs_t, :string, :string, :int, :uv_fs_cb], :int, :blocking => true
|
193
|
+
attach_function :fs_readlink, :uv_fs_readlink, [:uv_loop_t, :uv_fs_t, :string, :uv_fs_cb], :int, :blocking => true
|
194
|
+
attach_function :fs_fchmod, :uv_fs_fchmod, [:uv_loop_t, :uv_fs_t, :uv_file, :int, :uv_fs_cb], :int, :blocking => true
|
195
|
+
attach_function :fs_chown, :uv_fs_chown, [:uv_loop_t, :uv_fs_t, :string, :int, :int, :uv_fs_cb], :int, :blocking => true
|
196
|
+
attach_function :fs_fchown, :uv_fs_fchown, [:uv_loop_t, :uv_fs_t, :uv_file, :int, :int, :uv_fs_cb], :int, :blocking => true
|
197
|
+
|
198
|
+
attach_function :fs_event_init, :uv_fs_event_init, [:uv_loop_t, :uv_fs_event_t, :string, :uv_fs_event_cb, :int], :int, :blocking => true
|
199
|
+
|
200
|
+
attach_function :ip4_addr, :uv_ip4_addr, [:string, :int], :sockaddr_in, :blocking => true
|
201
|
+
attach_function :ip6_addr, :uv_ip6_addr, [:string, :int], :sockaddr_in6, :blocking => true
|
202
|
+
attach_function :ip4_name, :uv_ip4_name, [SockaddrIn.by_ref, :pointer, :size_t], :int, :blocking => true
|
203
|
+
attach_function :ip6_name, :uv_ip6_name, [SockaddrIn6.by_ref, :pointer, :size_t], :int, :blocking => true
|
204
|
+
#TODO:: attach_function :inet_ntop, :uv_inet_ntop, [:int, :pointer, ]
|
205
|
+
#TODO:: attach_function :uv_inet_pton
|
206
|
+
|
207
|
+
attach_function :exepath, :uv_exepath, [:pointer, :size_t], :int, :blocking => true
|
208
|
+
attach_function :cwd, :uv_cwd, [:pointer, :size_t], :int, :blocking => true
|
209
|
+
attach_function :chdir, :uv_chdir, [:string], :int, :blocking => true
|
210
|
+
attach_function :get_free_memory, :uv_get_free_memory, [], :uint64, :blocking => true
|
211
|
+
attach_function :get_total_memory, :uv_get_total_memory, [], :uint64, :blocking => true
|
212
|
+
attach_function :hrtime, :uv_hrtime, [], :uint64, :blocking => true
|
213
|
+
attach_function :disable_stdio_inheritance, :uv_disable_stdio_inheritance, [], :void, :blocking => true
|
214
|
+
attach_function :dlopen, :uv_dlopen, [:string, :uv_lib_t], :int, :blocking => true
|
215
|
+
attach_function :dlclose, :uv_dlclose, [:uv_lib_t], :int, :blocking => true
|
216
|
+
attach_function :dlsym, :uv_dlsym, [:uv_lib_t, :string, :pointer], :int, :blocking => true
|
217
|
+
#attach_function :dlerror, :uv_dlerror, [:uv_lib_t], :string
|
218
|
+
#attach_function :dlerror_free, :uv_dlerror_free, [:uv_lib_t, :string], :void
|
219
|
+
|
220
|
+
attach_function :mutex_init, :uv_mutex_init, [:uv_mutex_t], :int, :blocking => true
|
221
|
+
attach_function :mutex_destroy, :uv_mutex_destroy, [:uv_mutex_t], :void, :blocking => true
|
222
|
+
attach_function :mutex_lock, :uv_mutex_lock, [:uv_mutex_t], :void, :blocking => true
|
223
|
+
attach_function :mutex_trylock, :uv_mutex_trylock, [:uv_mutex_t], :int, :blocking => true
|
224
|
+
attach_function :mutex_unlock, :uv_mutex_unlock, [:uv_mutex_t], :void, :blocking => true
|
225
|
+
|
226
|
+
attach_function :rwlock_init, :uv_rwlock_init, [:uv_rwlock_t], :int, :blocking => true
|
227
|
+
attach_function :rwlock_destroy, :uv_rwlock_destroy, [:uv_rwlock_t], :void, :blocking => true
|
228
|
+
attach_function :rwlock_rdlock, :uv_rwlock_rdlock, [:uv_rwlock_t], :void, :blocking => true
|
229
|
+
attach_function :rwlock_tryrdlock, :uv_rwlock_tryrdlock, [:uv_rwlock_t], :int, :blocking => true
|
230
|
+
attach_function :rwlock_rdunlock, :uv_rwlock_rdunlock, [:uv_rwlock_t], :void, :blocking => true
|
231
|
+
attach_function :rwlock_wrlock, :uv_rwlock_wrlock, [:uv_rwlock_t], :void, :blocking => true
|
232
|
+
attach_function :rwlock_trywrlock, :uv_rwlock_trywrlock, [:uv_rwlock_t], :int, :blocking => true
|
233
|
+
attach_function :rwlock_wrunlock, :uv_rwlock_wrunlock, [:uv_rwlock_t], :void, :blocking => true
|
234
|
+
|
235
|
+
attach_function :once, :uv_once, [:uv_once_t, :uv_cb], :void, :blocking => true
|
236
|
+
attach_function :thread_create, :uv_thread_create, [:uv_thread_t, :uv_cb], :int, :blocking => true
|
237
|
+
attach_function :thread_join, :uv_thread_join, [:uv_thread_t], :int, :blocking => true
|
238
|
+
|
239
|
+
attach_function :handle_size, :uv_handle_size, [:uv_handle_type], :size_t, :blocking => true
|
240
|
+
attach_function :req_size, :uv_req_size, [:uv_req_type], :size_t, :blocking => true
|
241
|
+
|
242
|
+
# This function is attached differently in windows - see ./types/windows.rb
|
243
|
+
attach_function :ntohs, [:ushort], :ushort, :blocking => true unless FFI::Platform.windows?
|
244
|
+
|
219
245
|
|
220
246
|
def self.create_handle(type)
|
221
|
-
|
247
|
+
LIBC.malloc(UV.handle_size(type))
|
222
248
|
end
|
223
249
|
|
224
250
|
def self.create_request(type)
|
225
|
-
|
251
|
+
LIBC.malloc(UV.req_size(type))
|
226
252
|
end
|
227
253
|
|
228
254
|
autoload :Resource, 'uv/resource'
|
@@ -241,6 +267,7 @@ module UV
|
|
241
267
|
autoload :Check, 'uv/check'
|
242
268
|
autoload :Idle, 'uv/idle'
|
243
269
|
autoload :Async, 'uv/async'
|
270
|
+
autoload :Work, 'uv/work'
|
244
271
|
autoload :Filesystem, 'uv/filesystem'
|
245
272
|
autoload :File, 'uv/file'
|
246
273
|
autoload :FSEvent, 'uv/fs_event'
|