in src/event/cc_epoll.c [131:152]
int event_add_read(struct event_base *evb, int fd, void *data)
{
int status;
ASSERT(evb != NULL && evb->ep > 0);
ASSERT(fd >= 0);
/*
* Note(yao): there have been tests showing EPOLL_CTL_ADD is cheaper than
* EPOLL_CTL_MOD, and the only difference is we need to ignore EEXIST
*/
status = _event_update(evb, fd, EPOLL_CTL_ADD, EPOLLIN, data);
if (status < 0 && errno != EEXIST) {
log_error("ctl (add read) w/ epoll fd %d on fd %d failed: %s", evb->ep,
fd, strerror(errno));
}
INCR(event_metrics, event_read);
log_verb("add read event to epoll fd %d on fd %d", evb->ep, fd);
return status;
}