Go to the source code of this file.
◆ __uloop_fd_delete()
static int __uloop_fd_delete |
( |
struct uloop_fd * |
fd | ) |
|
|
static |
Definition at line 101 of file uloop-kqueue.c.
static int register_poll(struct uloop_fd *fd, unsigned int flags)
◆ get_flags()
static uint16_t get_flags |
( |
unsigned int |
flags, |
|
|
unsigned int |
mask |
|
) |
| |
|
static |
◆ get_timestamp_us()
static int64_t get_timestamp_us |
( |
void |
| ) |
|
|
static |
Definition at line 106 of file uloop-kqueue.c.
108 #ifdef CLOCK_MONOTONIC
109 struct timespec ts = { 0, 0 };
111 clock_gettime(CLOCK_MONOTONIC, &ts);
113 return ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
115 struct timeval tv = { 0, 0 };
117 gettimeofday(&tv, NULL);
119 return tv.tv_sec * 1000000 + tv.tv_usec;
◆ register_kevent()
static int register_kevent |
( |
struct uloop_fd * |
fd, |
|
|
unsigned int |
flags |
|
) |
| |
|
static |
Definition at line 53 of file uloop-kqueue.c.
55 struct timespec timeout = { 0, 0 };
62 if (flags & ULOOP_EDGE_DEFER)
65 changed = flags ^
fd->flags;
74 EV_SET(&ev[nev++],
fd->fd, EVFILT_READ, kflags, 0, 0,
fd);
79 EV_SET(&ev[nev++],
fd->fd, EVFILT_WRITE, kflags, 0, 0,
fd);
85 if (kevent(
poll_fd, ev, nev, NULL, fl, &timeout) == -1)
static uint16_t get_flags(unsigned int flags, unsigned int mask)
◆ register_poll()
static int register_poll |
( |
struct uloop_fd * |
fd, |
|
|
unsigned int |
flags |
|
) |
| |
|
static |
Definition at line 91 of file uloop-kqueue.c.
94 flags |= ULOOP_EDGE_DEFER;
96 flags &= ~ULOOP_EDGE_DEFER;
static int register_kevent(struct uloop_fd *fd, unsigned int flags)
◆ timer_next()
Definition at line 200 of file uloop-kqueue.c.
208 return (t1 - t2) / 1000;
union uloop_interval::@15 priv
struct uloop_interval::@15::@16 time
static int64_t get_timestamp_us(void)
◆ timer_register()
static int timer_register |
( |
struct uloop_interval * |
tm, |
|
|
unsigned int |
msecs |
|
) |
| |
|
static |
Definition at line 179 of file uloop-kqueue.c.
186 EV_SET(&ev, (uintptr_t)tm, EVFILT_TIMER, EV_ADD, NOTE_USECONDS, msecs * 1000, tm);
188 return kevent(
poll_fd, &ev, 1, NULL, 0, NULL);
◆ timer_remove()
Definition at line 191 of file uloop-kqueue.c.
195 EV_SET(&ev, (uintptr_t)tm, EVFILT_TIMER, EV_DELETE, 0, 0, NULL);
197 return kevent(
poll_fd, &ev, 1, NULL, 0, NULL);
◆ uloop_fetch_events()
static int uloop_fetch_events |
( |
int |
timeout | ) |
|
|
static |
Definition at line 123 of file uloop-kqueue.c.
129 ts.tv_sec = timeout / 1000;
130 ts.tv_nsec = (timeout % 1000) * 1000000;
134 for (n = 0; n < nfds; n++) {
135 if (
events[n].filter == EVFILT_TIMER) {
159 if(
events[n].filter == EVFILT_READ)
161 else if (
events[n].filter == EVFILT_WRITE)
170 if (u->
flags & ULOOP_EDGE_DEFER) {
171 u->
flags &= ~ULOOP_EDGE_DEFER;
uloop_interval_handler cb
static struct kevent events[ULOOP_MAX_EVENTS]
int uloop_fd_delete(struct uloop_fd *fd)
static struct uloop_fd_event cur_fds[10]
◆ uloop_init_pollfd()
static int uloop_init_pollfd |
( |
void |
| ) |
|
|
static |
Definition at line 18 of file uloop-kqueue.c.
20 struct timespec timeout = { 0, 0 };
21 struct kevent ev = {};
30 EV_SET(&ev, SIGCHLD, EVFILT_SIGNAL, EV_ADD, 0, 0, 0);
31 kevent(
poll_fd, &ev, 1, NULL, 0, &timeout);
◆ events