diff options
Diffstat (limited to 'nio.h')
-rw-r--r-- | nio.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -3,6 +3,8 @@ #include <poll.h> +#define WARN_UNUSED __attribute__((__warn_unused_result__)) + enum { NIO_SUCCESS = 0, @@ -34,41 +36,55 @@ struct nio void nio_init(struct nio * io); +WARN_UNUSED int nio_use_poll(struct nio * io, nfds_t max_fds); +WARN_UNUSED int nio_use_epoll(struct nio * io, int max_events); +WARN_UNUSED int nio_add_fd(struct nio * io, int fd, int event_flags, void * ptr); +WARN_UNUSED int nio_mod_fd(struct nio * io, int fd, int event_flags, void * ptr); +WARN_UNUSED int nio_del_fd(struct nio * io, int fd); +WARN_UNUSED int nio_run(struct nio * io, int timeout); +WARN_UNUSED static inline int nio_get_nready(struct nio const * const io) { return io->nready; } +WARN_UNUSED int nio_check(struct nio * io, int index, int events); +WARN_UNUSED int nio_is_valid(struct nio const * const io, int index); +WARN_UNUSED int nio_get_fd(struct nio * io, int index); +WARN_UNUSED void * nio_get_ptr(struct nio * io, int index); +WARN_UNUSED static inline int nio_has_input(struct nio * io, int index) { return nio_check(io, index, NIO_EVENT_INPUT); } +WARN_UNUSED static inline int nio_can_output(struct nio * io, int index) { return nio_check(io, index, NIO_EVENT_OUTPUT); } +WARN_UNUSED static inline int nio_has_error(struct nio * io, int index) { return nio_check(io, index, NIO_EVENT_ERROR); |