Sha256: 6b5b3ba9d32a6a8b60a0a6ce0915aaaea78fa485611a0c05c5f7635dc47e11c5

Contents?: true

Size: 800 Bytes

Versions: 21

Compression:

Stored size: 800 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    module Solaris
      module FFI
        module Ioctl
          extend ::FFI::Library
          ffi_lib ::FFI::Library::LIBC, 'socket'

          attach_function :ioctl_base, :ioctl, %i[int int pointer], :int
          attach_function :open_socket, :socket, %i[int int int], :int
          attach_function :close_socket, :shutdown, %i[int int], :int
          attach_function :inet_ntop, %i[int pointer pointer uint], :string

          def self.ioctl(call_const, pointer, address_family = AF_INET)
            fd = Ioctl.open_socket(address_family, SOCK_DGRAM, 0)
            result = ioctl_base(fd, call_const, pointer)
            Ioctl.close_socket(fd, 2)
            result
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
facter-4.4.0 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.3.1 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.3.0 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.14 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.13 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.12 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.11 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.10 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.9 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.8 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.7 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.6 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.5 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.4 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.3 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.2 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.1 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.2.0 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.1.1 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.1.0 lib/facter/resolvers/solaris/ffi/functions.rb