struct pollfd *nfds;
#endif
+ assert(eloop != NULL);
+ assert(read_cb != NULL || write_cb != NULL);
+
#ifdef HAVE_EPOLL
memset(&epe, 0, sizeof(epe));
epe.data.fd = fd;
struct epoll_event epe;
#endif
+ assert(eloop != NULL);
+ assert(fd != -1);
+
TAILQ_FOREACH(e, &eloop->events, next) {
if (e->fd == fd) {
if (write_only) {
struct timespec now, w;
struct eloop_timeout *t, *tt = NULL;
+ assert(eloop != NULL);
+ assert(when != NULL);
+ assert(callback != NULL);
+
clock_gettime(CLOCK_MONOTONIC, &now);
timespecadd(&now, when, &w);
/* Check for time_t overflow. */
{
struct eloop_timeout *t, *tt;
+ assert(eloop != NULL);
+
TAILQ_FOREACH_SAFE(t, &eloop->timeouts, next, tt) {
if ((queue == 0 || t->queue == queue) &&
t->arg == arg &&
eloop_exit(struct eloop *eloop, int code)
{
+ assert(eloop != NULL);
+
eloop->exitcode = code;
eloop->exitnow = 1;
}
static int
eloop_open(struct eloop *eloop)
{
+
#if defined(HAVE_KQUEUE1)
return (eloop->poll_fd = kqueue1(O_CLOEXEC));
#elif defined(HAVE_KQUEUE)
struct epoll_event epe;
#endif
+ assert(eloop != NULL);
+
if (eloop->poll_fd != -1)
close(eloop->poll_fd);
if (eloop_open(eloop) == -1)
void (*signal_cb)(int, void *), void *signal_cb_ctx)
{
- assert(eloop);
+ assert(eloop != NULL);
+
eloop->signals = signals;
eloop->signals_len = signals_len;
eloop->signal_cb = signal_cb;
struct sigaction sa;
#endif
+ assert(eloop != NULL);
+
sigfillset(&newset);
if (sigprocmask(SIG_SETMASK, &newset, oldset) == -1)
return -1;
_eloop = eloop;
#endif
+ assert(eloop != NULL);
+
for (;;) {
if (eloop->exitnow)
break;