facter 4.4.2 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c01a91258966862aa3d5b43fca18899206b64cefa3fd42446ac1c012132e90ea
4
- data.tar.gz: 3e1c32c10e166a3dcb8ed55d709b4ce8cbe9c56b9238ed42964519caf48b82be
3
+ metadata.gz: 3bc6c44e0072feade1a48b1a15c423c6028dd18d66fd3edaed7aa7ae07ac4922
4
+ data.tar.gz: 452afdcc9dd049b23e43ea3623c5758c2447fec809a44680ab5928a65cd12b17
5
5
  SHA512:
6
- metadata.gz: a9f7a49e2297d1dd06b1544118e58a5cba75aa04a5991e61e3450039ff86caa934c30d1d7b584d4432a081d010be6f978f6bc6fef8cfdfa38367ec858f0a2754
7
- data.tar.gz: c7793db89e1fd72269eba0b1f195942020a60d699374b661cd87f418be2aff38cb128ab45d0959696e696601c0bb70b7715d85c5c6404bb1aa77e9727e5f659b
6
+ metadata.gz: 77e545e417001ef58de71b4aa470ebbb4e71349d19c64eafce67268c019f41e1367b6bb00acc1c6e24586ee39f751a3f652c6227f7ccd16e300b7a4b3fbe10d2
7
+ data.tar.gz: c605efaacef975278de37d8d091ab251228d4f1d8c139e103eb2b50cbf0f3d49feac1f0b8f4c9f724b2a44e25bf1d832853ec28f82d0588afebe61b8a22a02b6
@@ -53,6 +53,13 @@ module Facter
53
53
  # @api private
54
54
  attr_reader :fact
55
55
 
56
+ # @!attribute [r] last_evaluated
57
+ #
58
+ # @return [String]
59
+ #
60
+ # @api public
61
+ attr_reader :last_evaluated
62
+
56
63
  # Create a new aggregated resolution mechanism.
57
64
  #
58
65
  # @param name [String] The name of the resolution.
@@ -101,7 +108,15 @@ module Facter
101
108
  #
102
109
  # @api private
103
110
  def evaluate(&block)
111
+ if @last_evaluated
112
+ msg = "Already evaluated #{@name}"
113
+ msg << " at #{@last_evaluated}" if msg.is_a? String
114
+ msg << ', reevaluating anyways'
115
+ log.warn msg
116
+ end
104
117
  instance_eval(&block)
118
+
119
+ @last_evaluated = block.source_location.join(':')
105
120
  end
106
121
 
107
122
  # Define a new chunk for the given aggregate
@@ -85,7 +85,9 @@ module Facter
85
85
 
86
86
  resolve
87
87
  rescue StandardError => e
88
- log.log_exception("Unable to add resolve #{resolution_name.inspect} for fact #{@name}: #{e.message}")
88
+ msg = "Unable to add resolve #{resolution_name.inspect} for fact '#{@name}': #{e.message}"
89
+ msg += "\n" + e.backtrace.join("\n") if Options[:trace]
90
+ log.error(msg, true)
89
91
  nil
90
92
  end
91
93
 
@@ -223,8 +225,7 @@ module Facter
223
225
  end
224
226
 
225
227
  def log_fact_path(resolve)
226
- fact = resolve.fact
227
- log.debug("#{resolve.fact_type} fact #{fact.name} got resolved from: #{fact.location}")
228
+ log.debug("#{resolve.fact_type} fact #{resolve.fact.name} was resolved from: #{resolve.last_evaluated}")
228
229
  end
229
230
 
230
231
  def announce_when_no_suitable_resolution(resolutions)
@@ -96,14 +96,7 @@ module Facter
96
96
 
97
97
  instance_eval(&block)
98
98
 
99
- # Ruby 1.9+ provides the source location of procs which can provide useful
100
- # debugging information if a resolution is being evaluated twice. Since 1.8
101
- # doesn't support this we opportunistically provide this information.
102
- @last_evaluated = if block.respond_to? :source_location
103
- block.source_location.join(':')
104
- else
105
- true
106
- end
99
+ @last_evaluated = block.source_location.join(':')
107
100
  end
108
101
 
109
102
  # Sets options for the aggregate fact
@@ -6,6 +6,9 @@ module LegacyFacter
6
6
  def self.root?
7
7
  require_relative '../../../facter/resolvers/windows/ffi/identity_ffi'
8
8
  IdentityFFI.privileged?
9
+ rescue LoadError => e
10
+ log = Facter::Log.new(self)
11
+ log.debug("The ffi gem has not been installed: #{e}")
9
12
  end
10
13
  end
11
14
  end
@@ -10,23 +10,27 @@ module Facts
10
10
  macosx_productversion_patch].freeze
11
11
 
12
12
  def call_the_resolver
13
- fact_value = Facter::Resolvers::SwVers.resolve(:productversion)
14
- ver = version_hash(fact_value)
13
+ version_value = Facter::Resolvers::SwVers.resolve(:productversion)
14
+ extra_value = Facter::Resolvers::SwVers.resolve(:productversionextra)
15
+ ver = version_hash(version_value, extra_value)
15
16
 
16
17
  [Facter::ResolvedFact.new(FACT_NAME, ver),
17
- Facter::ResolvedFact.new(ALIASES[0], fact_value, :legacy),
18
+ Facter::ResolvedFact.new(ALIASES[0], version_value, :legacy),
18
19
  Facter::ResolvedFact.new(ALIASES[1], ver['major'], :legacy),
19
20
  Facter::ResolvedFact.new(ALIASES[2], ver['minor'], :legacy),
20
21
  Facter::ResolvedFact.new(ALIASES[3], ver['patch'], :legacy)]
21
22
  end
22
23
 
23
- def version_hash(fact_value)
24
- versions = fact_value.split('.')
24
+ def version_hash(version_value, extra_value)
25
+ versions = version_value.split('.')
25
26
  if versions[0] == '10'
26
- { 'full' => fact_value, 'major' => "#{versions[0]}.#{versions[1]}", 'minor' => versions[-1] }
27
- else
28
- { 'full' => fact_value, 'major' => versions[0], 'minor' => versions.fetch(1, '0'),
27
+ { 'full' => version_value, 'major' => "#{versions[0]}.#{versions[1]}", 'minor' => versions[-1] }
28
+ elsif /11|12/.match?(versions[0]) || extra_value.nil?
29
+ { 'full' => version_value, 'major' => versions[0], 'minor' => versions.fetch(1, '0'),
29
30
  'patch' => versions.fetch(2, '0') }
31
+ else
32
+ { 'full' => version_value, 'major' => versions[0], 'minor' => versions.fetch(1, '0'),
33
+ 'patch' => versions.fetch(2, '0'), 'extra' => extra_value }
30
34
  end
31
35
  end
32
36
  end
@@ -28,9 +28,13 @@ module Facter
28
28
  @fact_list[:interfaces] = Facter::Util::Linux::SocketParser.retrieve_interfaces(log)
29
29
  mtu_and_indexes = interfaces_mtu_and_index
30
30
 
31
- @fact_list[:interfaces].keys.each do |interface_name|
32
- mtu(interface_name, mtu_and_indexes)
33
- dhcp(interface_name, mtu_and_indexes)
31
+ @fact_list[:interfaces].each_pair do |interface_name, iface|
32
+ mtu(interface_name, mtu_and_indexes, iface)
33
+ dhcp(interface_name, mtu_and_indexes, iface)
34
+ operstate(interface_name, iface)
35
+ physical(interface_name, iface)
36
+ linkspeed(interface_name, iface)
37
+ duplex(interface_name, iface)
34
38
 
35
39
  @log.debug("Found interface #{interface_name} with #{@fact_list[:interfaces][interface_name]}")
36
40
  end
@@ -47,6 +51,43 @@ module Facter
47
51
  mtu_and_indexes
48
52
  end
49
53
 
54
+ def operstate(interface_name, iface)
55
+ state = Facter::Util::FileHelper.safe_read("/sys/class/net/#{interface_name}/operstate", nil)
56
+ iface[:operational_state] = state.strip if state
57
+ end
58
+
59
+ def physical(ifname, iface)
60
+ iface[:physical] = if File.exist?("/sys/class/net/#{ifname}/device")
61
+ true
62
+ else
63
+ false
64
+ end
65
+ end
66
+
67
+ def duplex(interface_name, iface)
68
+ return unless iface[:physical]
69
+
70
+ # not all interfaces support this, wifi for example causes an EINVAL (Invalid argument)
71
+ begin
72
+ plex = Facter::Util::FileHelper.safe_read("/sys/class/net/#{interface_name}/duplex", nil)
73
+ iface[:duplex] = plex.strip if plex
74
+ rescue StandardError => e
75
+ @log.debug("Failed to read '/sys/class/net/#{interface_name}/duplex': #{e.message}")
76
+ end
77
+ end
78
+
79
+ def linkspeed(interface_name, iface)
80
+ return unless iface[:physical]
81
+
82
+ # not all interfaces support this, wifi for example causes an EINVAL (Invalid argument)
83
+ begin
84
+ speed = Facter::Util::FileHelper.safe_read("/sys/class/net/#{interface_name}/speed", nil)
85
+ iface[:speed] = speed.strip.to_i if speed
86
+ rescue StandardError => e
87
+ @log.debug("Failed to read '/sys/class/net/#{interface_name}/speed': #{e.message}")
88
+ end
89
+ end
90
+
50
91
  def parse_ip_command_line(line, mtu_and_indexes)
51
92
  mtu = line.match(/mtu (\d+)/)&.captures&.first&.to_i
52
93
  index_tokens = line.split(':')
@@ -56,14 +97,14 @@ module Facter
56
97
  mtu_and_indexes[name] = { index: index, mtu: mtu }
57
98
  end
58
99
 
59
- def mtu(interface_name, mtu_and_indexes)
100
+ def mtu(interface_name, mtu_and_indexes, iface)
60
101
  mtu = mtu_and_indexes.dig(interface_name, :mtu)
61
- @fact_list[:interfaces][interface_name][:mtu] = mtu unless mtu.nil?
102
+ iface[:mtu] = mtu unless mtu.nil?
62
103
  end
63
104
 
64
- def dhcp(interface_name, mtu_and_indexes)
105
+ def dhcp(interface_name, mtu_and_indexes, iface)
65
106
  dhcp = Facter::Util::Linux::Dhcp.dhcp(interface_name, mtu_and_indexes.dig(interface_name, :index), log)
66
- @fact_list[:interfaces][interface_name][:dhcp] = dhcp unless dhcp.nil?
107
+ iface[:dhcp] = dhcp unless dhcp.nil?
67
108
  end
68
109
 
69
110
  def add_info_from_routing_table
@@ -7,6 +7,8 @@ module Facter
7
7
  include Facter::Util::Resolvers::FilesystemHelper
8
8
  init_resolver
9
9
 
10
+ @log = Facter::Log.new(self)
11
+
10
12
  class << self
11
13
  private
12
14
 
@@ -16,18 +18,21 @@ module Facter
16
18
 
17
19
  def read_mounts
18
20
  mounts = {}
21
+ begin
22
+ Facter::Util::Resolvers::FilesystemHelper.read_mountpoints.each do |fs|
23
+ device = fs.name
24
+ filesystem = fs.mount_type
25
+ path = fs.mount_point
26
+ options = read_options(fs.options)
19
27
 
20
- Facter::Util::Resolvers::FilesystemHelper.read_mountpoints.each do |fs|
21
- device = fs.name
22
- filesystem = fs.mount_type
23
- path = fs.mount_point
24
- options = read_options(fs.options)
25
-
26
- mounts[path] = read_stats(path).tap do |hash|
27
- hash[:device] = device
28
- hash[:filesystem] = filesystem
29
- hash[:options] = options if options.any?
28
+ mounts[path] = read_stats(path).tap do |hash|
29
+ hash[:device] = device
30
+ hash[:filesystem] = filesystem
31
+ hash[:options] = options if options.any?
32
+ end
30
33
  end
34
+ rescue LoadError => e
35
+ @log.debug("Could not read mounts: #{e}")
31
36
  end
32
37
 
33
38
  @fact_list[:mountpoints] = mounts
@@ -39,7 +44,7 @@ module Facter
39
44
  size_bytes = stats.bytes_total
40
45
  available_bytes = stats.bytes_available
41
46
  used_bytes = size_bytes - available_bytes
42
- rescue Sys::Filesystem::Error
47
+ rescue Sys::Filesystem::Error, LoadError
43
48
  size_bytes = used_bytes = available_bytes = 0
44
49
  end
45
50
 
@@ -45,14 +45,20 @@ module Facter
45
45
 
46
46
  def read_mounts(fact_name)
47
47
  mounts = []
48
- Facter::Util::Resolvers::FilesystemHelper.read_mountpoints.each do |file_system|
49
- mount = {}
50
- get_mount_data(file_system, mount)
51
-
52
- next if mount[:path] =~ %r{^/(proc|sys)} && mount[:filesystem] != 'tmpfs' || mount[:filesystem] == 'autofs'
53
-
54
- get_mount_sizes(mount)
55
- mounts << mount
48
+ begin
49
+ Facter::Util::Resolvers::FilesystemHelper.read_mountpoints.each do |file_system|
50
+ mount = {}
51
+ get_mount_data(file_system, mount)
52
+
53
+ if mount[:path] =~ %r{^/(proc|sys)} && mount[:filesystem] != 'tmpfs' || mount[:filesystem] == 'autofs'
54
+ next
55
+ end
56
+
57
+ get_mount_sizes(mount)
58
+ mounts << mount
59
+ end
60
+ rescue LoadError => e
61
+ @log.debug("Could not read mounts: #{e}")
56
62
  end
57
63
 
58
64
  @fact_list[:mountpoints] = mounts
@@ -70,7 +76,7 @@ module Facter
70
76
  begin
71
77
  stats = Facter::Util::Resolvers::FilesystemHelper.read_mountpoint_stats(mount[:path])
72
78
  get_bytes_data(mount, stats)
73
- rescue Sys::Filesystem::Error => e
79
+ rescue LoadError, Sys::Filesystem::Error => e
74
80
  @log.debug("Could not get stats for mountpoint #{mount[:path]}, got #{e}")
75
81
  mount[:size_bytes] = mount[:available_bytes] = mount[:used_bytes] = 0
76
82
  end
@@ -7,6 +7,8 @@ module Facter
7
7
  include Facter::Util::Resolvers::FilesystemHelper
8
8
  init_resolver
9
9
 
10
+ @log = Facter::Log.new(self)
11
+
10
12
  class << self
11
13
  private
12
14
 
@@ -24,31 +26,34 @@ module Facter
24
26
  def read_mounts(fact_name) # rubocop:disable Metrics/MethodLength
25
27
  @mounts = []
26
28
  @auto_home_paths = []
29
+ begin
30
+ Facter::Util::Resolvers::FilesystemHelper.read_mountpoints&.each do |fs|
31
+ if fs.name == 'auto_home'
32
+ @auto_home_paths << fs.mount_point
33
+ next
34
+ end
27
35
 
28
- Facter::Util::Resolvers::FilesystemHelper.read_mountpoints&.each do |fs|
29
- if fs.name == 'auto_home'
30
- @auto_home_paths << fs.mount_point
31
- next
32
- end
36
+ next if fs.mount_type == 'autofs'
33
37
 
34
- next if fs.mount_type == 'autofs'
38
+ mounts = {}
39
+ device = fs.name
40
+ filesystem = fs.mount_type
41
+ path = fs.mount_point
42
+ options = fs.options.split(',').map(&:strip)
35
43
 
36
- mounts = {}
37
- device = fs.name
38
- filesystem = fs.mount_type
39
- path = fs.mount_point
40
- options = fs.options.split(',').map(&:strip)
44
+ mounts = read_stats(path).tap do |hash|
45
+ hash[:device] = device
46
+ hash[:filesystem] = filesystem
47
+ hash[:path] = path
48
+ hash[:options] = options if options.any?
49
+ end
41
50
 
42
- mounts = read_stats(path).tap do |hash|
43
- hash[:device] = device
44
- hash[:filesystem] = filesystem
45
- hash[:path] = path
46
- hash[:options] = options if options.any?
51
+ @mounts << Hash[Facter::Util::Resolvers::FilesystemHelper::MOUNT_KEYS
52
+ .zip(Facter::Util::Resolvers::FilesystemHelper::MOUNT_KEYS
53
+ .map { |v| mounts[v] })]
47
54
  end
48
-
49
- @mounts << Hash[Facter::Util::Resolvers::FilesystemHelper::MOUNT_KEYS
50
- .zip(Facter::Util::Resolvers::FilesystemHelper::MOUNT_KEYS
51
- .map { |v| mounts[v] })]
55
+ rescue LoadError => e
56
+ @log.debug("Could not read mounts: #{e}")
52
57
  end
53
58
 
54
59
  exclude_auto_home_mounts!
@@ -64,7 +69,7 @@ module Facter
64
69
  available_bytes = stats.bytes_available.abs
65
70
  used_bytes = stats.bytes_used.abs
66
71
  total_bytes = used_bytes + available_bytes
67
- rescue Sys::Filesystem::Error
72
+ rescue Sys::Filesystem::Error, LoadError
68
73
  size_bytes = used_bytes = available_bytes = 0
69
74
  end
70
75
 
@@ -5,6 +5,7 @@ module Facter
5
5
  class SwVers < BaseResolver
6
6
  # :productname
7
7
  # :productversion
8
+ # :productversionextra
8
9
  # :buildversion
9
10
 
10
11
  init_resolver
@@ -23,6 +23,9 @@ module Facter
23
23
  arch = determine_architecture(hard)
24
24
  build_facts_list(hardware: hard, architecture: arch)
25
25
  @fact_list[fact_name]
26
+ rescue LoadError => e
27
+ log = Facter::Log.new(self)
28
+ log.debug("The ffi gem has not been installed: #{e}")
26
29
  end
27
30
 
28
31
  def determine_hardware(sys_info)
@@ -32,6 +32,8 @@ module Facter
32
32
  end
33
33
 
34
34
  { user: name_ptr.read_wide_string_with_length(size_ptr.read_uint32), privileged: IdentityFFI.privileged? }
35
+ rescue LoadError => e
36
+ @log.debug("Could not find username: #{e}")
35
37
  end
36
38
 
37
39
  def retrieve_facts(fact_name)
@@ -30,6 +30,8 @@ module Facter
30
30
  build_facts_list(result)
31
31
 
32
32
  @fact_list[fact_name]
33
+ rescue LoadError => e
34
+ @log.debug("Could not get OS version information: #{e}")
33
35
  end
34
36
 
35
37
  def build_facts_list(result)
@@ -28,6 +28,8 @@ module Facter
28
28
  @long_living_pointer = state_ptr
29
29
 
30
30
  PerformanceInformation.new(state_ptr)
31
+ rescue LoadError => e
32
+ @log.debug("Could not resolve memory facts: #{e}")
31
33
  end
32
34
 
33
35
  def calculate_memory
@@ -31,6 +31,8 @@ module Facter
31
31
  Facter::Util::Resolvers::Networking.expand_main_bindings(@fact_list)
32
32
 
33
33
  @fact_list[fact_name]
34
+ rescue LoadError => e
35
+ @log.debug("The ffi gem has not been installed: #{e}")
34
36
  end
35
37
 
36
38
  def get_adapter_addresses(size_ptr, adapter_addresses, flags)
@@ -31,6 +31,8 @@ module Facter
31
31
  end
32
32
 
33
33
  @fact_list[:system32] = construct_path(bool_ptr, windows_path)
34
+ rescue LoadError => e
35
+ @log.debug("Could not retrieve: #{e}")
34
36
  end
35
37
 
36
38
  def construct_path(bool_ptr, windows)
@@ -33,6 +33,9 @@ module Facter
33
33
  def codepage_from_api
34
34
  require_relative '../../../facter/resolvers/windows/ffi/winnls_ffi'
35
35
  WinnlsFFI.GetACP.to_s
36
+ rescue LoadError => e
37
+ log = Facter::Log.new(self)
38
+ log.debug("Could not retrieve codepage: #{e}")
36
39
  end
37
40
  end
38
41
  end
@@ -22,13 +22,12 @@ module Facter
22
22
  default_return
23
23
  end
24
24
 
25
+ # This previously acted as a helper method for versions of Ruby older
26
+ # than 2.5, before Dir.children was added. As it isn't a private
27
+ # method, we can't remove it entirely until the next major Facter
28
+ # release (presumably Facter 5).
25
29
  def dir_children(path)
26
- children = if RUBY_VERSION.to_f < 2.5
27
- Dir.entries(path).reject { |dir| ['.', '..'].include?(dir) }
28
- else
29
- Dir.children(path)
30
- end
31
-
30
+ children = Dir.children(path)
32
31
  children
33
32
  end
34
33
 
@@ -9,9 +9,7 @@ module Facter
9
9
  size_bytes used used_bytes capacity].freeze
10
10
  class << self
11
11
  def read_mountpoints
12
- # TODO: this require must be replaced with "require 'sys/filesystem'" when a new release of
13
- # djberg96/sys-filesystem gem is available
14
- require_relative '../../patches/sysfilesystem/sys/statvfs.rb'
12
+ require 'sys/filesystem'
15
13
  force_utf(Sys::Filesystem.mounts)
16
14
  end
17
15
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Facter
4
- VERSION = '4.4.2' unless defined?(VERSION)
4
+ VERSION = '4.5.0' unless defined?(VERSION)
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facter
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.2
4
+ version: 4.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-17 00:00:00.000000000 Z
11
+ date: 2023-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.15.5
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.15.5
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -106,14 +120,14 @@ dependencies:
106
120
  requirements:
107
121
  - - "~>"
108
122
  - !ruby/object:Gem::Version
109
- version: '1.3'
123
+ version: '1.4'
110
124
  type: :development
111
125
  prerelease: false
112
126
  version_requirements: !ruby/object:Gem::Requirement
113
127
  requirements:
114
128
  - - "~>"
115
129
  - !ruby/object:Gem::Version
116
- version: '1.3'
130
+ version: '1.4'
117
131
  - !ruby/object:Gem::Dependency
118
132
  name: webmock
119
133
  requirement: !ruby/object:Gem::Requirement
@@ -903,7 +917,6 @@ files:
903
917
  - lib/facter/models/loaded_fact.rb
904
918
  - lib/facter/models/resolved_fact.rb
905
919
  - lib/facter/models/searched_fact.rb
906
- - lib/facter/patches/sysfilesystem/sys/statvfs.rb
907
920
  - lib/facter/resolvers/aio_agent_version.rb
908
921
  - lib/facter/resolvers/aix/architecture.rb
909
922
  - lib/facter/resolvers/aix/disks.rb
@@ -1,92 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'sys/filesystem'
4
-
5
- module Sys
6
- class Filesystem
7
- module Structs
8
- class Statvfs < FFI::Struct
9
- # We must remove the instance variable layout defined by sys-filesystem, because setting
10
- # it the second time will make FFI log a warning message.
11
- remove_instance_variable(:@layout) if @layout
12
-
13
- if /darwin|osx|mach/i.match?(RbConfig::CONFIG['host_os'])
14
- layout(
15
- :f_bsize, :ulong,
16
- :f_frsize, :ulong,
17
- :f_blocks, :uint,
18
- :f_bfree, :uint,
19
- :f_bavail, :uint,
20
- :f_files, :uint,
21
- :f_ffree, :uint,
22
- :f_favail, :uint,
23
- :f_fsid, :ulong,
24
- :f_flag, :ulong,
25
- :f_namemax, :ulong
26
- )
27
- elsif /bsd/i.match?(RbConfig::CONFIG['host'])
28
- layout(
29
- :f_bavail, :uint64,
30
- :f_bfree, :uint64,
31
- :f_blocks, :uint64,
32
- :f_favail, :uint64,
33
- :f_ffree, :uint64,
34
- :f_files, :uint64,
35
- :f_bsize, :ulong,
36
- :f_flag, :ulong,
37
- :f_frsize, :ulong,
38
- :f_fsid, :ulong,
39
- :f_namemax, :ulong
40
- )
41
- elsif /sunos|solaris/i.match?(RbConfig::CONFIG['host'])
42
- layout(
43
- :f_bsize, :ulong,
44
- :f_frsize, :ulong,
45
- :f_blocks, :uint64_t,
46
- :f_bfree, :uint64_t,
47
- :f_bavail, :uint64_t,
48
- :f_files, :uint64_t,
49
- :f_ffree, :uint64_t,
50
- :f_favail, :uint64_t,
51
- :f_fsid, :ulong,
52
- :f_basetype, [:char, 16],
53
- :f_flag, :ulong,
54
- :f_namemax, :ulong,
55
- :f_fstr, [:char, 32],
56
- :f_filler, [:ulong, 16]
57
- )
58
- elsif /i686/i.match?(RbConfig::CONFIG['host'])
59
- layout(
60
- :f_bsize, :ulong,
61
- :f_frsize, :ulong,
62
- :f_blocks, :uint,
63
- :f_bfree, :uint,
64
- :f_bavail, :uint,
65
- :f_files, :uint,
66
- :f_ffree, :uint,
67
- :f_favail, :uint,
68
- :f_fsid, :ulong,
69
- :f_flag, :ulong,
70
- :f_namemax, :ulong,
71
- :f_spare, [:int, 6]
72
- )
73
- else
74
- layout(
75
- :f_bsize, :ulong,
76
- :f_frsize, :ulong,
77
- :f_blocks, :uint64,
78
- :f_bfree, :uint64,
79
- :f_bavail, :uint64,
80
- :f_files, :uint64,
81
- :f_ffree, :uint64,
82
- :f_favail, :uint64,
83
- :f_fsid, :ulong,
84
- :f_flag, :ulong,
85
- :f_namemax, :ulong,
86
- :f_spare, [:int, 6]
87
- )
88
- end
89
- end
90
- end
91
- end
92
- end