Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: third_party/libevent/epoll.c

Issue 118124: Linux: sync libevent/epoll.c to upstream's version (Closed)
Patch Set: ... Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libevent/epoll.c
diff --git a/third_party/libevent/epoll.c b/third_party/libevent/epoll.c
index 3a445781d0ae3546c4300177e149b601dabe303c..bfb3140eca5e8b8a908f307e7b3fae8722104300 100644
--- a/third_party/libevent/epoll.c
+++ b/third_party/libevent/epoll.c
@@ -75,7 +75,7 @@ static int epoll_del (void *, struct event *);
static int epoll_dispatch (struct event_base *, void *, struct timeval *);
static void epoll_dealloc (struct event_base *, void *);
-struct eventop epollops = {
+const struct eventop epollops = {
"epoll",
epoll_init,
epoll_add,
@@ -166,7 +166,7 @@ epoll_recalc(struct event_base *base, void *arg, int max)
{
struct epollop *epollop = arg;
- if (max > epollop->nfds) {
+ if (max >= epollop->nfds) {
struct evepoll *fds;
int nfds;
@@ -224,8 +224,11 @@ epoll_dispatch(struct event_base *base, void *arg, struct timeval *tv)
for (i = 0; i < res; i++) {
int what = events[i].events;
struct event *evread = NULL, *evwrite = NULL;
+ int fd = events[i].data.fd;
- evep = (struct evepoll *)events[i].data.ptr;
+ if (fd < 0 && fd >= epollop->nfds)
+ continue;
+ evep = &epollop->fds[fd];
if (what & (EPOLLHUP|EPOLLERR)) {
evread = evep->evread;
@@ -287,7 +290,7 @@ epoll_add(void *arg, struct event *ev)
if (ev->ev_events & EV_WRITE)
events |= EPOLLOUT;
- epev.data.ptr = evep;
+ epev.data.fd = fd;
epev.events = events;
if (epoll_ctl(epollop->epfd, op, ev->ev_fd, &epev) == -1)
return (-1);
@@ -339,7 +342,7 @@ epoll_del(void *arg, struct event *ev)
}
epev.events = events;
- epev.data.ptr = evep;
+ epev.data.fd = fd;
if (needreaddelete)
evep->evread = NULL;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698