Skip to content

Commit 9719bae

Browse files
author
Steve McFarlin
committed
Conditionaly compile based on architecture
This is in reference to issue PacktPublishing#5 I have also removed a redundant guard per advice from clippy
1 parent a660e60 commit 9719bae

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ch04/a-epoll/src/ffi.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,23 @@ extern "C" {
1111
}
1212

1313
#[derive(Debug)]
14+
#[cfg(not(target_arch = "aarch64"))]
1415
#[repr(C, packed)]
1516
pub struct Event {
1617
pub(crate) events: u32,
1718
// Token to identify event
1819
pub(crate) epoll_data: usize,
1920
}
2021

22+
#[derive(Debug)]
23+
#[cfg(target_arch = "aarch64")]
24+
#[repr(C)]
25+
pub struct Event {
26+
pub(crate) events: u32,
27+
// Token to identify event
28+
pub(crate) epoll_data: usize,
29+
}
30+
2131
impl Event {
2232
pub fn token(&self) -> usize {
2333
self.epoll_data

ch04/a-epoll/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fn handle_events(
4949

5050
loop {
5151
match streams[index].read(&mut data) {
52-
Ok(n) if n == 0 => {
52+
Ok(0) => {
5353
// FIX #4
5454
// `insert` returns false if the value already existed in the set. We
5555
// handle it here since we must be sure that the TcpStream is fully

0 commit comments

Comments
 (0)