summaryrefslogtreecommitdiffstats
path: root/osdep/polldev.h
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-12-09 09:41:09 -0500
committerJan Ekström <jeebjp@gmail.com>2017-12-09 21:11:46 +0200
commitba418132cd04865d444f4da2b5553e4d83b18138 (patch)
tree5e60f610cc1c1b3ed029da0643c9bb51e63001f9 /osdep/polldev.h
parent1d7a746505a2a5ec0392e0c8a6c1ddd0c7133baa (diff)
downloadmpv-ba418132cd04865d444f4da2b5553e4d83b18138.tar.bz2
mpv-ba418132cd04865d444f4da2b5553e4d83b18138.tar.xz
osdep: add poll shim for macOS
This implements a poll-compatible interface, backed by select on macOS, suitable for polling on device files - which are not supported by macOS's implementation of poll. This is a (long-standing) bug in macOS, so hopefully we can eventually remove this shim.
Diffstat (limited to 'osdep/polldev.h')
-rw-r--r--osdep/polldev.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/osdep/polldev.h b/osdep/polldev.h
new file mode 100644
index 0000000000..50b6db29bc
--- /dev/null
+++ b/osdep/polldev.h
@@ -0,0 +1,7 @@
+#pragma once
+
+#include <poll.h>
+
+// Behaves like poll(3) but works for device files on macOS.
+// Only supports POLLIN, POLLOUT, and POLLERR.
+int polldev(struct pollfd fds[], nfds_t nfds, int timeout);