Skip to content

Commit 399a0a5

Browse files
committed
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 #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.
1 parent 2364caf commit 399a0a5

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/fuchsia/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ pub type socklen_t = u32;
3838
pub type pthread_t = c_ulong;
3939
pub type mode_t = u32;
4040
pub type ino64_t = u64;
41+
#[deprecated(
42+
since = "1.0.0",
43+
note = "Use `off_t` instead. The `libc` crate is on track to solely supporting 64-bit types, \
44+
so the suffixed variants are to be deprecated. See #PENDING for details and discussion."
45+
)]
4146
pub type off64_t = i64;
4247
pub type blkcnt64_t = i64;
4348
pub type rlim64_t = u64;
@@ -3797,6 +3802,11 @@ extern "C" {
37973802

37983803
pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int;
37993804
pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int;
3805+
// FIXME(msrv): once we bump MSRV past stabilization of `expect` and the
3806+
// `reason` attribute parameter, mention that this symbol is not meant for
3807+
// deprecation, but one of its parameters just may be (pending further
3808+
// discussion.)
3809+
#[allow(deprecated)]
38003810
pub fn readahead(fd: c_int, offset: off64_t, count: size_t) -> ssize_t;
38013811
pub fn signalfd(fd: c_int, mask: *const crate::sigset_t, flags: c_int) -> c_int;
38023812
pub fn timerfd_create(clockid: c_int, flags: c_int) -> c_int;
@@ -3837,6 +3847,11 @@ extern "C" {
38373847
pub fn mkfifoat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
38383848
pub fn if_nameindex() -> *mut if_nameindex;
38393849
pub fn if_freenameindex(ptr: *mut if_nameindex);
3850+
// FIXME(msrv): once we bump MSRV past stabilization of `expect` and the
3851+
// `reason` attribute parameter, mention that this symbol is not meant for
3852+
// deprecation, but one of its parameters just may be (pending further
3853+
// discussion.)
3854+
#[allow(deprecated)]
38403855
pub fn sync_file_range(fd: c_int, offset: off64_t, nbytes: off64_t, flags: c_uint) -> c_int;
38413856
pub fn getifaddrs(ifap: *mut *mut crate::ifaddrs) -> c_int;
38423857
pub fn freeifaddrs(ifa: *mut crate::ifaddrs);

0 commit comments

Comments
 (0)