diff options
Diffstat (limited to 'mtdev/iobuf.c')
| -rw-r--r-- | mtdev/iobuf.c | 9 |
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 @@ | |||
| 20 | **************************************************************************/ | 20 | **************************************************************************/ |
| 21 | 21 | ||
| 22 | #include <mtdev-iobuf.h> | 22 | #include <mtdev-iobuf.h> |
| 23 | #include <sys/poll.h> | ||
| 23 | 24 | ||
| 24 | void init_iobuf(struct IOBuffer *buf) | 25 | void init_iobuf(struct IOBuffer *buf) |
| 25 | { | 26 | { |
| @@ -52,3 +53,11 @@ const struct input_event *get_iobuf_event(struct IOBuffer *buf, int fd) | |||
| 52 | buf->at += EVENT_SIZE; | 53 | buf->at += EVENT_SIZE; |
| 53 | return ev; | 54 | return ev; |
| 54 | } | 55 | } |
| 56 | |||
| 57 | int poll_iobuf(struct IOBuffer *buf, int fd, int ms) | ||
| 58 | { | ||
| 59 | struct pollfd fds = { fd, POLLIN, 0 }; | ||
| 60 | if (buf->top != buf->at) | ||
| 61 | return 1; | ||
| 62 | return poll(&fds, 1, ms); | ||
| 63 | } | ||
