Skip to content

Commit

Permalink
freebsd: fix the 'df' command
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kostikbel committed Oct 27, 2023
1 parent 6085cf1 commit 8057d1a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/uucore/src/lib/features/fsext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check failure on line 373 in src/uucore/src/lib/features/fsext.rs

View workflow job for this annotation

GitHub Actions / Style/spelling (ubuntu-latest, feat_os_unix)

ERROR: Unknown word (getmntinfo) (file:'src/uucore/src/lib/features/fsext.rs', line:373)
// 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"))]
Expand Down

0 comments on commit 8057d1a

Please sign in to comment.