Skip to content

Commit 599fd27

Browse files
committed
Deal with suseconds_t
For 32 bit linux with GNU glibc and _TIME_BITS=64, the generated C tests for the members of timeval will fail if the struct member tv_usec is of type suseconds_txt: suseconds_t* __test_field_type_timeval_tv_usec(struct timeval* b) { return &b->tv_usec; } Where timeval.tv_usec is actually __suseconds64_t (64 bits) while suseconds_t is still 32 bits.
1 parent a6f3bde commit 599fd27

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/unix/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ s! {
6666

6767
pub struct timeval {
6868
pub tv_sec: time_t,
69+
#[cfg(not(all(target_env = "gnu", target_os = "linux", target_pointer_width = "32")))]
6970
pub tv_usec: suseconds_t,
71+
// For 64 bit time on 32 bit linux glibc, suseconds_t is still
72+
// a 32 bit type. Using it here will break the tests.
73+
#[cfg(all(target_env = "gnu", target_os = "linux", target_pointer_width = "32"))]
74+
pub tv_usec: i64
7075
}
7176

7277
// linux x32 compatibility

0 commit comments

Comments
 (0)