Skip to content

Commit 7e96216

Browse files
committed
std: Use Android LFS off64_t, ftruncate64, and lseek64
Android should use 64-bit LFS symbols for `lseek` and `ftruncate`, lest those offset parameters suffer a lossy cast down to a 32-bit `off_t`. Unlike GNU/Linux, Android's `stat`, `dirent`, and related functions are always 64-bit LFS compatible, and `open` already implies `O_LARGEFILE`, so all those don't need to follow Linux. It might be nice to unify them anyway, but those other LFS symbols aren't present in API 18 bionic. r? @alexcrichton
1 parent a2fb48e commit 7e96216

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/liblibc

src/libstd/sys/unix/fs.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ use sys_common::{AsInner, FromInner};
2727

2828
#[cfg(target_os = "linux")]
2929
use libc::{stat64, fstat64, lstat64, off64_t, ftruncate64, lseek64, dirent64, readdir64_r, open64};
30-
#[cfg(not(target_os = "linux"))]
30+
#[cfg(target_os = "android")]
31+
use libc::{stat as stat64, fstat as fstat64, lstat as lstat64, off64_t, ftruncate64, lseek64,
32+
dirent as dirent64, open as open64};
33+
#[cfg(not(any(target_os = "linux", target_os = "android")))]
3134
use libc::{stat as stat64, fstat as fstat64, lstat as lstat64, off_t as off64_t,
3235
ftruncate as ftruncate64, lseek as lseek64, dirent as dirent64, open as open64};
3336
#[cfg(not(any(target_os = "linux", target_os = "solaris")))]

0 commit comments

Comments
 (0)