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

Unified Diff: third_party/libevent/epoll.c

Issue 118126: Linux: stop libevent from pre-allocating huge arrays. (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 bfb3140eca5e8b8a908f307e7b3fae8722104300..e9eacfb69dfa6291473ce655bf25bd4aef93d044 100644
--- a/third_party/libevent/epoll.c
+++ b/third_party/libevent/epoll.c
@@ -94,7 +94,7 @@ const struct eventop epollops = {
#define FD_CLOSEONEXEC(x)
#endif
-#define NEVENT 32000
+#define NEVENT 32
/* On Linux kernels at least up to 2.6.24.4, epoll can't handle timeout
* values bigger than (LONG_MAX - 999ULL)/HZ. HZ in the wild can be
@@ -115,16 +115,6 @@ epoll_init(struct event_base *base)
if (getenv("EVENT_NOEPOLL"))
return (NULL);
- if (getrlimit(RLIMIT_NOFILE, &rl) == 0 &&
- rl.rlim_cur != RLIM_INFINITY) {
- /*
- * Solaris is somewhat retarded - it's important to drop
- * backwards compatibility when making changes. So, don't
- * dare to put rl.rlim_cur here.
- */
- nfiles = rl.rlim_cur - 1;
- }
-
/* Initalize the kernel queue */
if ((epfd = epoll_create(nfiles)) == -1) {
@@ -226,7 +216,7 @@ epoll_dispatch(struct event_base *base, void *arg, struct timeval *tv)
struct event *evread = NULL, *evwrite = NULL;
int fd = events[i].data.fd;
- if (fd < 0 && fd >= epollop->nfds)
+ if (fd < 0 || fd >= epollop->nfds)
continue;
evep = &epollop->fds[fd];
« 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