mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
fix(os_linux): call ppoll instead on arm64
This commit is contained in:
@@ -440,9 +440,7 @@ pollfd :: struct {
|
|||||||
|
|
||||||
nfds_t :: distinct c.uint
|
nfds_t :: distinct c.uint
|
||||||
|
|
||||||
sigset_t :: struct {
|
sigset_t :: distinct u64
|
||||||
__val: [16]c.ulong,
|
|
||||||
}
|
|
||||||
|
|
||||||
foreign libc {
|
foreign libc {
|
||||||
@(link_name="__errno_location") __errno_location :: proc() -> ^int ---
|
@(link_name="__errno_location") __errno_location :: proc() -> ^int ---
|
||||||
|
|||||||
@@ -2079,9 +2079,24 @@ sys_select :: proc "contextless" (nfds: int, readfds, writefds, exceptfds: rawpt
|
|||||||
}
|
}
|
||||||
|
|
||||||
sys_poll :: proc "contextless" (fds: rawptr, nfds: uint, timeout: int) -> int {
|
sys_poll :: proc "contextless" (fds: rawptr, nfds: uint, timeout: int) -> int {
|
||||||
|
// NOTE: specialcased here because `arm64` does not have `poll`
|
||||||
|
when ODIN_ARCH != .arm64 {
|
||||||
|
// redefined because we can't depend on the `unix` module here
|
||||||
|
timespec :: struct {
|
||||||
|
tv_sec: i64,
|
||||||
|
tv_nsec: i64,
|
||||||
|
}
|
||||||
|
seconds := i64(timeout / 1_000)
|
||||||
|
nanoseconds := i64((timeout % 1000) * 1_000_000)
|
||||||
|
timeout_spec := timespec{seconds, nanoseconds}
|
||||||
|
|
||||||
|
return int(intrinsics.syscall(SYS_ppoll, uintptr(fds), uintptr(nfds), uintptr(&timeout_spec), uintptr(0), uintptr(8)))
|
||||||
|
} else {
|
||||||
return int(intrinsics.syscall(SYS_poll, uintptr(fds), uintptr(nfds), uintptr(timeout)))
|
return int(intrinsics.syscall(SYS_poll, uintptr(fds), uintptr(nfds), uintptr(timeout)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
sys_ppoll :: proc "contextless" (fds: rawptr, nfds: uint, timeout: rawptr, sigmask: rawptr, sigsetsize: uint) -> int {
|
sys_ppoll :: proc "contextless" (fds: rawptr, nfds: uint, timeout: rawptr, sigmask: rawptr, sigsetsize: uint) -> int {
|
||||||
return int(intrinsics.syscall(SYS_ppoll, uintptr(fds), uintptr(nfds), uintptr(timeout), uintptr(sigmask), uintptr(sigsetsize)))
|
return int(intrinsics.syscall(SYS_ppoll, uintptr(fds), uintptr(nfds), uintptr(timeout), uintptr(sigmask), uintptr(sigsetsize)))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user