From: Tianhao Wang <shrik3@mailbox.org>
otherwise it may cause alignment issue
Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
Suggested-by: Yiliang Dong <dongyiliangsteven@163.com>
---
qlib/kernel/kernel/epoll/epoll.rs | 2 ++
qlib/linux_def.rs | 2 ++
2 files changed, 4 insertions(+)
diff --git a/qlib/kernel/kernel/epoll/epoll.rs b/qlib/kernel/kernel/epoll/epoll.rs
index 5094f678..2e922ad4 100644
--- a/qlib/kernel/kernel/epoll/epoll.rs
+++ b/qlib/kernel/kernel/epoll/epoll.rs
@@ -49,6 +49,7 @@ pub unsafe fn InitSingleton() {
// format to avoid extra copying/allocation when writing events to userspace.
#[cfg(target_arch = "x86_64")]
#[derive(Default, Clone, Copy, Debug)]
+#[repr(packed)]
#[repr(C)]
pub struct Event {
// Events is the event mask containing the set of events that have been
@@ -62,6 +63,7 @@ pub struct Event {
#[cfg(target_arch = "aarch64")]
#[derive(Default, Clone, Copy, Debug)]
+#[repr(packed)]
#[repr(C)]
pub struct Event {
// Events is the event mask containing the set of events that have been
diff --git a/qlib/linux_def.rs b/qlib/linux_def.rs
index 4941cd12..db6d991f 100644
--- a/qlib/linux_def.rs
+++ b/qlib/linux_def.rs
@@ -260,6 +260,7 @@ pub struct LibcSysinfo {
}
#[cfg(target_arch = "x86_64")]
+#[repr(packed)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct EpollEvent {
@@ -268,6 +269,7 @@ pub struct EpollEvent {
}
#[cfg(target_arch = "aarch64")]
+#[repr(packed)]
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct EpollEvent {
--
2.45.1