From 84391411b091a6c30f09fbb5fd11464ea68700f0 Mon Sep 17 00:00:00 2001 From: xb-bx Date: Tue, 2 Sep 2025 10:35:38 +0300 Subject: [PATCH 1/2] fix(sys/linux): wrong use of epoll_pwait syscall on arm64 & riscv64 --- core/sys/linux/sys.odin | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/core/sys/linux/sys.odin b/core/sys/linux/sys.odin index deb22726fc4..2d756a7ac8c 100644 --- a/core/sys/linux/sys.odin +++ b/core/sys/linux/sys.odin @@ -2477,18 +2477,8 @@ exit_group :: proc "contextless" (code: i32) -> ! { Available since Linux 2.6. */ epoll_wait :: proc(epfd: Fd, events: [^]EPoll_Event, count: i32, timeout: i32) -> (i32, Errno) { - when ODIN_ARCH != .arm64 && ODIN_ARCH != .riscv64 { - ret := syscall(SYS_epoll_wait, epfd, events, count, timeout) - return errno_unwrap(ret, i32) - } else { - // Convert milliseconds to nanosecond timespec - timeout_ns := Time_Spec { - time_sec = uint(timeout * 1000), - time_nsec = 0, - } - ret := syscall(SYS_epoll_pwait, epfd, events, count, &timeout_ns, rawptr(nil)) - return errno_unwrap(ret, i32) - } + ret := syscall(SYS_epoll_pwait, epfd, events, count, timeout, rawptr(nil)) + return errno_unwrap(ret, i32) } /* From d5fad39c3274c6f6b4c88d4c8975b480f98fa433 Mon Sep 17 00:00:00 2001 From: xb-bx Date: Tue, 2 Sep 2025 15:10:31 +0300 Subject: [PATCH 2/2] fix(sys/linux): EPoll_Event should only be packed on x86/x86_64 --- core/sys/linux/types.odin | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/core/sys/linux/types.odin b/core/sys/linux/types.odin index c2948c36edf..7e1ab446094 100644 --- a/core/sys/linux/types.odin +++ b/core/sys/linux/types.odin @@ -1446,9 +1446,16 @@ EPoll_Data :: struct #raw_union { u64: u64, } -EPoll_Event :: struct #packed { - events: EPoll_Event_Set, - data: EPoll_Data, +when ODIN_ARCH == .amd64 || ODIN_ARCH == .i386 { + EPoll_Event :: struct #packed { + events: EPoll_Event_Set, + data: EPoll_Data, + } +} else { + EPoll_Event :: struct { + events: EPoll_Event_Set, + data: EPoll_Data, + } } /*