Sha256: 9a220eb0118a5d42ff55658894afb6034ab8c7483c55b4b66430d02ff1e5a7ad

Contents?: true

Size: 819 Bytes

Versions: 8

Compression:

Stored size: 819 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, :close, %i[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)
            begin
              ioctl_base(fd, call_const, pointer)
            ensure
              Ioctl.close_socket(fd)
            end
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
facter-4.10.0 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.9.0 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.8.0 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.7.1 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.7.0 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.6.1 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.6.0 lib/facter/resolvers/solaris/ffi/functions.rb
facter-4.5.2 lib/facter/resolvers/solaris/ffi/functions.rb