[PATCH 13/22] Including <sys/epoll.h> iff it exists.

Alejandro Colomar alx.manpages at gmail.com
Sun Jun 19 13:50:23 UTC 2022


---
 auto/headers   | 13 +++++++++++++
 src/nxt_unix.h |  7 +++----
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/auto/headers b/auto/headers
index 69a66550..dee13ead 100644
--- a/auto/headers
+++ b/auto/headers
@@ -55,6 +55,19 @@ nxt_feature_test="#include <sys/devpoll.h>
 . auto/feature
 
 
+nxt_feature="<sys/epoll.h>"
+nxt_feature_name=NXT_HAVE_SYS_EPOLL_H
+nxt_feature_run=no
+nxt_feature_incs=
+nxt_feature_libs=
+nxt_feature_test="#include <sys/epoll.h>
+
+                  int main(void) {
+                      return 0;
+                  }"
+. auto/feature
+
+
 nxt_feature="<sys/eventfd.h>"
 nxt_feature_name=NXT_HAVE_SYS_EVENTFD_H
 nxt_feature_run=no
diff --git a/src/nxt_unix.h b/src/nxt_unix.h
index ddfe434c..9100cccf 100644
--- a/src/nxt_unix.h
+++ b/src/nxt_unix.h
@@ -186,18 +186,17 @@
 #include <unistd.h>
 #include <pthread.h>
 
-#if (NXT_HAVE_EPOLL)
+#if (NXT_HAVE_SYS_EPOLL_H)
 #include <sys/epoll.h>
+#endif
 
-#ifdef EPOLLRDHUP
+#if (NXT_HAVE_EPOLL && defined(EPOLLRDHUP))
 /*
  * Epoll edge-tiggered mode is pretty much useless without EPOLLRDHUP support.
  */
 #define NXT_HAVE_EPOLL_EDGE  1
 #endif
 
-#endif
-
 #if (NXT_HAVE_SYS_SIGNALFD_H)
 #include <sys/signalfd.h>
 #endif
-- 
2.36.1



More information about the unit mailing list