From 148c1f77492a22ddfc87375c3b2464d5521a3843 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 28 Feb 2007 22:25:41 +0000 Subject: add support for ppoll() and emulate poll() with it when __NR_poll does not exist --- libc/sysdeps/linux/common/poll.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'libc/sysdeps/linux/common/poll.c') diff --git a/libc/sysdeps/linux/common/poll.c b/libc/sysdeps/linux/common/poll.c index 2d6da24b8..a8366cd27 100644 --- a/libc/sysdeps/linux/common/poll.c +++ b/libc/sysdeps/linux/common/poll.c @@ -23,10 +23,27 @@ extern __typeof(poll) __libc_poll; #ifdef __NR_poll + # define __NR___libc_poll __NR_poll _syscall3(int, __libc_poll, struct pollfd *, fds, unsigned long int, nfds, int, timeout); + +#elif defined(__NR_ppoll) + +libc_hidden_proto(ppoll) +int __libc_poll(struct pollfd *fds, nfds_t nfds, int timeout) +{ + struct timespec *ts = NULL, tval; + if (timeout > 0) { + tval.tv_sec = timeout / 1000; + tval.tv_nsec = (timeout % 1000) *1000; + ts = &tval; + } + return ppoll(fds, nfds, ts, NULL); +} + #else +/* ugh, this arch lacks poll, so we need to emulate this crap ... */ #include #include -- cgit v1.2.3