summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Friedt <cfriedt@meta.com>2022-11-05 08:33:05 -0400
committerJens Geyer <Jens-G@users.noreply.github.com>2022-11-20 12:04:03 +0100
commitf525e4cbb6a6bf81fbbd4edf7e3f6318823a8e9f (patch)
tree6e813f6e7f0d7852b9415694162200c0699c6828
parent8f83e462502a57456ab726ac64ab4dc3ca4d9b00 (diff)
downloadthrift-f525e4cbb6a6bf81fbbd4edf7e3f6318823a8e9f.tar.gz
THRIFT-5666: lib: cpp: prefer poll.h over sys/poll.h
The `<sys/poll.h>` header is not actually where `poll(2)` must be defined according to the spec. However, it may be the case that some random UNIX-like OS uses `<sys/poll.h>` instead. Both use cases can be supported simply by including the proper header, if it exists. Signed-off-by: Chris Friedt <cfriedt@meta.com>
-rw-r--r--lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp3
-rw-r--r--lib/cpp/src/thrift/transport/TSSLSocket.cpp3
-rw-r--r--lib/cpp/src/thrift/transport/TServerSocket.cpp3
-rw-r--r--lib/cpp/src/thrift/transport/TSocket.cpp3
4 files changed, 12 insertions, 0 deletions
diff --git a/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp b/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp
index 3196c4782..0e59ae47e 100644
--- a/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp
@@ -29,6 +29,9 @@
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
diff --git a/lib/cpp/src/thrift/transport/TSSLSocket.cpp b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
index dc8fcd9a6..eb96a73a6 100644
--- a/lib/cpp/src/thrift/transport/TSSLSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSSLSocket.cpp
@@ -30,6 +30,9 @@
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
diff --git a/lib/cpp/src/thrift/transport/TServerSocket.cpp b/lib/cpp/src/thrift/transport/TServerSocket.cpp
index 25ec789e0..7cab0eefa 100644
--- a/lib/cpp/src/thrift/transport/TServerSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TServerSocket.cpp
@@ -29,6 +29,9 @@
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif
diff --git a/lib/cpp/src/thrift/transport/TSocket.cpp b/lib/cpp/src/thrift/transport/TSocket.cpp
index 9991fd6bd..d8accadc9 100644
--- a/lib/cpp/src/thrift/transport/TSocket.cpp
+++ b/lib/cpp/src/thrift/transport/TSocket.cpp
@@ -33,6 +33,9 @@
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#endif
#ifdef HAVE_SYS_POLL_H
#include <sys/poll.h>
#endif