xref: /aosp_15_r20/external/musl/src/select/poll.c (revision c9945492fdd68bbe62686c5b452b4dc1be3f8453)
1 #include <poll.h>
2 #include <time.h>
3 #include <signal.h>
4 #include "syscall.h"
5 
poll(struct pollfd * fds,nfds_t n,int timeout)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 #if SYS_ppoll_time64 == SYS_ppoll
12 	typedef long long ppoll_ts_t[2];
13 #else
14 	typedef long ppoll_ts_t[2];
15 #endif
16 	return syscall_cp(SYS_ppoll, fds, n, timeout>=0 ?
17 		((ppoll_ts_t){ timeout/1000, timeout%1000*1000000 }) : 0,
18 		0, _NSIG/8);
19 #endif
20 }
21