From 1bd2f8c857f3f6736cc2bc35b16f0560f2c4a597 Mon Sep 17 00:00:00 2001 From: Tasos Sahanidis Date: Fri, 27 Sep 2024 04:18:51 +0300 Subject: [PATCH] Add f_type field to struct statvfs It's been added in both glibc and musl. Glibc has been zeroing out the spare ints since the dawn of time and musl since at least 1.0.0, so it's safe to simply check if these values are nonzero. --- lib/sys/unix/sys/filesystem/structs.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/sys/unix/sys/filesystem/structs.rb b/lib/sys/unix/sys/filesystem/structs.rb index 0b7243f..a055190 100644 --- a/lib/sys/unix/sys/filesystem/structs.rb +++ b/lib/sys/unix/sys/filesystem/structs.rb @@ -223,7 +223,8 @@ def self.linux64? :f_unused, :int, :f_flag, :ulong, :f_namemax, :ulong, - :f_spare, [:int, 6] + :f_type, :uint, + :f_spare, [:int, 5] ) else layout( @@ -238,7 +239,8 @@ def self.linux64? :f_fsid, :ulong, :f_flag, :ulong, :f_namemax, :ulong, - :f_spare, [:int, 6] + :f_type, :uint, + :f_spare, [:int, 5] ) end end