Skip to content

Commit c39833e

Browse files
committed
Rollup merge of rust-lang#23070 - krdln:fix-stat-arm, r=alexcrichton
This separates definitions of struct stat and other typedefs between Android and Linux on ARM (Android has a non-standard one). This makes functions such as `File::metadata()` work correctly and makes one able to check file's size. All tests from std (and also run-pass: stat.rs) now pass on ARM Linux. Fixes rust-lang#20007.
2 parents 7a12c03 + 29938ff commit c39833e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/liblibc/lib.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ pub mod types {
383383
target_arch = "mips",
384384
target_arch = "mipsel",
385385
target_arch = "powerpc",
386-
target_arch = "le32"))]
386+
target_arch = "le32",
387+
all(target_arch = "arm", not(target_os = "android"))))]
387388
pub mod posix88 {
388389
pub type off_t = i32;
389390
pub type dev_t = u64;
@@ -395,7 +396,7 @@ pub mod types {
395396
pub type mode_t = u32;
396397
pub type ssize_t = i32;
397398
}
398-
#[cfg(target_arch = "arm")]
399+
#[cfg(all(target_arch = "arm", target_os = "android"))]
399400
pub mod posix88 {
400401
pub type off_t = i32;
401402
pub type dev_t = u32;
@@ -409,7 +410,8 @@ pub mod types {
409410
}
410411
#[cfg(any(target_arch = "x86",
411412
target_arch = "le32",
412-
target_arch = "powerpc"))]
413+
target_arch = "powerpc",
414+
all(target_arch = "arm", not(target_os = "android"))))]
413415
pub mod posix01 {
414416
use types::os::arch::c95::{c_short, c_long, time_t};
415417
use types::os::arch::posix88::{dev_t, gid_t, ino_t};
@@ -455,7 +457,7 @@ pub mod types {
455457
pub __size: [u32; 9]
456458
}
457459
}
458-
#[cfg(target_arch = "arm")]
460+
#[cfg(all(target_arch = "arm", target_os = "android"))]
459461
pub mod posix01 {
460462
use types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t};
461463
use types::os::arch::c99::{c_longlong, c_ulonglong};

0 commit comments

Comments
 (0)