Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: getmntinfo compatibility question



On Fri, Feb 14, 2025 at 09:22:54AM +0100, Thomas Klausner wrote:
> Perhaps we need to add code like FreeBSD has (to rust libc):
> https://github.com/rust-lang/libc/blob/2258bf0fb96767bcffbe3ed09b29a31ee54b549b/src/unix/bsd/freebsdlike/freebsd/mod.rs#L5340
> 
>     #[cfg_attr(
>         all(target_os = "freebsd", freebsd11),
>         link_name = "getmntinfo@FBSD_1.0"
>     )]
>     pub fn getmntinfo(mntbufp: *mut *mut crate::statfs, mode: c_int) -> c_int;
> 
> to use the proper version of getmntinfo, the one with the first
> version of statvfs. What name would that be now, '__getmntinfo13'?

Yes, this diff to rust-libc:

diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs
index 1840015e..9cb7aaa5 100644
--- a/src/unix/bsd/netbsdlike/netbsd/mod.rs
+++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs
@@ -2849,7 +2849,7 @@ extern "C" {
         ntargets: size_t,
         hint: *const c_void,
     ) -> c_int;
-
+    #[link_name = "__getmntinfo13"]
     pub fn getmntinfo(mntbufp: *mut *mut crate::statvfs, flags: c_int) -> c_int;
     pub fn getvfsstat(buf: *mut statvfs, bufsize: size_t, flags: c_int) -> c_int;
 }

fixes the problem for me.
 Thomas


Home | Main Index | Thread Index | Old Index