Skip to content

Commit

Permalink
use off64_t and *64() functions on uclibc, too
Browse files Browse the repository at this point in the history
  • Loading branch information
inglorion committed Jul 1, 2023
1 parent beb22da commit 4d35ffa
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions src/sys/uio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ pub fn pwritev<Fd: AsFd, Off: Into<off_t>>(
iov: &[IoSlice<'_>],
offset: Off,
) -> Result<usize> {
#[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](
Expand Down Expand Up @@ -80,9 +77,6 @@ pub fn preadv<Fd: AsFd, Off: Into<off_t>>(
iov: &mut [IoSliceMut<'_>],
offset: Off,
) -> Result<usize> {
#[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](
Expand Down

0 comments on commit 4d35ffa

Please sign in to comment.