diff --git a/lib/cpp/src/thrift/Thrift.h b/lib/cpp/src/thrift/Thrift.h index d5066ee7107..78f6f6bcd80 100644 --- a/lib/cpp/src/thrift/Thrift.h +++ b/lib/cpp/src/thrift/Thrift.h @@ -29,8 +29,12 @@ #include #ifdef HAVE_NETINET_IN_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #ifdef HAVE_INTTYPES_H #include #endif diff --git a/lib/cpp/src/thrift/protocol/TProtocol.h b/lib/cpp/src/thrift/protocol/TProtocol.h index acb1b74d776..008527340ff 100644 --- a/lib/cpp/src/thrift/protocol/TProtocol.h +++ b/lib/cpp/src/thrift/protocol/TProtocol.h @@ -35,8 +35,12 @@ #include #ifdef HAVE_NETINET_IN_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #include #include #include diff --git a/lib/cpp/src/thrift/transport/PlatformSocket.h b/lib/cpp/src/thrift/transport/PlatformSocket.h index 10df9446e3d..8b6cae68ccc 100644 --- a/lib/cpp/src/thrift/transport/PlatformSocket.h +++ b/lib/cpp/src/thrift/transport/PlatformSocket.h @@ -107,6 +107,7 @@ # define THRIFT_LSEEK lseek # define THRIFT_WRITE write # define THRIFT_READ read +int ioctl(int fd, unsigned long request, ...); # define THRIFT_IOCTL_SOCKET ioctl # define THRIFT_IOCTL_SOCKET_NUM_BYTES_TYPE int # define THRIFT_STAT stat diff --git a/lib/cpp/src/thrift/transport/SocketCommon.h b/lib/cpp/src/thrift/transport/SocketCommon.h index bd1032f726e..20b954ee6d2 100644 --- a/lib/cpp/src/thrift/transport/SocketCommon.h +++ b/lib/cpp/src/thrift/transport/SocketCommon.h @@ -25,8 +25,12 @@ #include #ifdef HAVE_UNISTD_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #ifdef HAVE_SYS_UN_H #include #endif @@ -34,8 +38,12 @@ #include #endif #ifdef HAVE_SYS_SOCKET_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #include diff --git a/lib/cpp/src/thrift/transport/TServerSocket.cpp b/lib/cpp/src/thrift/transport/TServerSocket.cpp index 97fe201c547..9c9f534b97f 100644 --- a/lib/cpp/src/thrift/transport/TServerSocket.cpp +++ b/lib/cpp/src/thrift/transport/TServerSocket.cpp @@ -24,8 +24,12 @@ #include #include #ifdef HAVE_SYS_SOCKET_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #ifdef HAVE_SYS_UN_H #include #endif @@ -33,16 +37,29 @@ #include #endif #ifdef HAVE_NETINET_IN_H +#ifdef __ZEPHYR__ +#include +#include +#else #include #include #endif +#endif #ifdef HAVE_NETDB_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #include #ifdef HAVE_UNISTD_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #ifdef HAVE_SYS_STAT_H #include #endif diff --git a/lib/cpp/src/thrift/transport/TServerSocket.h b/lib/cpp/src/thrift/transport/TServerSocket.h index e826707ac55..84039645ad8 100644 --- a/lib/cpp/src/thrift/transport/TServerSocket.h +++ b/lib/cpp/src/thrift/transport/TServerSocket.h @@ -28,11 +28,19 @@ #include #ifdef HAVE_SYS_SOCKET_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #ifdef HAVE_NETDB_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif namespace apache { namespace thrift { diff --git a/lib/cpp/src/thrift/transport/TSocket.cpp b/lib/cpp/src/thrift/transport/TSocket.cpp index b09f779873e..6c9667ec172 100644 --- a/lib/cpp/src/thrift/transport/TSocket.cpp +++ b/lib/cpp/src/thrift/transport/TSocket.cpp @@ -22,14 +22,30 @@ #include #include #ifdef HAVE_SYS_IOCTL_H +#ifdef __ZEPHYR__ +#include +#include +__attribute__((weak)) +int ioctl(int fd, unsigned long request, ...) +{ + (void)fd; + (void)request; + return -ENOSYS; +} +#else #include +#endif #ifdef __sun #include #endif // __sun #endif #ifdef HAVE_SYS_SOCKET_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #ifdef HAVE_SYS_UN_H #include #endif @@ -38,12 +54,21 @@ #endif #include #ifdef HAVE_NETINET_IN_H +#ifdef __ZEPHYR__ +#include +#include +#else #include #include #endif +#endif #ifdef HAVE_UNISTD_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #include #include @@ -457,8 +482,12 @@ void TSocket::local_open() { if ( #ifdef _WIN32 error == WSANO_DATA +#else +#ifdef __ZEPHYR__ + error == DNS_EAI_NODATA #else error == EAI_NODATA +#endif #endif ) { hints.ai_flags &= ~AI_ADDRCONFIG; diff --git a/lib/cpp/src/thrift/transport/TSocket.h b/lib/cpp/src/thrift/transport/TSocket.h index f14546d9aa7..6b447645a2d 100644 --- a/lib/cpp/src/thrift/transport/TSocket.h +++ b/lib/cpp/src/thrift/transport/TSocket.h @@ -28,14 +28,22 @@ #include #ifdef HAVE_ARPA_INET_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_NETDB_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif namespace apache { namespace thrift { diff --git a/lib/cpp/src/thrift/transport/TSocketUtils.h b/lib/cpp/src/thrift/transport/TSocketUtils.h index c9e0e57b882..f09113631e9 100644 --- a/lib/cpp/src/thrift/transport/TSocketUtils.h +++ b/lib/cpp/src/thrift/transport/TSocketUtils.h @@ -27,11 +27,19 @@ #include #ifdef HAVE_SYS_SOCKET_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #ifdef HAVE_NETDB_H +#ifdef __ZEPHYR__ +#include +#else #include #endif +#endif #include @@ -111,8 +119,12 @@ struct AddressResolutionHelper { #ifdef _WIN32 } else { throw std::system_error{THRIFT_GET_SOCKET_ERROR, std::system_category()}; +#else +#ifdef __ZEPHYR__ + } else if (ret == DNS_EAI_SYSTEM) { #else } else if (ret == EAI_SYSTEM) { +#endif throw std::system_error{THRIFT_GET_SOCKET_ERROR, std::system_category()}; } else { throw std::system_error{ret, gai_error()};