Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,21 +332,18 @@ s! {
}

pub struct input_event {
// FIXME(1.0): Change to the commented variant, see https://github.com/rust-lang/libc/pull/4148#discussion_r1857511742
#[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,
Comment on lines -335 to 338
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment that these are actually combined as timeval?


#[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: c_int,
Comment on lines +345 to +346
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to backport this part of the change. It is technically breaking but our definition is incorrect without it, and sparc64 isn't all that popular of a target. Would you be able to split this to a separate commit?

Padding fields should also get wrapped in Padding<...> now

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm - actually, I think this change may not be correct on its own. Looks like the __usec/input_event_usec field would also need to be changed from a long to an int https://github.com/torvalds/linux/blob/3f9f0252130e7dd60d41be0802bf58f6471c691d/include/uapi/linux/input.h#L35C6-L42.

We should probably do that change still to make sure users don't expect the upper half of that field to work, just annoying that sparc has a special-cased suseconds_t in the first place.

(context: torvalds/linux@2e74694)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, I see now that the field is of type suseconds_t. Sorry for the confusion; please disregard everything in this thread except for the Padding<...> bit.

pub type_: __u16,
pub code: __u16,
pub value: __s32,
Expand Down
Loading