]> git.proxmox.com Git - wasi-libc.git/blob - libc-top-half/musl/src/select/poll.c
WASI libc prototype implementation.
[wasi-libc.git] / libc-top-half / musl / src / select / poll.c
1 #include <poll.h>
2 #include <time.h>
3 #include <signal.h>
4 #include "syscall.h"
5
6 int poll(struct pollfd *fds, nfds_t n, int timeout)
7 {
8 #ifdef SYS_poll
9 return syscall_cp(SYS_poll, fds, n, timeout);
10 #else
11 return syscall_cp(SYS_ppoll, fds, n, timeout>=0 ?
12 &((struct timespec){ .tv_sec = timeout/1000,
13 .tv_nsec = timeout%1000*1000000 }) : 0, 0, _NSIG/8);
14 #endif
15 }