libuv 0.11.22 → 0.12.0
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.
- checksums.yaml +4 -4
 - data/.gitignore +19 -17
 - data/.gitmodules +3 -3
 - data/.rspec +1 -1
 - data/.travis.yml +16 -16
 - data/Gemfile +4 -4
 - data/LICENSE +23 -23
 - data/README.md +89 -89
 - data/Rakefile +31 -31
 - data/lib/libuv.rb +54 -54
 - data/lib/libuv/async.rb +47 -47
 - data/lib/libuv/check.rb +55 -55
 - data/lib/libuv/dns.rb +85 -85
 - data/lib/libuv/error.rb +78 -74
 - data/lib/libuv/ext/ext.rb +260 -258
 - data/lib/libuv/ext/platform/darwin_x64.rb +23 -23
 - data/lib/libuv/ext/platform/linux.rb +7 -7
 - data/lib/libuv/ext/platform/unix.rb +29 -29
 - data/lib/libuv/ext/platform/windows.rb +40 -40
 - data/lib/libuv/ext/tasks.rb +31 -31
 - data/lib/libuv/ext/tasks/mac.rb +23 -23
 - data/lib/libuv/ext/tasks/unix.rb +23 -23
 - data/lib/libuv/ext/tasks/win.rb +14 -14
 - data/lib/libuv/ext/types.rb +238 -238
 - data/lib/libuv/file.rb +281 -269
 - data/lib/libuv/filesystem.rb +232 -232
 - data/lib/libuv/fs_event.rb +31 -31
 - data/lib/libuv/handle.rb +85 -85
 - data/lib/libuv/idle.rb +56 -56
 - data/lib/libuv/loop.rb +412 -412
 - data/lib/libuv/mixins/assertions.rb +23 -23
 - data/lib/libuv/mixins/fs_checks.rb +60 -58
 - data/lib/libuv/mixins/listener.rb +34 -34
 - data/lib/libuv/mixins/net.rb +40 -40
 - data/lib/libuv/mixins/resource.rb +27 -27
 - data/lib/libuv/mixins/stream.rb +153 -154
 - data/lib/libuv/pipe.rb +184 -203
 - data/lib/libuv/prepare.rb +56 -56
 - data/lib/libuv/signal.rb +51 -51
 - data/lib/libuv/tcp.rb +334 -334
 - data/lib/libuv/timer.rb +85 -85
 - data/lib/libuv/tty.rb +37 -37
 - data/lib/libuv/udp.rb +240 -240
 - data/lib/libuv/version.rb +3 -3
 - data/lib/libuv/work.rb +75 -75
 - data/libuv.gemspec +56 -56
 - data/spec/async_spec.rb +61 -60
 - data/spec/cpu_spec.rb +10 -10
 - data/spec/defer_spec.rb +980 -980
 - data/spec/dns_spec.rb +96 -90
 - data/spec/filesystem_spec.rb +270 -261
 - data/spec/idle_spec.rb +56 -56
 - data/spec/pipe_spec.rb +160 -160
 - data/spec/tcp_spec.rb +271 -267
 - metadata +64 -51
 
    
        data/lib/libuv/ext/ext.rb
    CHANGED
    
    | 
         @@ -1,259 +1,261 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require 'forwardable'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'ffi'
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            module Libuv
         
     | 
| 
       5 
     | 
    
         
            -
                module Ext
         
     | 
| 
       6 
     | 
    
         
            -
                    extend Forwardable
         
     | 
| 
       7 
     | 
    
         
            -
                    extend FFI::Library
         
     | 
| 
       8 
     | 
    
         
            -
                    FFI::DEBUG = 10
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
                    # In windows each library requires its own module
         
     | 
| 
       12 
     | 
    
         
            -
                    module LIBC
         
     | 
| 
       13 
     | 
    
         
            -
                        extend FFI::Library
         
     | 
| 
       14 
     | 
    
         
            -
                        ffi_lib(FFI::Library::LIBC).first
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                        attach_function :malloc, [:size_t], :pointer, :blocking => true
         
     | 
| 
       17 
     | 
    
         
            -
                        attach_function :free, [:pointer], :void, :blocking => true
         
     | 
| 
       18 
     | 
    
         
            -
                    end
         
     | 
| 
       19 
     | 
    
         
            -
                    def_delegators :LIBC, :malloc, :free
         
     | 
| 
       20 
     | 
    
         
            -
                    module_function :malloc, :free
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                    begin
         
     | 
| 
       24 
     | 
    
         
            -
                        # bias the library discovery to a path inside the gem first, then
         
     | 
| 
       25 
     | 
    
         
            -
                        # to the usual system paths
         
     | 
| 
       26 
     | 
    
         
            -
                        path_to_internal_libuv = File.dirname(__FILE__) + '/../../../ext'
         
     | 
| 
       27 
     | 
    
         
            -
                        LIBUV_PATHS = [
         
     | 
| 
       28 
     | 
    
         
            -
                        path_to_internal_libuv, '/usr/local/lib', '/opt/local/lib', '/usr/lib64'
         
     | 
| 
       29 
     | 
    
         
            -
                        ].map{|path| "#{path}/libuv.#{FFI::Platform::LIBSUFFIX}"}
         
     | 
| 
       30 
     | 
    
         
            -
                        libuv = ffi_lib(LIBUV_PATHS + %w{libuv}).first
         
     | 
| 
       31 
     | 
    
         
            -
                    rescue LoadError
         
     | 
| 
       32 
     | 
    
         
            -
                        warn <<-WARNING
         
     | 
| 
       33 
     | 
    
         
            -
                        Unable to load this gem. The libuv library (or DLL) could not be found.
         
     | 
| 
       34 
     | 
    
         
            -
                        If this is a Windows platform, make sure libuv.dll is on the PATH.
         
     | 
| 
       35 
     | 
    
         
            -
                        For non-Windows platforms, make sure libuv is located in this search path:
         
     | 
| 
       36 
     | 
    
         
            -
                        #{LIBUV_PATHS.inspect}
         
     | 
| 
       37 
     | 
    
         
            -
                        WARNING
         
     | 
| 
       38 
     | 
    
         
            -
                        exit 255
         
     | 
| 
       39 
     | 
    
         
            -
                    end
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
                    require 'libuv/ext/types'
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
                    attach_function :handle_size, :uv_handle_size, [:uv_handle_type], :size_t, :blocking => true
         
     | 
| 
       46 
     | 
    
         
            -
                    attach_function :req_size, :uv_req_size, [:uv_req_type], :size_t, :blocking => true
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                    # We need to calculate where the FS request data is located using req_size
         
     | 
| 
       50 
     | 
    
         
            -
                    class FsRequest < FFI::Struct
         
     | 
| 
       51 
     | 
    
         
            -
                        layout :req_data, [:uint8, Ext.req_size(:uv_req)],
         
     | 
| 
       52 
     | 
    
         
            -
                               :fs_type, :uv_fs_type,
         
     | 
| 
       53 
     | 
    
         
            -
                               :loop, :uv_loop_t,
         
     | 
| 
       54 
     | 
    
         
            -
                               :fs_callback, :pointer,
         
     | 
| 
       55 
     | 
    
         
            -
                               :result, :ssize_t,
         
     | 
| 
       56 
     | 
    
         
            -
                               :ptr, :pointer,
         
     | 
| 
       57 
     | 
    
         
            -
                               :path, :string,
         
     | 
| 
       58 
     | 
    
         
            -
                               :stat, UvStat
         
     | 
| 
       59 
     | 
    
         
            -
                    end
         
     | 
| 
       60 
     | 
    
         
            -
                    callback :uv_fs_cb, [FsRequest.by_ref], :void
         
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                    attach_function :version_number, :uv_version, [], :uint, :blocking => true
         
     | 
| 
       64 
     | 
    
         
            -
                    attach_function :version_string, :uv_version_string, [], :string, :blocking => true
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                    attach_function :loop_new, :uv_loop_new, [], :uv_loop_t, :blocking => true
         
     | 
| 
       67 
     | 
    
         
            -
                    attach_function :loop_delete, :uv_loop_delete, [:uv_loop_t], :void, :blocking => true
         
     | 
| 
       68 
     | 
    
         
            -
                    attach_function :default_loop, :uv_default_loop, [], :uv_loop_t, :blocking => true
         
     | 
| 
       69 
     | 
    
         
            -
                    attach_function :run, :uv_run, [:uv_loop_t, :uv_run_mode], :int, :blocking => true
         
     | 
| 
       70 
     | 
    
         
            -
                    attach_function :stop, :uv_stop, [:uv_loop_t], :void, :blocking => true
         
     | 
| 
       71 
     | 
    
         
            -
                    attach_function :update_time, :uv_update_time, [:uv_loop_t], :void, :blocking => true
         
     | 
| 
       72 
     | 
    
         
            -
                    attach_function :now, :uv_now, [:uv_loop_t], :uint64, :blocking => true
         
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
                    attach_function :backend_timeout, :uv_backend_timeout, [:uv_loop_t], :int, :blocking => true
         
     | 
| 
       75 
     | 
    
         
            -
                    attach_function :backend_fd, :uv_backend_fd, [:uv_loop_t], :int, :blocking => true
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                    attach_function :strerror, :uv_strerror, [:int], :string, :blocking => true
         
     | 
| 
       78 
     | 
    
         
            -
                    attach_function :err_name, :uv_err_name, [:int], :string, :blocking => true
         
     | 
| 
       79 
     | 
    
         
            -
             
     | 
| 
       80 
     | 
    
         
            -
                    attach_function :ref, :uv_ref, [:uv_handle_t], :void, :blocking => true
         
     | 
| 
       81 
     | 
    
         
            -
                    attach_function :unref, :uv_unref, [:uv_handle_t], :void, :blocking => true
         
     | 
| 
       82 
     | 
    
         
            -
                    attach_function :has_ref, :uv_has_ref, [:uv_handle_t], :int, :blocking => true
         
     | 
| 
       83 
     | 
    
         
            -
                    attach_function :is_active, :uv_is_active, [:uv_handle_t], :int, :blocking => true
         
     | 
| 
       84 
     | 
    
         
            -
                    attach_function :walk, :uv_walk, [:uv_loop_t, :uv_walk_cb, :pointer], :void, :blocking => true
         
     | 
| 
       85 
     | 
    
         
            -
                    attach_function :close, :uv_close, [:uv_handle_t, :uv_close_cb], :void, :blocking => true
         
     | 
| 
       86 
     | 
    
         
            -
                    attach_function :is_closing, :uv_is_closing, [:uv_handle_t], :int, :blocking => true
         
     | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
                    attach_function :buf_init, :uv_buf_init, [:pointer, :size_t], UvBuf.by_value, :blocking => true
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
                    attach_function :listen, :uv_listen, [:uv_stream_t, :int, :uv_connection_cb], :int, :blocking => true
         
     | 
| 
       91 
     | 
    
         
            -
                    attach_function :accept, :uv_accept, [:uv_stream_t, :uv_stream_t], :int, :blocking => true
         
     | 
| 
       92 
     | 
    
         
            -
                    attach_function :read_start, :uv_read_start, [:uv_stream_t, :uv_alloc_cb, :uv_read_cb], :int, :blocking => true
         
     | 
| 
       93 
     | 
    
         
            -
                    attach_function :read_stop, :uv_read_stop, [:uv_stream_t], :int, :blocking => true
         
     | 
| 
       94 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       95 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       96 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       97 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       98 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       102 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       103 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       104 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       105 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       106 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       107 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       108 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       109 
     | 
    
         
            -
             
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       112 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       113 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       114 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       115 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       116 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       117 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       118 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       119 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       120 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       121 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       122 
     | 
    
         
            -
             
     | 
| 
       123 
     | 
    
         
            -
             
     | 
| 
       124 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       125 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       126 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       127 
     | 
    
         
            -
             
     | 
| 
       128 
     | 
    
         
            -
             
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
       131 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       132 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       133 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       134 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       135 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       136 
     | 
    
         
            -
             
     | 
| 
       137 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
       139 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
       141 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
       143 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
       145 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
       152 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       153 
     | 
    
         
            -
             
     | 
| 
       154 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       155 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       156 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       157 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       160 
     | 
    
         
            -
             
     | 
| 
       161 
     | 
    
         
            -
             
     | 
| 
       162 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       163 
     | 
    
         
            -
             
     | 
| 
       164 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       165 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       166 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       167 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       168 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       169 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       170 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
       172 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       175 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       176 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       177 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       180 
     | 
    
         
            -
             
     | 
| 
       181 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       182 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       183 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       184 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       185 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       186 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       187 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       188 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       189 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       190 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       191 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       192 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       193 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       194 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       195 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       196 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       197 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       198 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       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 
     | 
    
         
            -
             
     | 
| 
       210 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       211 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       212 
     | 
    
         
            -
                     
     | 
| 
       213 
     | 
    
         
            -
                     
     | 
| 
       214 
     | 
    
         
            -
             
     | 
| 
       215 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       216 
     | 
    
         
            -
             
     | 
| 
       217 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       218 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       219 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       220 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       221 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       222 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       223 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       224 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       225 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       226 
     | 
    
         
            -
             
     | 
| 
       227 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       228 
     | 
    
         
            -
             
     | 
| 
       229 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       230 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       231 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       232 
     | 
    
         
            -
             
     | 
| 
       233 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       234 
     | 
    
         
            -
             
     | 
| 
       235 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       236 
     | 
    
         
            -
             
     | 
| 
       237 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       238 
     | 
    
         
            -
             
     | 
| 
       239 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       240 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       241 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       242 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       243 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       244 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
       246 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       247 
     | 
    
         
            -
             
     | 
| 
       248 
     | 
    
         
            -
                    attach_function : 
     | 
| 
       249 
     | 
    
         
            -
             
     | 
| 
       250 
     | 
    
         
            -
             
     | 
| 
       251 
     | 
    
         
            -
             
     | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
       253 
     | 
    
         
            -
                     
     | 
| 
       254 
     | 
    
         
            -
             
     | 
| 
       255 
     | 
    
         
            -
                     
     | 
| 
       256 
     | 
    
         
            -
             
     | 
| 
       257 
     | 
    
         
            -
                     
     | 
| 
       258 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            require 'forwardable'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'ffi'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            module Libuv
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Ext
         
     | 
| 
      
 6 
     | 
    
         
            +
                    extend Forwardable
         
     | 
| 
      
 7 
     | 
    
         
            +
                    extend FFI::Library
         
     | 
| 
      
 8 
     | 
    
         
            +
                    FFI::DEBUG = 10
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                    # In windows each library requires its own module
         
     | 
| 
      
 12 
     | 
    
         
            +
                    module LIBC
         
     | 
| 
      
 13 
     | 
    
         
            +
                        extend FFI::Library
         
     | 
| 
      
 14 
     | 
    
         
            +
                        ffi_lib(FFI::Library::LIBC).first
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                        attach_function :malloc, [:size_t], :pointer, :blocking => true
         
     | 
| 
      
 17 
     | 
    
         
            +
                        attach_function :free, [:pointer], :void, :blocking => true
         
     | 
| 
      
 18 
     | 
    
         
            +
                    end
         
     | 
| 
      
 19 
     | 
    
         
            +
                    def_delegators :LIBC, :malloc, :free
         
     | 
| 
      
 20 
     | 
    
         
            +
                    module_function :malloc, :free
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 24 
     | 
    
         
            +
                        # bias the library discovery to a path inside the gem first, then
         
     | 
| 
      
 25 
     | 
    
         
            +
                        # to the usual system paths
         
     | 
| 
      
 26 
     | 
    
         
            +
                        path_to_internal_libuv = File.dirname(__FILE__) + '/../../../ext'
         
     | 
| 
      
 27 
     | 
    
         
            +
                        LIBUV_PATHS = [
         
     | 
| 
      
 28 
     | 
    
         
            +
                        path_to_internal_libuv, '/usr/local/lib', '/opt/local/lib', '/usr/lib64'
         
     | 
| 
      
 29 
     | 
    
         
            +
                        ].map{|path| "#{path}/libuv.#{FFI::Platform::LIBSUFFIX}"}
         
     | 
| 
      
 30 
     | 
    
         
            +
                        libuv = ffi_lib(LIBUV_PATHS + %w{libuv}).first
         
     | 
| 
      
 31 
     | 
    
         
            +
                    rescue LoadError
         
     | 
| 
      
 32 
     | 
    
         
            +
                        warn <<-WARNING
         
     | 
| 
      
 33 
     | 
    
         
            +
                        Unable to load this gem. The libuv library (or DLL) could not be found.
         
     | 
| 
      
 34 
     | 
    
         
            +
                        If this is a Windows platform, make sure libuv.dll is on the PATH.
         
     | 
| 
      
 35 
     | 
    
         
            +
                        For non-Windows platforms, make sure libuv is located in this search path:
         
     | 
| 
      
 36 
     | 
    
         
            +
                        #{LIBUV_PATHS.inspect}
         
     | 
| 
      
 37 
     | 
    
         
            +
                        WARNING
         
     | 
| 
      
 38 
     | 
    
         
            +
                        exit 255
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                    require 'libuv/ext/types'
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                    attach_function :handle_size, :uv_handle_size, [:uv_handle_type], :size_t, :blocking => true
         
     | 
| 
      
 46 
     | 
    
         
            +
                    attach_function :req_size, :uv_req_size, [:uv_req_type], :size_t, :blocking => true
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                    # We need to calculate where the FS request data is located using req_size
         
     | 
| 
      
 50 
     | 
    
         
            +
                    class FsRequest < FFI::Struct
         
     | 
| 
      
 51 
     | 
    
         
            +
                        layout :req_data, [:uint8, Ext.req_size(:uv_req)],
         
     | 
| 
      
 52 
     | 
    
         
            +
                               :fs_type, :uv_fs_type,
         
     | 
| 
      
 53 
     | 
    
         
            +
                               :loop, :uv_loop_t,
         
     | 
| 
      
 54 
     | 
    
         
            +
                               :fs_callback, :pointer,
         
     | 
| 
      
 55 
     | 
    
         
            +
                               :result, :ssize_t,
         
     | 
| 
      
 56 
     | 
    
         
            +
                               :ptr, :pointer,
         
     | 
| 
      
 57 
     | 
    
         
            +
                               :path, :string,
         
     | 
| 
      
 58 
     | 
    
         
            +
                               :stat, UvStat
         
     | 
| 
      
 59 
     | 
    
         
            +
                    end
         
     | 
| 
      
 60 
     | 
    
         
            +
                    callback :uv_fs_cb, [FsRequest.by_ref], :void
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
                    attach_function :version_number, :uv_version, [], :uint, :blocking => true
         
     | 
| 
      
 64 
     | 
    
         
            +
                    attach_function :version_string, :uv_version_string, [], :string, :blocking => true
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                    attach_function :loop_new, :uv_loop_new, [], :uv_loop_t, :blocking => true
         
     | 
| 
      
 67 
     | 
    
         
            +
                    attach_function :loop_delete, :uv_loop_delete, [:uv_loop_t], :void, :blocking => true
         
     | 
| 
      
 68 
     | 
    
         
            +
                    attach_function :default_loop, :uv_default_loop, [], :uv_loop_t, :blocking => true
         
     | 
| 
      
 69 
     | 
    
         
            +
                    attach_function :run, :uv_run, [:uv_loop_t, :uv_run_mode], :int, :blocking => true
         
     | 
| 
      
 70 
     | 
    
         
            +
                    attach_function :stop, :uv_stop, [:uv_loop_t], :void, :blocking => true
         
     | 
| 
      
 71 
     | 
    
         
            +
                    attach_function :update_time, :uv_update_time, [:uv_loop_t], :void, :blocking => true
         
     | 
| 
      
 72 
     | 
    
         
            +
                    attach_function :now, :uv_now, [:uv_loop_t], :uint64, :blocking => true
         
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                    attach_function :backend_timeout, :uv_backend_timeout, [:uv_loop_t], :int, :blocking => true
         
     | 
| 
      
 75 
     | 
    
         
            +
                    attach_function :backend_fd, :uv_backend_fd, [:uv_loop_t], :int, :blocking => true
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                    attach_function :strerror, :uv_strerror, [:int], :string, :blocking => true
         
     | 
| 
      
 78 
     | 
    
         
            +
                    attach_function :err_name, :uv_err_name, [:int], :string, :blocking => true
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                    attach_function :ref, :uv_ref, [:uv_handle_t], :void, :blocking => true
         
     | 
| 
      
 81 
     | 
    
         
            +
                    attach_function :unref, :uv_unref, [:uv_handle_t], :void, :blocking => true
         
     | 
| 
      
 82 
     | 
    
         
            +
                    attach_function :has_ref, :uv_has_ref, [:uv_handle_t], :int, :blocking => true
         
     | 
| 
      
 83 
     | 
    
         
            +
                    attach_function :is_active, :uv_is_active, [:uv_handle_t], :int, :blocking => true
         
     | 
| 
      
 84 
     | 
    
         
            +
                    attach_function :walk, :uv_walk, [:uv_loop_t, :uv_walk_cb, :pointer], :void, :blocking => true
         
     | 
| 
      
 85 
     | 
    
         
            +
                    attach_function :close, :uv_close, [:uv_handle_t, :uv_close_cb], :void, :blocking => true
         
     | 
| 
      
 86 
     | 
    
         
            +
                    attach_function :is_closing, :uv_is_closing, [:uv_handle_t], :int, :blocking => true
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                    attach_function :buf_init, :uv_buf_init, [:pointer, :size_t], UvBuf.by_value, :blocking => true
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                    attach_function :listen, :uv_listen, [:uv_stream_t, :int, :uv_connection_cb], :int, :blocking => true
         
     | 
| 
      
 91 
     | 
    
         
            +
                    attach_function :accept, :uv_accept, [:uv_stream_t, :uv_stream_t], :int, :blocking => true
         
     | 
| 
      
 92 
     | 
    
         
            +
                    attach_function :read_start, :uv_read_start, [:uv_stream_t, :uv_alloc_cb, :uv_read_cb], :int, :blocking => true
         
     | 
| 
      
 93 
     | 
    
         
            +
                    attach_function :read_stop, :uv_read_stop, [:uv_stream_t], :int, :blocking => true
         
     | 
| 
      
 94 
     | 
    
         
            +
                    attach_function :write, :uv_write, [:uv_write_t, :uv_stream_t, :pointer, :uint, :uv_write_cb], :int, :blocking => true
         
     | 
| 
      
 95 
     | 
    
         
            +
                    attach_function :write2, :uv_write2, [:uv_write_t, :uv_stream_t, :pointer, :uint, :uv_stream_t, :uv_write_cb], :int, :blocking => true
         
     | 
| 
      
 96 
     | 
    
         
            +
                    attach_function :is_readable, :uv_is_readable, [:uv_stream_t], :int, :blocking => true
         
     | 
| 
      
 97 
     | 
    
         
            +
                    attach_function :is_writable, :uv_is_writable, [:uv_stream_t], :int, :blocking => true
         
     | 
| 
      
 98 
     | 
    
         
            +
                    attach_function :shutdown, :uv_shutdown, [:uv_shutdown_t, :uv_stream_t, :uv_shutdown_cb], :int, :blocking => true
         
     | 
| 
      
 99 
     | 
    
         
            +
             
     | 
| 
      
 100 
     | 
    
         
            +
                    attach_function :tcp_init, :uv_tcp_init, [:uv_loop_t, :uv_tcp_t], :int, :blocking => true
         
     | 
| 
      
 101 
     | 
    
         
            +
                    attach_function :tcp_open, :uv_tcp_open, [:uv_tcp_t, :uv_os_sock_t], :int, :blocking => true
         
     | 
| 
      
 102 
     | 
    
         
            +
                    attach_function :tcp_nodelay, :uv_tcp_nodelay, [:uv_tcp_t, :int], :int, :blocking => true
         
     | 
| 
      
 103 
     | 
    
         
            +
                    attach_function :tcp_keepalive, :uv_tcp_keepalive, [:uv_tcp_t, :int, :uint], :int, :blocking => true
         
     | 
| 
      
 104 
     | 
    
         
            +
                    attach_function :tcp_simultaneous_accepts, :uv_tcp_simultaneous_accepts, [:uv_tcp_t, :int], :int, :blocking => true
         
     | 
| 
      
 105 
     | 
    
         
            +
                    attach_function :tcp_bind, :uv_tcp_bind, [:uv_tcp_t, :sockaddr_in], :int, :blocking => true
         
     | 
| 
      
 106 
     | 
    
         
            +
                    attach_function :tcp_getsockname, :uv_tcp_getsockname, [:uv_tcp_t, :pointer, :pointer], :int, :blocking => true
         
     | 
| 
      
 107 
     | 
    
         
            +
                    attach_function :tcp_getpeername, :uv_tcp_getpeername, [:uv_tcp_t, :pointer, :pointer], :int, :blocking => true
         
     | 
| 
      
 108 
     | 
    
         
            +
                    attach_function :tcp_connect, :uv_tcp_connect, [:uv_connect_t, :uv_tcp_t, :sockaddr_in, :uv_connect_cb], :int, :blocking => true
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                    attach_function :udp_init, :uv_udp_init, [:uv_loop_t, :uv_udp_t], :int, :blocking => true
         
     | 
| 
      
 111 
     | 
    
         
            +
                    attach_function :udp_open, :uv_udp_open, [:uv_udp_t, :uv_os_sock_t], :int, :blocking => true
         
     | 
| 
      
 112 
     | 
    
         
            +
                    attach_function :udp_bind, :uv_udp_bind, [:uv_udp_t, :sockaddr_in, :uint], :int, :blocking => true
         
     | 
| 
      
 113 
     | 
    
         
            +
                    attach_function :udp_getsockname, :uv_udp_getsockname, [:uv_udp_t, :pointer, :pointer], :int, :blocking => true
         
     | 
| 
      
 114 
     | 
    
         
            +
                    attach_function :udp_set_membership, :uv_udp_set_membership, [:uv_udp_t, :string, :string, :uv_membership], :int, :blocking => true
         
     | 
| 
      
 115 
     | 
    
         
            +
                    attach_function :udp_set_multicast_loop, :uv_udp_set_multicast_loop, [:uv_udp_t, :int], :int, :blocking => true
         
     | 
| 
      
 116 
     | 
    
         
            +
                    attach_function :udp_set_multicast_ttl, :uv_udp_set_multicast_ttl, [:uv_udp_t, :int], :int, :blocking => true
         
     | 
| 
      
 117 
     | 
    
         
            +
                    attach_function :udp_set_broadcast, :uv_udp_set_broadcast, [:uv_udp_t, :int], :int, :blocking => true
         
     | 
| 
      
 118 
     | 
    
         
            +
                    attach_function :udp_set_ttl, :uv_udp_set_ttl, [:uv_udp_t, :int], :int, :blocking => true
         
     | 
| 
      
 119 
     | 
    
         
            +
                    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
         
     | 
| 
      
 120 
     | 
    
         
            +
                    attach_function :udp_recv_start, :uv_udp_recv_start, [:uv_udp_t, :uv_alloc_cb, :uv_udp_recv_cb], :int, :blocking => true
         
     | 
| 
      
 121 
     | 
    
         
            +
                    attach_function :udp_recv_stop, :uv_udp_recv_stop, [:uv_udp_t], :int, :blocking => true
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
                    attach_function :tty_init, :uv_tty_init, [:uv_loop_t, :uv_tty_t, :uv_file, :int], :int, :blocking => true
         
     | 
| 
      
 124 
     | 
    
         
            +
                    attach_function :tty_set_mode, :uv_tty_set_mode, [:uv_tty_t, :int], :int, :blocking => true
         
     | 
| 
      
 125 
     | 
    
         
            +
                    attach_function :tty_reset_mode, :uv_tty_reset_mode, [], :void, :blocking => true
         
     | 
| 
      
 126 
     | 
    
         
            +
                    attach_function :tty_get_winsize, :uv_tty_get_winsize, [:uv_tty_t, :pointer, :pointer], :int, :blocking => true
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
                    attach_function :guess_handle, :uv_guess_handle, [:uv_file], :uv_handle_type, :blocking => true
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
      
 130 
     | 
    
         
            +
                    attach_function :pipe_init, :uv_pipe_init, [:uv_loop_t, :uv_pipe_t, :int], :int, :blocking => true
         
     | 
| 
      
 131 
     | 
    
         
            +
                    attach_function :pipe_open, :uv_pipe_open, [:uv_pipe_t, :uv_file], :void, :blocking => true
         
     | 
| 
      
 132 
     | 
    
         
            +
                    attach_function :pipe_bind, :uv_pipe_bind, [:uv_pipe_t, :string], :int, :blocking => true
         
     | 
| 
      
 133 
     | 
    
         
            +
                    attach_function :pipe_connect, :uv_pipe_connect, [:uv_connect_t, :uv_pipe_t, :string, :uv_connect_cb], :void, :blocking => true
         
     | 
| 
      
 134 
     | 
    
         
            +
                    attach_function :pipe_pending_instances, :uv_pipe_pending_instances, [:uv_pipe_t, :int], :void, :blocking => true
         
     | 
| 
      
 135 
     | 
    
         
            +
                    attach_function :pipe_pending_count, :uv_pipe_pending_count, [:uv_pipe_t], :int, :blocking => true
         
     | 
| 
      
 136 
     | 
    
         
            +
                    attach_function :pipe_pending_type, :uv_pipe_pending_type, [:uv_pipe_t], :uv_handle_type, :blocking => true
         
     | 
| 
      
 137 
     | 
    
         
            +
                    attach_function :pipe_getsockname, :uv_pipe_getsockname, [:uv_pipe_t, :pointer, :pointer], :int, :blocking => true
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                    attach_function :prepare_init, :uv_prepare_init, [:uv_loop_t, :uv_prepare_t], :int, :blocking => true
         
     | 
| 
      
 140 
     | 
    
         
            +
                    attach_function :prepare_start, :uv_prepare_start, [:uv_prepare_t, :uv_prepare_cb], :int, :blocking => true
         
     | 
| 
      
 141 
     | 
    
         
            +
                    attach_function :prepare_stop, :uv_prepare_stop, [:uv_prepare_t], :int, :blocking => true
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
                    attach_function :check_init, :uv_check_init, [:uv_loop_t, :uv_check_t], :int, :blocking => true
         
     | 
| 
      
 144 
     | 
    
         
            +
                    attach_function :check_start, :uv_check_start, [:uv_check_t, :uv_check_cb], :int, :blocking => true
         
     | 
| 
      
 145 
     | 
    
         
            +
                    attach_function :check_stop, :uv_check_stop, [:uv_check_t], :int, :blocking => true
         
     | 
| 
      
 146 
     | 
    
         
            +
             
     | 
| 
      
 147 
     | 
    
         
            +
                    attach_function :idle_init, :uv_idle_init, [:uv_loop_t, :uv_idle_t], :int, :blocking => true
         
     | 
| 
      
 148 
     | 
    
         
            +
                    attach_function :idle_start, :uv_idle_start, [:uv_idle_t, :uv_idle_cb], :int, :blocking => true
         
     | 
| 
      
 149 
     | 
    
         
            +
                    attach_function :idle_stop, :uv_idle_stop, [:uv_idle_t], :int, :blocking => true
         
     | 
| 
      
 150 
     | 
    
         
            +
             
     | 
| 
      
 151 
     | 
    
         
            +
                    attach_function :async_init, :uv_async_init, [:uv_loop_t, :uv_async_t, :uv_async_cb], :int, :blocking => true
         
     | 
| 
      
 152 
     | 
    
         
            +
                    attach_function :async_send, :uv_async_send, [:uv_async_t], :int, :blocking => true
         
     | 
| 
      
 153 
     | 
    
         
            +
             
     | 
| 
      
 154 
     | 
    
         
            +
                    attach_function :timer_init, :uv_timer_init, [:uv_loop_t, :uv_timer_t], :int, :blocking => true
         
     | 
| 
      
 155 
     | 
    
         
            +
                    attach_function :timer_start, :uv_timer_start, [:uv_timer_t, :uv_timer_cb, :int64_t, :int64_t], :int, :blocking => true
         
     | 
| 
      
 156 
     | 
    
         
            +
                    attach_function :timer_stop, :uv_timer_stop, [:uv_timer_t], :int, :blocking => true
         
     | 
| 
      
 157 
     | 
    
         
            +
                    attach_function :timer_again, :uv_timer_again, [:uv_timer_t], :int, :blocking => true
         
     | 
| 
      
 158 
     | 
    
         
            +
                    attach_function :timer_set_repeat, :uv_timer_set_repeat, [:uv_timer_t, :int64_t], :void, :blocking => true
         
     | 
| 
      
 159 
     | 
    
         
            +
                    attach_function :timer_get_repeat, :uv_timer_get_repeat, [:uv_timer_t], :int64_t, :blocking => true
         
     | 
| 
      
 160 
     | 
    
         
            +
            #:addrinfo
         
     | 
| 
      
 161 
     | 
    
         
            +
                    attach_function :getaddrinfo, :uv_getaddrinfo, [:uv_loop_t, :uv_getaddrinfo_t, :uv_getaddrinfo_cb, :string, :string, UvAddrinfo.by_ref], :int, :blocking => true
         
     | 
| 
      
 162 
     | 
    
         
            +
                    attach_function :freeaddrinfo, :uv_freeaddrinfo, [UvAddrinfo.by_ref], :void, :blocking => true
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
                    attach_function :spawn, :uv_spawn, [:uv_loop_t, :uv_process_t, :uv_options_t], :int, :blocking => true
         
     | 
| 
      
 165 
     | 
    
         
            +
                    attach_function :process_kill, :uv_process_kill, [:uv_process_t, :int], :int, :blocking => true
         
     | 
| 
      
 166 
     | 
    
         
            +
                    attach_function :kill, :uv_kill, [:int, :int], :int, :blocking => true
         
     | 
| 
      
 167 
     | 
    
         
            +
                    attach_function :queue_work, :uv_queue_work, [:uv_loop_t, :uv_work_t, :uv_work_cb, :uv_after_work_cb], :int, :blocking => true
         
     | 
| 
      
 168 
     | 
    
         
            +
                    attach_function :cancel, :uv_cancel, [:pointer], :int, :blocking => true
         
     | 
| 
      
 169 
     | 
    
         
            +
                    attach_function :setup_args, :uv_setup_args, [:int, :varargs], :pointer, :blocking => true
         
     | 
| 
      
 170 
     | 
    
         
            +
                    attach_function :get_process_title, :uv_get_process_title, [:pointer, :size_t], :int, :blocking => true
         
     | 
| 
      
 171 
     | 
    
         
            +
                    attach_function :set_process_title, :uv_set_process_title, [:string], :int, :blocking => true
         
     | 
| 
      
 172 
     | 
    
         
            +
                    attach_function :resident_set_memory, :uv_resident_set_memory, [:size_t], :int, :blocking => true
         
     | 
| 
      
 173 
     | 
    
         
            +
             
     | 
| 
      
 174 
     | 
    
         
            +
                    attach_function :uptime, :uv_uptime, [:pointer], :int, :blocking => true
         
     | 
| 
      
 175 
     | 
    
         
            +
                    attach_function :cpu_info, :uv_cpu_info, [:uv_cpu_info_t, :pointer], :int, :blocking => true
         
     | 
| 
      
 176 
     | 
    
         
            +
                    attach_function :loadavg, :uv_loadavg, [:pointer], :void, :blocking => true
         
     | 
| 
      
 177 
     | 
    
         
            +
                    attach_function :free_cpu_info, :uv_free_cpu_info, [:uv_cpu_info_t, :int], :void, :blocking => true
         
     | 
| 
      
 178 
     | 
    
         
            +
                    attach_function :interface_addresses, :uv_interface_addresses, [:uv_interface_address_t, :pointer], :int, :blocking => true
         
     | 
| 
      
 179 
     | 
    
         
            +
                    attach_function :free_interface_addresses, :uv_free_interface_addresses, [:uv_interface_address_t, :int], :void, :blocking => true
         
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
      
 181 
     | 
    
         
            +
                    attach_function :fs_req_cleanup, :uv_fs_req_cleanup, [:uv_fs_t], :void, :blocking => true
         
     | 
| 
      
 182 
     | 
    
         
            +
                    attach_function :fs_close, :uv_fs_close, [:uv_loop_t, :uv_fs_t, :uv_file, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 183 
     | 
    
         
            +
                    attach_function :fs_open, :uv_fs_open, [:uv_loop_t, :uv_fs_t, :string, :int, :int, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 184 
     | 
    
         
            +
                    attach_function :fs_read, :uv_fs_read, [:uv_loop_t, :uv_fs_t, :uv_file, :pointer, :uint, :off_t, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 185 
     | 
    
         
            +
                    attach_function :fs_unlink, :uv_fs_unlink, [:uv_loop_t, :uv_fs_t, :string, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 186 
     | 
    
         
            +
                    attach_function :fs_write, :uv_fs_write, [:uv_loop_t, :uv_fs_t, :uv_file, :pointer, :uint, :off_t, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 187 
     | 
    
         
            +
                    attach_function :fs_mkdir, :uv_fs_mkdir, [:uv_loop_t, :uv_fs_t, :string, :int, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 188 
     | 
    
         
            +
                    attach_function :fs_rmdir, :uv_fs_rmdir, [:uv_loop_t, :uv_fs_t, :string, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 189 
     | 
    
         
            +
                    attach_function :fs_readdir, :uv_fs_readdir, [:uv_loop_t, :uv_fs_t, :string, :int, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 190 
     | 
    
         
            +
                    attach_function :fs_stat, :uv_fs_stat, [:uv_loop_t, :uv_fs_t, :string, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 191 
     | 
    
         
            +
                    attach_function :fs_fstat, :uv_fs_fstat, [:uv_loop_t, :uv_fs_t, :uv_file, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 192 
     | 
    
         
            +
                    attach_function :fs_rename, :uv_fs_rename, [:uv_loop_t, :uv_fs_t, :string, :string, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 193 
     | 
    
         
            +
                    attach_function :fs_fsync, :uv_fs_fsync, [:uv_loop_t, :uv_fs_t, :uv_file, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 194 
     | 
    
         
            +
                    attach_function :fs_fdatasync, :uv_fs_fdatasync, [:uv_loop_t, :uv_fs_t, :uv_file, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 195 
     | 
    
         
            +
                    attach_function :fs_ftruncate, :uv_fs_ftruncate, [:uv_loop_t, :uv_fs_t, :uv_file, :off_t, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 196 
     | 
    
         
            +
                    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
         
     | 
| 
      
 197 
     | 
    
         
            +
                    attach_function :fs_chmod, :uv_fs_chmod, [:uv_loop_t, :uv_fs_t, :string, :int, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 198 
     | 
    
         
            +
                    attach_function :fs_utime, :uv_fs_utime, [:uv_loop_t, :uv_fs_t, :string, :double, :double, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 199 
     | 
    
         
            +
                    attach_function :fs_futime, :uv_fs_futime, [:uv_loop_t, :uv_fs_t, :uv_file, :double, :double, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 200 
     | 
    
         
            +
                    attach_function :fs_lstat, :uv_fs_lstat, [:uv_loop_t, :uv_fs_t, :string, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 201 
     | 
    
         
            +
                    attach_function :fs_link, :uv_fs_link, [:uv_loop_t, :uv_fs_t, :string, :string, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 202 
     | 
    
         
            +
                    attach_function :fs_symlink, :uv_fs_symlink, [:uv_loop_t, :uv_fs_t, :string, :string, :int, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 203 
     | 
    
         
            +
                    attach_function :fs_readlink, :uv_fs_readlink, [:uv_loop_t, :uv_fs_t, :string, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 204 
     | 
    
         
            +
                    attach_function :fs_fchmod, :uv_fs_fchmod, [:uv_loop_t, :uv_fs_t, :uv_file, :int, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 205 
     | 
    
         
            +
                    attach_function :fs_chown, :uv_fs_chown, [:uv_loop_t, :uv_fs_t, :string, :int, :int, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 206 
     | 
    
         
            +
                    attach_function :fs_fchown, :uv_fs_fchown, [:uv_loop_t, :uv_fs_t, :uv_file, :int, :int, :uv_fs_cb], :int, :blocking => true
         
     | 
| 
      
 207 
     | 
    
         
            +
             
     | 
| 
      
 208 
     | 
    
         
            +
                    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
         
     | 
| 
      
 209 
     | 
    
         
            +
             
     | 
| 
      
 210 
     | 
    
         
            +
                    attach_function :ip4_addr, :uv_ip4_addr, [:string, :int, :sockaddr_in4], :int, :blocking => true
         
     | 
| 
      
 211 
     | 
    
         
            +
                    attach_function :ip6_addr, :uv_ip6_addr, [:string, :int, :sockaddr_in6], :int, :blocking => true
         
     | 
| 
      
 212 
     | 
    
         
            +
                    attach_function :ip4_name, :uv_ip4_name, [:sockaddr_in4, :pointer, :size_t], :int, :blocking => true
         
     | 
| 
      
 213 
     | 
    
         
            +
                    attach_function :ip6_name, :uv_ip6_name, [:sockaddr_in6, :pointer, :size_t], :int, :blocking => true
         
     | 
| 
      
 214 
     | 
    
         
            +
                    #TODO:: attach_function :inet_ntop, :uv_inet_ntop, [:int, :pointer, ]
         
     | 
| 
      
 215 
     | 
    
         
            +
                    #TODO:: attach_function :uv_inet_pton
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
      
 217 
     | 
    
         
            +
                    attach_function :exepath, :uv_exepath, [:pointer, :size_t], :int, :blocking => true
         
     | 
| 
      
 218 
     | 
    
         
            +
                    attach_function :cwd, :uv_cwd, [:pointer, :size_t], :int, :blocking => true
         
     | 
| 
      
 219 
     | 
    
         
            +
                    attach_function :chdir, :uv_chdir, [:string], :int, :blocking => true
         
     | 
| 
      
 220 
     | 
    
         
            +
                    attach_function :get_free_memory, :uv_get_free_memory, [], :uint64, :blocking => true
         
     | 
| 
      
 221 
     | 
    
         
            +
                    attach_function :get_total_memory, :uv_get_total_memory, [], :uint64, :blocking => true
         
     | 
| 
      
 222 
     | 
    
         
            +
                    attach_function :hrtime, :uv_hrtime, [], :uint64, :blocking => true
         
     | 
| 
      
 223 
     | 
    
         
            +
                    attach_function :disable_stdio_inheritance, :uv_disable_stdio_inheritance, [], :void, :blocking => true
         
     | 
| 
      
 224 
     | 
    
         
            +
                    attach_function :dlopen, :uv_dlopen, [:string, :uv_lib_t], :int, :blocking => true
         
     | 
| 
      
 225 
     | 
    
         
            +
                    attach_function :dlclose, :uv_dlclose, [:uv_lib_t], :int, :blocking => true
         
     | 
| 
      
 226 
     | 
    
         
            +
                    attach_function :dlsym, :uv_dlsym, [:uv_lib_t, :string, :pointer], :int, :blocking => true
         
     | 
| 
      
 227 
     | 
    
         
            +
                    attach_function :dlerror, :uv_dlerror, [:uv_lib_t], :string
         
     | 
| 
      
 228 
     | 
    
         
            +
             
     | 
| 
      
 229 
     | 
    
         
            +
                    attach_function :mutex_init, :uv_mutex_init, [:uv_mutex_t], :int, :blocking => true
         
     | 
| 
      
 230 
     | 
    
         
            +
                    attach_function :mutex_destroy, :uv_mutex_destroy, [:uv_mutex_t], :void, :blocking => true
         
     | 
| 
      
 231 
     | 
    
         
            +
                    attach_function :mutex_lock, :uv_mutex_lock, [:uv_mutex_t], :void, :blocking => true
         
     | 
| 
      
 232 
     | 
    
         
            +
                    attach_function :mutex_trylock, :uv_mutex_trylock, [:uv_mutex_t], :int, :blocking => true
         
     | 
| 
      
 233 
     | 
    
         
            +
                    attach_function :mutex_unlock, :uv_mutex_unlock, [:uv_mutex_t], :void, :blocking => true
         
     | 
| 
      
 234 
     | 
    
         
            +
             
     | 
| 
      
 235 
     | 
    
         
            +
                    attach_function :signal_init, :uv_signal_init, [:uv_loop_t, :uv_signal_t], :int, :blocking => true
         
     | 
| 
      
 236 
     | 
    
         
            +
                    attach_function :signal_start, :uv_signal_start, [:uv_signal_t, :uv_signal_cb, :int], :int, :blocking => true
         
     | 
| 
      
 237 
     | 
    
         
            +
                    attach_function :signal_stop, :uv_signal_stop, [:uv_signal_t], :int, :blocking => true
         
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
      
 239 
     | 
    
         
            +
                    attach_function :rwlock_init, :uv_rwlock_init, [:uv_rwlock_t], :int, :blocking => true
         
     | 
| 
      
 240 
     | 
    
         
            +
                    attach_function :rwlock_destroy, :uv_rwlock_destroy, [:uv_rwlock_t], :void, :blocking => true
         
     | 
| 
      
 241 
     | 
    
         
            +
                    attach_function :rwlock_rdlock, :uv_rwlock_rdlock, [:uv_rwlock_t], :void, :blocking => true
         
     | 
| 
      
 242 
     | 
    
         
            +
                    attach_function :rwlock_tryrdlock, :uv_rwlock_tryrdlock, [:uv_rwlock_t], :int, :blocking => true
         
     | 
| 
      
 243 
     | 
    
         
            +
                    attach_function :rwlock_rdunlock, :uv_rwlock_rdunlock, [:uv_rwlock_t], :void, :blocking => true
         
     | 
| 
      
 244 
     | 
    
         
            +
                    attach_function :rwlock_wrlock, :uv_rwlock_wrlock, [:uv_rwlock_t], :void, :blocking => true
         
     | 
| 
      
 245 
     | 
    
         
            +
                    attach_function :rwlock_trywrlock, :uv_rwlock_trywrlock, [:uv_rwlock_t], :int, :blocking => true
         
     | 
| 
      
 246 
     | 
    
         
            +
                    attach_function :rwlock_wrunlock, :uv_rwlock_wrunlock, [:uv_rwlock_t], :void, :blocking => true
         
     | 
| 
      
 247 
     | 
    
         
            +
             
     | 
| 
      
 248 
     | 
    
         
            +
                    attach_function :once, :uv_once, [:uv_once_t, :uv_cb], :void, :blocking => true
         
     | 
| 
      
 249 
     | 
    
         
            +
                    attach_function :thread_create, :uv_thread_create, [:uv_thread_t, :uv_cb], :int, :blocking => true
         
     | 
| 
      
 250 
     | 
    
         
            +
                    attach_function :thread_join, :uv_thread_join, [:uv_thread_t], :int, :blocking => true
         
     | 
| 
      
 251 
     | 
    
         
            +
             
     | 
| 
      
 252 
     | 
    
         
            +
             
     | 
| 
      
 253 
     | 
    
         
            +
                    def self.create_handle(type)
         
     | 
| 
      
 254 
     | 
    
         
            +
                        LIBC.malloc(Ext.handle_size(type))
         
     | 
| 
      
 255 
     | 
    
         
            +
                    end
         
     | 
| 
      
 256 
     | 
    
         
            +
             
     | 
| 
      
 257 
     | 
    
         
            +
                    def self.create_request(type)
         
     | 
| 
      
 258 
     | 
    
         
            +
                        LIBC.malloc(Ext.req_size(type))
         
     | 
| 
      
 259 
     | 
    
         
            +
                    end
         
     | 
| 
      
 260 
     | 
    
         
            +
                end
         
     | 
| 
       259 
261 
     | 
    
         
             
            end
         
     |