23 #define EPOLLRDHUP 0x2000
41 struct epoll_event ev;
42 int op =
fd->registered ? EPOLL_CTL_MOD : EPOLL_CTL_ADD;
44 memset(&ev, 0,
sizeof(
struct epoll_event));
50 ev.events |= EPOLLOUT;
57 return epoll_ctl(
poll_fd, op,
fd->fd, &ev);
65 return epoll_ctl(
poll_fd, EPOLL_CTL_DEL, sock->
fd, 0);
73 for (n = 0; n < nfds; ++n) {
115 if (read(u->
fd, &fired,
sizeof(fired)) !=
sizeof(fired))
127 int fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC|TFD_NONBLOCK);
136 struct itimerspec spec = {
138 .tv_sec = msecs / 1000,
139 .tv_nsec = (msecs % 1000) * 1000000
142 .tv_sec = msecs / 1000,
143 .tv_nsec = (msecs % 1000) * 1000000
147 if (timerfd_settime(tm->
priv.
ufd.
fd, 0, &spec, NULL) == -1)
177 struct itimerspec spec;
182 if (timerfd_gettime(tm->
priv.
ufd.
fd, &spec) == -1)
185 return spec.it_value.tv_sec * 1000 + spec.it_value.tv_nsec / 1000000;
#define container_of(ptr, type, member)
union uloop_interval::@15 priv
uloop_interval_handler cb
static struct epoll_event events[ULOOP_MAX_EVENTS]
static int register_poll(struct uloop_fd *fd, unsigned int flags)
static int uloop_fetch_events(int timeout)
static int uloop_init_pollfd(void)
static int timer_register(struct uloop_interval *tm, unsigned int msecs)
static int timer_remove(struct uloop_interval *tm)
static int __uloop_fd_delete(struct uloop_fd *sock)
static void dispatch_timer(struct uloop_fd *u, unsigned int events)
static int64_t timer_next(struct uloop_interval *tm)
int uloop_fd_add(struct uloop_fd *sock, unsigned int flags)
int uloop_fd_delete(struct uloop_fd *fd)
static struct uloop_fd_event cur_fds[10]
#define ULOOP_EDGE_TRIGGER