Sha256: 3f385d878c1f3a998dd4ead8b2c70138fa18e978ecaf69ff4abc57edc58c0faa

Contents?: true

Size: 1.67 KB

Versions: 40

Compression:

Stored size: 1.67 KB

Contents

require 'ffi'

module KQueue
  # This module contains the low-level foreign-function interface code
  # for dealing with the kqueue C APIs.
  # It's an implementation detail, and not meant for users to deal with.
  #
  # @private
  module Native
    extend FFI::Library

    # The C struct describing a kqueue event.
    #
    # @private
    class KEvent < FFI::Struct
      if FFI::Platform::IS_FREEBSD
        layout(
          :ident,  :uintptr_t,
          :filter, :short,
          :flags,  :u_short,
          :fflags, :u_int,
          :data,   :intptr_t,
          :udata,  :pointer)
      elsif FFI::Platform::IS_NETBSD
        layout(
          :ident,  :uintptr_t,
          :filter, :uint32_t,
          :flags,  :uint32_t,
          :fflags, :uint32_t,
          :data,   :int64_t,
          :udata,  :pointer)
      elsif FFI::Platform::IS_OPENBSD
        layout(
          :ident,  :__uintptr_t,
          :filter, :short,
          :flags,  :u_short,
          :fflags, :u_int,
          :data,   :quad_t,
          :udata,  :pointer)
      else
        layout(
          :ident,  :uintptr_t,
          :filter, :int16,
          :flags,  :uint16,
          :fflags, :uint32,
          :data,   :intptr_t,
          :udata,  :pointer)
      end
    end

    # The C struct describing a timeout.
    #
    # @private
    class TimeSpec < FFI::Struct
      layout(
        :tv_sec, :time_t,
        :tv_nsec, :long)
    end

    ffi_lib FFI::Library::LIBC

    attach_function :kqueue, [], :int
    attach_function :kevent, [:int, :pointer, :int, :pointer, :int, :pointer], :int, :blocking => true

    attach_function :open, [:string, :int], :int
    attach_function :close, [:int], :int
  end
end

Version data entries

40 entries across 32 versions & 3 rubygems

Version Path
rb-kqueue-0.2.8 lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/gems/rb-kqueue-0.2.7/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/gems/rb-kqueue-0.2.7/lib/rb-kqueue/native.rb
rb-kqueue-0.2.7 lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/gems/rb-kqueue-0.2.6/lib/rb-kqueue/native.rb
rb-kqueue-0.2.6 lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.7.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.6.2 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.6.1 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.6.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.6.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.5.0 vendor/bundle/ruby/2.5.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb
vagrant-unbundled-2.2.4.0 vendor/bundle/ruby/2.5.0/gems/rb-kqueue-0.2.5/lib/rb-kqueue/native.rb