Skip to content

Commit cbbeb49

Browse files
committed
gnu: Update struct timespec for _TIME_BITS=64
Big-endian platforms wants 32 bits of padding before tv_nsec, little-endian after. GNU libc always uses long for tv_nsec.
1 parent d7ae4c1 commit cbbeb49

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/unix/mod.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,14 @@ s! {
7474
// See https://sourceware.org/bugzilla/show_bug.cgi?id=16437
7575
pub struct timespec {
7676
pub tv_sec: time_t,
77-
#[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
77+
#[cfg(all(gnu_time64_abi, target_endian = "big"))]
78+
__pad: i32,
79+
#[cfg(all(not(target_env = "gnu"), target_arch = "x86_64", target_pointer_width = "32"))]
7880
pub tv_nsec: i64,
79-
#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
81+
#[cfg(any(target_env = "gnu", not(all(target_arch = "x86_64", target_pointer_width = "32"))))]
8082
pub tv_nsec: ::c_long,
83+
#[cfg(all(gnu_time64_abi, target_endian = "little"))]
84+
__pad: i32,
8185
}
8286

8387
pub struct rlimit {

0 commit comments

Comments
 (0)