| 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 | #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 | } |