From 6312c7210147ffb385ed43c9ae81723d928ba908 Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Mon, 1 Jun 2026 18:28:17 +0200 Subject: [PATCH 1/2] newlib: change definition of `time_t` The `newlib` module uses a faulty definition for `time_t`. That type falls back to a 32-bit signed integer definition except in `horizon` and `espidf`. The option to opt out of a 64-bit `time_t` is configurable. There were other supported targets that had it enabled in their build scripts. These were still having `time_t` exposed as 64-bits wide. This patch fixes that. --- src/unix/newlib/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index a14cc1afe1bee..a1a1a7893ab5c 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -55,12 +55,12 @@ pub type useconds_t = u32; cfg_if! { if #[cfg(any( - target_os = "horizon", - all(target_os = "espidf", not(espidf_time32)) + all(target_os = "espidf", espidf_time32), + target_os = "vita" ))] { - pub type time_t = c_longlong; - } else { pub type time_t = i32; + } else { + pub type time_t = i64; } } From 1573775e81061ae38331b0e9c733c08bd69d9eff Mon Sep 17 00:00:00 2001 From: dybucc <149513579+dybucc@users.noreply.github.com> Date: Sun, 7 Jun 2026 13:08:10 +0200 Subject: [PATCH 2/2] newli: change definition of `off_t` The `off_t` type was being exposed as a 32-bit signed integer in targets where it was 64-bits wide. The same applies the other way around. This option is configurable. It is not configurable in the build scripts. The default definition is to have a C `long` as `off_t`. This can be altered in another header file. That file defines a macro after defininig the type alias. The macro is then checked in the header file with the default definition. A number of supported targets use this overriding behavior. The `libc` crate is not currently taking them all into consideration. This patch fixes that. --- src/unix/newlib/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index a1a1a7893ab5c..f79f1773c90f3 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -6,14 +6,14 @@ pub type blksize_t = i32; pub type clockid_t = c_ulong; cfg_if! { - if #[cfg(any(target_os = "espidf"))] { + if #[cfg(any( + target_os = "espidf", + target_os = "vita", + target_arch = "aarch64" + ))] { pub type dev_t = c_short; pub type ino_t = c_ushort; pub type off_t = c_long; - } else if #[cfg(any(target_os = "vita"))] { - pub type dev_t = c_short; - pub type ino_t = c_ushort; - pub type off_t = c_int; } else { pub type dev_t = u32; pub type ino_t = u32;