Skip to content

Commit d8ad45f

Browse files
committed
HACK: use i64 for time_t on musl
Musl has use a 64-bit time_t since 1.2.0, but rust still uses the old 32-bit time_t on 32-bit platforms. rust-lang/libc#2088 will eventually fix this, but until then use i64 for time_t on musl in our tree. This will break binary compatibility with rust crates built against musl outside our tree, but those shouldn't get mixed with our tree. Bug: 216192129 Test: m USE_HOST_MUSL=true host-native -k Change-Id: Iaafd06e180514157015607be50f625cb0661e1b8
1 parent fdd70d4 commit d8ad45f

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

patches/musl_time_t.patch

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs
2+
index 70710734..929108ce 100644
3+
--- a/src/unix/linux_like/linux/musl/mod.rs
4+
+++ b/src/unix/linux_like/linux/musl/mod.rs
5+
@@ -9,7 +9,7 @@ pub type clock_t = c_long;
6+
See #1848 for more info."
7+
)
8+
)]
9+
-pub type time_t = c_long;
10+
+pub type time_t = i64;
11+
pub type suseconds_t = c_long;
12+
pub type ino_t = u64;
13+
pub type off_t = i64;

src/unix/linux_like/linux/musl/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub type clock_t = c_long;
99
See #1848 for more info."
1010
)
1111
)]
12-
pub type time_t = c_long;
12+
pub type time_t = i64;
1313
pub type suseconds_t = c_long;
1414
pub type ino_t = u64;
1515
pub type off_t = i64;

0 commit comments

Comments
 (0)