首先看看add函数实在event_add函数中调用的,肯定是evsel->add的方式调用的。
259 static int
260 epoll_add(void *arg, struct event *ev)261 {
262 struct epollop *epollop = arg;
263 struct epoll_event epev = {0, {0}};
264 struct evepoll *evep;
265 int fd, op, events;
266
267 if (ev->ev_events & EV_SIGNAL)
268 return (evsignal_add(ev));
269
270 fd = ev->ev_fd;
271 if (fd >= epollop->nfds) {
272 /* Extent the file descriptor array as necessary */
273 if (epoll_recalc(ev->ev_base, epollop, fd) == -1)
274 return (-1);
275 }
276 evep = &epollop->fds[fd];
277 op = EPOLL_CTL_ADD;
278 events = 0;
279 if (evep->evread != NULL) {
280 events |= EPOLLIN;
281 op