diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-02 20:02:19 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-02 20:02:19 +0000 |
commit | 8c6bdda23fc712232f31cf29f8fe772ec3232db3 (patch) | |
tree | b423714ab7e3689b752311ee92eb9db9799c9c53 /third_party/libevent | |
parent | 296a4c810df930f67fa4123f6e8b67c8059de0cb (diff) | |
download | chromium_src-8c6bdda23fc712232f31cf29f8fe772ec3232db3.zip chromium_src-8c6bdda23fc712232f31cf29f8fe772ec3232db3.tar.gz chromium_src-8c6bdda23fc712232f31cf29f8fe772ec3232db3.tar.bz2 |
Linux: sync libevent/epoll.c to upstream's version.
Our version of epoll.c has a bug where, when resizing an array,
pointers to the old array remain in kernel memory and are subsequently
used.
This is a pure cherry-pick from libevent 1.4.11-stable.
http://codereview.chromium.org/118124
BUG=11999
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17421 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/libevent')
-rw-r--r-- | third_party/libevent/epoll.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/third_party/libevent/epoll.c b/third_party/libevent/epoll.c index 3a44578..bfb3140 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; |