File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1+ //! # FIXES:
2+ //! The number is identical to the number in the GitHub issue tracker
3+ //!
4+ //! ## FIX ISSUE #5
5+ //! See: https://github.com/PacktPublishing/Asynchronous-Programming-in-Rust/issues/5
6+ //! Readers reported wrong results when running the example on ARM64 instruction set
7+ //! (aarch64). The reason turned out to be that the `Event` struct is only `repr(packed)`
8+ //! on `x86-64` systems due to backwards compatibility. Fixed by conditionally
9+ //! compiling the #[repr(packed)] attribute.
10+
111pub const EPOLL_CTL_ADD : i32 = 1 ;
212pub const EPOLLIN : i32 = 0x1 ;
313pub const EPOLLET : i32 = 1 << 31 ;
@@ -11,7 +21,9 @@ extern "C" {
1121}
1222
1323#[ derive( Debug ) ]
14- #[ repr( C , packed) ]
24+ #[ repr( C ) ]
25+ // FIX #5
26+ #[ cfg_attr( target_arch = "x86_64" , repr( packed) ) ]
1527pub struct Event {
1628 pub ( crate ) events : u32 ,
1729 // Token to identify event
You can’t perform that action at this time.
0 commit comments