From 4c0668b0a895a3fe4299be32ba4614879b4b739a Mon Sep 17 00:00:00 2001 From: Yao Yue Date: Wed, 10 Oct 2018 13:04:13 -0700 Subject: [PATCH] epoll_create* ignores size hint in newer kernels, switch to new API (#179) * epoll_create* ignores size hint in newer kernels, use new API * update error message as well --- include/cc_event.h | 4 +--- src/event/cc_epoll.c | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/include/cc_event.h b/include/cc_event.h index 2f38caa6b..f5a31d281 100644 --- a/include/cc_event.h +++ b/include/cc_event.h @@ -26,8 +26,6 @@ extern "C" { #include -#define EVENT_SIZE 1024 - #define EVENT_READ 0x0000ff #define EVENT_WRITE 0x00ff00 #define EVENT_ERR 0xff0000 @@ -51,7 +49,7 @@ void event_setup(event_metrics_st *metrics); void event_teardown(void); /* event base */ -struct event_base *event_base_create(int size, event_cb_fn cb); +struct event_base *event_base_create(int nevent, event_cb_fn cb); void event_base_destroy(struct event_base **evb); /* event control */ diff --git a/src/event/cc_epoll.c b/src/event/cc_epoll.c index f8455d32b..12cc47c4e 100644 --- a/src/event/cc_epoll.c +++ b/src/event/cc_epoll.c @@ -57,9 +57,9 @@ event_base_create(int nevent, event_cb_fn cb) ASSERT(nevent > 0); - ep = epoll_create(nevent); + ep = epoll_create1(0); if (ep < 0) { - log_error("epoll create size %d failed: %s", nevent, strerror(errno)); + log_error("epoll create1 failed: %s", strerror(errno)); return NULL; }