aboutsummaryrefslogtreecommitdiffstats
path: root/mtdev/iobuf.c
diff options
context:
space:
mode:
Diffstat (limited to 'mtdev/iobuf.c')
-rw-r--r--mtdev/iobuf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/mtdev/iobuf.c b/mtdev/iobuf.c
index 8e367b8..65c33f6 100644
--- a/mtdev/iobuf.c
+++ b/mtdev/iobuf.c
@@ -20,6 +20,7 @@
**************************************************************************/
#include <mtdev-iobuf.h>
+#include <sys/poll.h>
void init_iobuf(struct IOBuffer *buf)
{
@@ -52,3 +53,11 @@ const struct input_event *get_iobuf_event(struct IOBuffer *buf, int fd)
buf->at += EVENT_SIZE;
return ev;
}
+
+int poll_iobuf(struct IOBuffer *buf, int fd, int ms)
+{
+ struct pollfd fds = { fd, POLLIN, 0 };
+ if (buf->top != buf->at)
+ return 1;
+ return poll(&fds, 1, ms);
+}