From ddbf270607e7b68c3cf130c767332b180b39f70b Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Sun, 31 May 2026 12:10:09 +0200 Subject: [PATCH] refactor: deprecate `off64_t` type in fuchsia The `off64_t` type may be meant for deprecation, though this may not be the case after all. This patch targets the fact that we expose such type in Fuchsia even though that target seems to support definitions from different standard C library implementations. For one, the musl library should be left unmodified, as briefly mentioned in rust-lang/libc#3248. This patch would be useless if the only definition that the Fuchsia project sources from is musl's. But they also vendor the LLVM Libc project, for which we do not have any exceptions set in place at the time of writing. Finally, there's the override that the Fuchsia devs have as a non-vendored dependency over Android Bionic. This seems to add as well the `off64_t` type. In theory, we should only allow exposing the bit-suffixed variants in musl and targets using musl. I am inclined to leave this definition and not deprecate it, as that would mean prioritizing the definition under the vendores sources of the Zircon kernel. Still, external input would be appreciated. --- src/fuchsia/mod.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/fuchsia/mod.rs b/src/fuchsia/mod.rs index 51abedcb8fc10..9ccabacc3f17d 100644 --- a/src/fuchsia/mod.rs +++ b/src/fuchsia/mod.rs @@ -38,6 +38,11 @@ pub type socklen_t = u32; pub type pthread_t = c_ulong; pub type mode_t = u32; pub type ino64_t = u64; +#[deprecated( + since = "0.2.187", + note = "Use `off_t` instead. The `libc` crate is on track to solely supporting 64-bit types, \ + so the suffixed variants are to be deprecated. See #PENDING for details and discussion." +)] pub type off64_t = i64; pub type blkcnt64_t = i64; pub type rlim64_t = u64; @@ -3797,6 +3802,11 @@ extern "C" { pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int; pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; + // FIXME(msrv): once we bump MSRV past stabilization of `expect` and the + // `reason` attribute parameter, mention that this symbol is not meant for + // deprecation, but one of its parameters just may be (pending further + // discussion.) + #[allow(deprecated)] pub fn readahead(fd: c_int, offset: off64_t, count: size_t) -> ssize_t; pub fn signalfd(fd: c_int, mask: *const crate::sigset_t, flags: c_int) -> c_int; pub fn timerfd_create(clockid: c_int, flags: c_int) -> c_int; @@ -3837,6 +3847,11 @@ extern "C" { pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int; pub fn if_nameindex() -> *mut if_nameindex; pub fn if_freenameindex(ptr: *mut if_nameindex); + // FIXME(msrv): once we bump MSRV past stabilization of `expect` and the + // `reason` attribute parameter, mention that this symbol is not meant for + // deprecation, but one of its parameters just may be (pending further + // discussion.) + #[allow(deprecated)] pub fn sync_file_range(fd: c_int, offset: off64_t, nbytes: off64_t, flags: c_uint) -> c_int; pub fn getifaddrs(ifap: *mut *mut crate::ifaddrs) -> c_int; pub fn freeifaddrs(ifa: *mut crate::ifaddrs);