profile
viewpoint

Ask questionsmusl: Change `time_t` definition on 32-bit targets according to "time64"

time_t is defined as c_long on musl: https://github.com/rust-lang/libc/blob/b1268e43cd34ebc95d184928296fc73740cd5162/src/unix/linux_like/linux/musl/mod.rs#L3 and c_long is i32 on 32-bit targets: https://github.com/rust-lang/libc/blob/b1268e43cd34ebc95d184928296fc73740cd5162/src/unix/linux_like/linux/musl/b32/mod.rs#L1 But the time_t definition has been changed to 64-bit by https://github.com/bminor/musl/commit/38143339646a4ccce8afe298c34467767c899f51, since musl 1.2.0. We will change our type to i64 on 32-bit targets as well at some point but we should announce it before changing. cc #1846

rust-lang/libc

Answer questions mahkoh

Isn't this broken either way as soon as C libraries are involved or am I missing something?

As documented in time64.html, C code compiled against >=1.2 assumes time_t = i64 whereas code compiled against <1.2 assumes time_t = i32 on 32 bit systems. If you use a C library that uses time_t in its interface (e.g. openssl), the time_t used by rust code must have the same size as in the musl headers.

useful!

Related questions

Add TCP FastOpen support for macOS - libc hot 1
source:https://uonfu.com/
Github User Rank List