diff --git a/Cargo.toml b/Cargo.toml index bcca102820..17becc2f3b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ targets = [ ] [dependencies] -libc = { version = "=0.2.175", features = ["extra_traits"] } +libc = { version = "=0.2.178", features = ["extra_traits"] } bitflags = "2.3.3" cfg-if = "1.0" pin-utils = { version = "0.1.0", optional = true } diff --git a/changelog/2714.fixed.md b/changelog/2714.fixed.md new file mode 100644 index 0000000000..6ff6146dc1 --- /dev/null +++ b/changelog/2714.fixed.md @@ -0,0 +1 @@ +Define `timespec_tv_nsec_t` as 32-bit on both 32- and 64-bit AIX to match the platform ABI. diff --git a/src/sys/time.rs b/src/sys/time.rs index 7e89c72149..11b86efb23 100644 --- a/src/sys/time.rs +++ b/src/sys/time.rs @@ -199,11 +199,14 @@ const TS_MAX_SECONDS: i64 = isize::MAX as i64; const TS_MIN_SECONDS: i64 = -TS_MAX_SECONDS; +// AIX: libc::timespec.tv_nsec is 32-bit c_int on both 32- and 64-bit. +#[cfg(target_os = "aix")] +type timespec_tv_nsec_t = libc::c_int; // x32 compatibility // See https://sourceware.org/bugzilla/show_bug.cgi?id=16437 #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))] type timespec_tv_nsec_t = i64; -#[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))] +#[cfg(not(any(target_os = "aix", all(target_arch = "x86_64", target_pointer_width = "32"))))] type timespec_tv_nsec_t = libc::c_long; impl From for TimeSpec {