diff --git a/libc-test/build.rs b/libc-test/build.rs index 25126877d450..726684ea17b0 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -4785,7 +4785,7 @@ fn test_linux(target: &str) { }); cfg.skip_struct(|s| match s.ident() { "utimbuf" | "timeval" | "timespec" | "rusage" | "itimerval" | "itimerspec" - | "timex" | "ntptimeval" | "stat" | "shmid_ds" | "msqid_ds" => true, + | "timex" | "ntptimeval" | "stat" | "shmid_ds" | "msqid_ds" | "input_event" => true, _ => false, }); diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index e54dd5ef685b..4a77121d62e6 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -225,21 +225,22 @@ s! { } pub struct input_event { - // FIXME(1.0): Change to the commented variant, see https://github.com/rust-lang/libc/pull/4148#discussion_r1857511742 + // input_event_sec and input_event_usec are preprocessor macros in C. + // On all variants _except_ 32-bit long and 64-bit time_t they actually + // refer to members of input_event.time, a timeval struct. + // The timeval struct has two members of type time_t and suseconds_t. #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))] - pub time: crate::timeval, - // #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))] - // pub input_event_sec: time_t, - // #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))] - // pub input_event_usec: suseconds_t, - // #[cfg(target_arch = "sparc64")] - // _pad1: c_int, + pub input_event_sec: crate::time_t, #[cfg(all(target_pointer_width = "32", linux_time_bits64))] pub input_event_sec: c_ulong, + #[cfg(any(target_pointer_width = "64", not(linux_time_bits64)))] + pub input_event_usec: crate::suseconds_t, #[cfg(all(target_pointer_width = "32", linux_time_bits64))] pub input_event_usec: c_ulong, + #[cfg(target_arch = "sparc64")] + _pad1: Padding, pub type_: __u16, pub code: __u16, pub value: __s32,