From 11f56a79af721fff2aab6f1472f6bf8297d5b605 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Fri, 27 Oct 2023 06:53:49 +0300 Subject: [PATCH 1/2] freebsd: fix the 'df' command df, and perhaps other commands, get the list of the mounted filesystems with the call to getmntinfo(3). Since Rust still use FreeBSD 11.x ABI for filesystem metadata call, it should use matching versioned symbol for getmntinfo from libc. --- src/uucore/src/lib/features/fsext.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index 52c079e2e..65f5a13b9 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -362,13 +362,19 @@ extern "C" { fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int; #[cfg(any( - target_os = "freebsd", target_os = "netbsd", target_os = "openbsd", all(target_vendor = "apple", target_arch = "aarch64") ))] #[link_name = "getmntinfo"] // spell-checker:disable-line fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int; + + // Rust on FreeBSD uses 11.x ABI for filesystem metadata syscalls. + // Call the right version of the symbol for getmntinfo() result to + // match libc StatFS layout. + #[cfg(target_os = "freebsd")] + #[link_name = "getmntinfo@FBSD_1.0"] // spell-checker:disable-line + fn get_mount_info(mount_buffer_p: *mut *mut StatFs, flags: c_int) -> c_int; } #[cfg(any(target_os = "linux", target_os = "android"))] From 9f63ae6645c21d7674397c0ece79e3ec6810c154 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 27 Oct 2023 14:25:41 +0200 Subject: [PATCH 2/2] fsext: add getmntinfo to spell-checker:ignore --- src/uucore/src/lib/features/fsext.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uucore/src/lib/features/fsext.rs b/src/uucore/src/lib/features/fsext.rs index 65f5a13b9..5c2121d69 100644 --- a/src/uucore/src/lib/features/fsext.rs +++ b/src/uucore/src/lib/features/fsext.rs @@ -5,7 +5,7 @@ //! Set of functions to manage file systems -// spell-checker:ignore DATETIME subsecond (arch) bitrig ; (fs) cifs smbfs +// spell-checker:ignore DATETIME getmntinfo subsecond (arch) bitrig ; (fs) cifs smbfs use time::macros::format_description; use time::UtcOffset;