Skip to content

Commit 8e80e6e

Browse files
committed
Fix build errors on s390x
- Disable MAP_SYNC until rust-lang/libc#2395 - Handle non-standard statfs member types on s390x.
1 parent 4387aea commit 8e80e6e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/imp/libc/fs/types.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,11 @@ pub type RawMode = libc::mode_t;
695695
pub type Dev = libc::dev_t;
696696

697697
/// `__fsword_t`
698-
#[cfg(all(target_os = "linux", not(target_env = "musl")))]
698+
#[cfg(all(
699+
target_os = "linux",
700+
not(target_env = "musl"),
701+
not(target_arch = "s390x")
702+
))]
699703
pub type FsWord = libc::__fsword_t;
700704

701705
/// `__fsword_t`
@@ -708,10 +712,15 @@ pub type FsWord = u32;
708712
/// `__fsword_t`
709713
#[cfg(all(
710714
any(target_os = "android", all(target_os = "linux", target_env = "musl")),
715+
not(target_arch = "s390x"),
711716
target_pointer_width = "64"
712717
))]
713718
pub type FsWord = u64;
714719

720+
// s390x uses u32 for statfs entries, even though __fsword_t is u64.
721+
#[cfg(all(target_os = "linux", target_arch = "s390x"))]
722+
pub type FsWord = u32;
723+
715724
#[cfg(not(target_os = "redox"))]
716725
pub use libc::{UTIME_NOW, UTIME_OMIT};
717726

src/imp/libc/io/types.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ bitflags! {
228228
target_os = "netbsd",
229229
target_os = "openbsd",
230230
target_os = "redox",
231+
// TODO: Enable s390x once <https://github.com/rust-lang/libc/pull/2395> lands.
232+
target_arch = "s390x",
231233
)))]
232234
const SYNC = libc::MAP_SYNC;
233235
/// `MAP_UNINITIALIZED`

0 commit comments

Comments
 (0)