Skip to content

Commit

Permalink
HACK: use i64 for time_t on musl
Browse files Browse the repository at this point in the history
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
  • Loading branch information
colincross committed Oct 20, 2022
1 parent fdd70d4 commit d8ad45f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions patches/musl_time_t.patch
@@ -0,0 +1,13 @@
diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs
index 70710734..929108ce 100644
--- a/src/unix/linux_like/linux/musl/mod.rs
+++ b/src/unix/linux_like/linux/musl/mod.rs
@@ -9,7 +9,7 @@ pub type clock_t = c_long;
See #1848 for more info."
)
)]
-pub type time_t = c_long;
+pub type time_t = i64;
pub type suseconds_t = c_long;
pub type ino_t = u64;
pub type off_t = i64;
2 changes: 1 addition & 1 deletion src/unix/linux_like/linux/musl/mod.rs
Expand Up @@ -9,7 +9,7 @@ pub type clock_t = c_long;
See #1848 for more info."
)
)]
pub type time_t = c_long;
pub type time_t = i64;
pub type suseconds_t = c_long;
pub type ino_t = u64;
pub type off_t = i64;
Expand Down

0 comments on commit d8ad45f

Please sign in to comment.