1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

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.
This commit is contained in:
Konstantin Belousov 2023-10-27 06:53:49 +03:00
parent 6085cf12e3
commit 11f56a79af

View file

@ -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"))]