This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 006ec2f9c8dcf371ba4c78d0590db31b1076b5e3
Author: Brian Geffon <[email protected]>
AuthorDate: Fri Apr 23 07:35:56 2021 -0700

    Fix build on FreeBSD 13 (#7730)
    
    FreeBSD 13 added eventfd(2), which means that now having eventfd no
    longer means that you'll also have epoll. This change updates
    EventNotify to check for both eventfd(2) and epoll before trying to
    use epoll.
    
    (cherry picked from commit 76124222d179d55a2c2a2e74806377e54df744a9)
---
 include/tscore/EventNotify.h |  2 +-
 src/tscore/EventNotify.cc    | 18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/tscore/EventNotify.h b/include/tscore/EventNotify.h
index 864c809..09b6293 100644
--- a/include/tscore/EventNotify.h
+++ b/include/tscore/EventNotify.h
@@ -45,7 +45,7 @@ public:
   ~EventNotify();
 
 private:
-#ifdef HAVE_EVENTFD
+#if defined(HAVE_EVENTFD) && TS_USE_EPOLL == 1
   int m_event_fd;
   int m_epoll_fd;
 #else
diff --git a/src/tscore/EventNotify.cc b/src/tscore/EventNotify.cc
index fb88fef..fae43c6 100644
--- a/src/tscore/EventNotify.cc
+++ b/src/tscore/EventNotify.cc
@@ -31,7 +31,7 @@
 #include "tscore/ink_hrtime.h"
 #include "tscore/ink_defs.h"
 
-#ifdef HAVE_EVENTFD
+#if defined(HAVE_EVENTFD) && TS_USE_EPOLL == 1
 #include <sys/eventfd.h>
 #include <fcntl.h>
 #include <sys/epoll.h>
@@ -39,7 +39,7 @@
 
 EventNotify::EventNotify()
 {
-#ifdef HAVE_EVENTFD
+#if defined(HAVE_EVENTFD) && TS_USE_EPOLL == 1
   int ret;
   struct epoll_event ev;
 
@@ -63,7 +63,7 @@ EventNotify::EventNotify()
 void
 EventNotify::signal()
 {
-#ifdef HAVE_EVENTFD
+#if defined(HAVE_EVENTFD) && TS_USE_EPOLL == 1
   uint64_t value = 1;
   //
   // If the addition would cause the counter's value of eventfd
@@ -79,7 +79,7 @@ EventNotify::signal()
 int
 EventNotify::wait()
 {
-#ifdef HAVE_EVENTFD
+#if defined(HAVE_EVENTFD) && TS_USE_EPOLL == 1
   ssize_t nr, nr_fd;
   uint64_t value = 0;
   struct epoll_event ev;
@@ -107,7 +107,7 @@ EventNotify::wait()
 int
 EventNotify::timedwait(int timeout) // milliseconds
 {
-#ifdef HAVE_EVENTFD
+#if defined(HAVE_EVENTFD) && TS_USE_EPOLL == 1
   ssize_t nr, nr_fd = 0;
   uint64_t value = 0;
   struct epoll_event ev;
@@ -148,7 +148,7 @@ EventNotify::timedwait(int timeout) // milliseconds
 void
 EventNotify::lock()
 {
-#ifdef HAVE_EVENTFD
+#if defined(HAVE_EVENTFD) && TS_USE_EPOLL == 1
 // do nothing
 #else
   ink_mutex_acquire(&m_mutex);
@@ -158,7 +158,7 @@ EventNotify::lock()
 bool
 EventNotify::trylock()
 {
-#ifdef HAVE_EVENTFD
+#if defined(HAVE_EVENTFD) && TS_USE_EPOLL == 1
   return true;
 #else
   return ink_mutex_try_acquire(&m_mutex);
@@ -168,7 +168,7 @@ EventNotify::trylock()
 void
 EventNotify::unlock()
 {
-#ifdef HAVE_EVENTFD
+#if defined(HAVE_EVENTFD) && TS_USE_EPOLL == 1
 // do nothing
 #else
   ink_mutex_release(&m_mutex);
@@ -177,7 +177,7 @@ EventNotify::unlock()
 
 EventNotify::~EventNotify()
 {
-#ifdef HAVE_EVENTFD
+#if defined(HAVE_EVENTFD) && TS_USE_EPOLL == 1
   close(m_event_fd);
   close(m_epoll_fd);
 #else

Reply via email to