Skip to content

Commit

Permalink
Merge pull request #73 from tatokis/i686-64-bit-offset-fix
Browse files Browse the repository at this point in the history
Add padding on 32 bit statvfs with 64 bit offsets
  • Loading branch information
djberg96 authored Sep 30, 2024
2 parents cab3a4b + 305b6b7 commit 7b6cdb1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/sys/unix/sys/filesystem/structs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ def self.linux64?
:f_spare, [:int, 5]
)
else
layout(
require 'mkmf-lite'
extend Mkmf::Lite
layout_array = [
:f_bsize, :ulong,
:f_frsize, :ulong,
:f_blocks, :uint64,
Expand All @@ -241,7 +243,16 @@ def self.linux64?
:f_namemax, :ulong,
:f_type, :uint,
:f_spare, [:int, 5]
)
]

# Check if we need to add __f_unused
f_unused_bytes = 2 * check_sizeof('int') - check_sizeof('long')
if f_unused_bytes > 0
# For Big Endian, this should be inserted at -9
layout_array.insert(-7, :__f_unused, [:char, f_unused_bytes])
end

layout(*layout_array)
end
end

Expand Down

0 comments on commit 7b6cdb1

Please sign in to comment.