summaryrefslogtreecommitdiffstats
path: root/usr/klibc/poll.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/poll.c')
-rw-r--r--usr/klibc/poll.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/usr/klibc/poll.c b/usr/klibc/poll.c
new file mode 100644
index 0000000..f539b99
--- /dev/null
+++ b/usr/klibc/poll.c
@@ -0,0 +1,21 @@
+#include <errno.h>
+#include <sys/poll.h>
+#include <sys/syscall.h>
+
+#ifndef __NR_poll
+
+int poll(struct pollfd *fds, nfds_t nfds, long timeout)
+{
+ struct timespec timeout_ts;
+ struct timespec *timeout_ts_p = NULL;
+
+ if (timeout >= 0) {
+ timeout_ts.tv_sec = timeout / 1000;
+ timeout_ts.tv_nsec = (timeout % 1000) * 1000000;
+ timeout_ts_p = &timeout_ts;
+ }
+
+ return ppoll(fds, nfds, timeout_ts_p, 0);
+}
+
+#endif /* __NR_poll */