diff --git a/src/lib.rs b/src/lib.rs index 1a096c2934..955e756ee7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -69,7 +69,7 @@ mod macros; // type that allows larger offsets to be used. We define our own off_t type // that is large enough to represent all file offsets the platform supports. cfg_if! { - if #[cfg(all(target_os = "linux", target_env = "gnu"))] { + if #[cfg(any(all(target_os = "linux", target_env = "gnu"), target_env = "uclibc"))] { /// Used to represent offsets in files. May differ from libc::off_t /// on platforms where libc::off_t cannot represent the full range /// of file offsets. diff --git a/src/macros.rs b/src/macros.rs index d85b0da8cf..410e72e142 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -333,7 +333,7 @@ macro_rules! libc_enum { } cfg_if! { - if #[cfg(all(target_os = "linux", target_env = "gnu"))] { + if #[cfg(any(all(target_os = "linux", target_env = "gnu"), target_env = "uclibc"))] { /// Function variant that supports large file positions. /// /// On some platforms, the standard I/O functions support a limited diff --git a/src/sys/uio.rs b/src/sys/uio.rs index e90890120f..a9240fe8e4 100644 --- a/src/sys/uio.rs +++ b/src/sys/uio.rs @@ -50,9 +50,6 @@ pub fn pwritev>( iov: &[IoSlice<'_>], offset: Off, ) -> Result { - #[cfg(target_env = "uclibc")] - let offset = offset as libc::off64_t; // uclibc doesn't use off_t - // SAFETY: same as in writev() let res = unsafe { largefile_fn![pwritev]( @@ -80,9 +77,6 @@ pub fn preadv>( iov: &mut [IoSliceMut<'_>], offset: Off, ) -> Result { - #[cfg(target_env = "uclibc")] - let offset = offset as libc::off64_t; // uclibc doesn't use off_t - // SAFETY: same as in readv() let res = unsafe { largefile_fn![preadv](