commit c7a49e70a89323abc71a2e49f41aed887160d318
parent 9ee8fe809269a3c3c0973a75559ef7e952a7cd3b
Author: Drew DeVault <sir@cmpwn.com>
Date: Sun, 14 Mar 2021 16:24:40 -0400
rt: add ppoll, shim poll over it
poll is not supported on aarch64
Diffstat:
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/rt/+linux/syscalls.ha b/rt/+linux/syscalls.ha
@@ -310,9 +310,22 @@ export fn getcwd() (*const char | errno) = {
return &pathbuf: *const char;
};
+export fn ppoll(
+ fds: *pollfd,
+ nfds: nfds_t,
+ timeout: const nullable *timespec,
+ sigmask: const nullable *sigset,
+) (int | errno) = {
+ return wrap_return(syscall4(SYS_ppoll, fds: uintptr: u64, nfds: u64,
+ timeout: uintptr: u64, sigmask: uintptr: u64))?: int;
+};
+
export fn poll(fds: *pollfd, nfds: nfds_t, timeout: int) (int | errno) = {
- return wrap_return(syscall3(SYS_poll,
- fds: uintptr: u64, nfds: u64, timeout: u64))?: int;
+ const ts = timespec {
+ tv_sec = timeout % 1000,
+ tv_nsec = timeout * 1000000,
+ };
+ return ppoll(fds, nfds, (if (timeout != -1) &ts else null), null);
};
export fn epoll_create1(flags: int) (int | errno) = {