From 8057d1a52637025bea1100560c9ac0846005d16f Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Fri, 27 Oct 2023 06:53:49 +0300 Subject: [PATCH] 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 52c079e2ed9..b8471ba6979 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 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"))]