}
/* Polling functions */
-int poll_add(poll_t *poll, int fd, cb_t cb, void *data)
+void poll_add(poll_t *poll, int fd, cb_t cb, void *data)
{
struct epoll_event ctl = {
.events = EPOLLET | EPOLLIN | EPOLLOUT | EPOLLERR,
poll->fd = fd;
poll->cb = cb;
poll->data = data;
- return epoll_ctl(epoll, EPOLL_CTL_ADD, fd, &ctl);
+ if (epoll_ctl(epoll, EPOLL_CTL_ADD, fd, &ctl) < 0)
+ error("adding poll");
}
-int poll_ctl(poll_t *poll, int in, int out, int err)
+void poll_ctl(poll_t *poll, int in, int out, int err)
{
struct epoll_event ctl = {
.events = EPOLLET
| (err ? EPOLLERR : 0),
.data.ptr = poll,
};
- return epoll_ctl(epoll, EPOLL_CTL_MOD, poll->fd, &ctl);
+ if (epoll_ctl(epoll, EPOLL_CTL_MOD, poll->fd, &ctl) < 0)
+ error("modifying poll");
}
-int poll_del(poll_t *poll)
+void poll_del(poll_t *poll)
{
- return epoll_ctl(epoll, EPOLL_CTL_DEL, poll->fd, NULL);
+ if (epoll_ctl(epoll, EPOLL_CTL_DEL, poll->fd, NULL) < 0)
+ error("deleting poll");
}
int poll_run(int timeout)
char *read_file(const char *path, int *len);
/* Polling functions */
-int poll_add(poll_t *poll, int fd, cb_t cb, void *data);
-int poll_ctl(poll_t *poll, int in, int out, int err);
-int poll_del(poll_t *poll);
+void poll_add(poll_t *poll, int fd, cb_t cb, void *data);
+void poll_ctl(poll_t *poll, int in, int out, int err);
+void poll_del(poll_t *poll);
int poll_run(int timeout);
void poll_quit(void);