Commit 760b0714 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

Fix build with Windows SDK v10.0.16232

Summary:
It defines `MSG_ERRQUEUE` which breaks things.

There's a github PR to do this in a different way, but it's faster to just do it myself.

Closes https://github.com/facebook/folly/pull/689

Reviewed By: yfeldblum

Differential Revision: D6155606

fbshipit-source-id: f1c6b247efc452b4005ad3b6d82fabfd5a92f49f
parent 8f4003a8
...@@ -40,11 +40,11 @@ namespace fsp = folly::portability::sockets; ...@@ -40,11 +40,11 @@ namespace fsp = folly::portability::sockets;
namespace folly { namespace folly {
static constexpr bool msgErrQueueSupported = static constexpr bool msgErrQueueSupported =
#ifdef MSG_ERRQUEUE #ifdef FOLLY_HAVE_MSG_ERRQUEUE
true; true;
#else #else
false; false;
#endif // MSG_ERRQUEUE #endif // FOLLY_HAVE_MSG_ERRQUEUE
const uint32_t AsyncServerSocket::kDefaultMaxAcceptAtOnce; const uint32_t AsyncServerSocket::kDefaultMaxAcceptAtOnce;
const uint32_t AsyncServerSocket::kDefaultCallbackAcceptAtOnce; const uint32_t AsyncServerSocket::kDefaultCallbackAcceptAtOnce;
......
...@@ -42,11 +42,11 @@ namespace fsp = folly::portability::sockets; ...@@ -42,11 +42,11 @@ namespace fsp = folly::portability::sockets;
namespace folly { namespace folly {
static constexpr bool msgErrQueueSupported = static constexpr bool msgErrQueueSupported =
#ifdef MSG_ERRQUEUE #ifdef FOLLY_HAVE_MSG_ERRQUEUE
true; true;
#else #else
false; false;
#endif // MSG_ERRQUEUE #endif // FOLLY_HAVE_MSG_ERRQUEUE
// static members initializers // static members initializers
const AsyncSocket::OptionMap AsyncSocket::emptyOptionMap; const AsyncSocket::OptionMap AsyncSocket::emptyOptionMap;
...@@ -933,7 +933,7 @@ bool AsyncSocket::containsZeroCopyBuf(folly::IOBuf* ptr) { ...@@ -933,7 +933,7 @@ bool AsyncSocket::containsZeroCopyBuf(folly::IOBuf* ptr) {
} }
bool AsyncSocket::isZeroCopyMsg(const cmsghdr& cmsg) const { bool AsyncSocket::isZeroCopyMsg(const cmsghdr& cmsg) const {
#ifdef MSG_ERRQUEUE #ifdef FOLLY_HAVE_MSG_ERRQUEUE
if (zeroCopyEnabled_ && if (zeroCopyEnabled_ &&
((cmsg.cmsg_level == SOL_IP && cmsg.cmsg_type == IP_RECVERR) || ((cmsg.cmsg_level == SOL_IP && cmsg.cmsg_type == IP_RECVERR) ||
(cmsg.cmsg_level == SOL_IPV6 && cmsg.cmsg_type == IPV6_RECVERR))) { (cmsg.cmsg_level == SOL_IPV6 && cmsg.cmsg_type == IPV6_RECVERR))) {
...@@ -947,7 +947,7 @@ bool AsyncSocket::isZeroCopyMsg(const cmsghdr& cmsg) const { ...@@ -947,7 +947,7 @@ bool AsyncSocket::isZeroCopyMsg(const cmsghdr& cmsg) const {
} }
void AsyncSocket::processZeroCopyMsg(const cmsghdr& cmsg) { void AsyncSocket::processZeroCopyMsg(const cmsghdr& cmsg) {
#ifdef MSG_ERRQUEUE #ifdef FOLLY_HAVE_MSG_ERRQUEUE
const struct sock_extended_err* serr = const struct sock_extended_err* serr =
reinterpret_cast<const struct sock_extended_err*>(CMSG_DATA(&cmsg)); reinterpret_cast<const struct sock_extended_err*>(CMSG_DATA(&cmsg));
uint32_t hi = serr->ee_data; uint32_t hi = serr->ee_data;
...@@ -1761,7 +1761,7 @@ void AsyncSocket::handleErrMessages() noexcept { ...@@ -1761,7 +1761,7 @@ void AsyncSocket::handleErrMessages() noexcept {
return; return;
} }
#ifdef MSG_ERRQUEUE #ifdef FOLLY_HAVE_MSG_ERRQUEUE
uint8_t ctrl[1024]; uint8_t ctrl[1024];
unsigned char data; unsigned char data;
struct msghdr msg; struct msghdr msg;
...@@ -1808,7 +1808,7 @@ void AsyncSocket::handleErrMessages() noexcept { ...@@ -1808,7 +1808,7 @@ void AsyncSocket::handleErrMessages() noexcept {
} }
} }
} }
#endif //MSG_ERRQUEUE #endif // FOLLY_HAVE_MSG_ERRQUEUE
} }
void AsyncSocket::handleRead() noexcept { void AsyncSocket::handleRead() noexcept {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
#include <set> #include <set>
#include <thread> #include <thread>
#ifdef MSG_ERRQUEUE #ifdef FOLLY_HAVE_MSG_ERRQUEUE
#include <sys/utsname.h> #include <sys/utsname.h>
#endif #endif
...@@ -2189,7 +2189,7 @@ TEST(AsyncSSLSocketTest, SendMsgParamsCallback) { ...@@ -2189,7 +2189,7 @@ TEST(AsyncSSLSocketTest, SendMsgParamsCallback) {
cerr << "SendMsgParamsCallback test completed" << endl; cerr << "SendMsgParamsCallback test completed" << endl;
} }
#ifdef MSG_ERRQUEUE #ifdef FOLLY_HAVE_MSG_ERRQUEUE
/** /**
* Test connecting to, writing to, reading from, and closing the * Test connecting to, writing to, reading from, and closing the
* connection to the SSL server. * connection to the SSL server.
...@@ -2263,7 +2263,7 @@ TEST(AsyncSSLSocketTest, SendMsgDataCallback) { ...@@ -2263,7 +2263,7 @@ TEST(AsyncSSLSocketTest, SendMsgDataCallback) {
cerr << "SendMsgDataCallback test completed" << endl; cerr << "SendMsgDataCallback test completed" << endl;
} }
#endif // MSG_ERRQUEUE #endif // FOLLY_HAVE_MSG_ERRQUEUE
#endif #endif
......
...@@ -186,7 +186,7 @@ public WriteCallbackBase { ...@@ -186,7 +186,7 @@ public WriteCallbackBase {
} }
}; };
#ifdef MSG_ERRQUEUE #ifdef FOLLY_HAVE_MSG_ERRQUEUE
/* copied from include/uapi/linux/net_tstamp.h */ /* copied from include/uapi/linux/net_tstamp.h */
/* SO_TIMESTAMPING gets an integer bit field comprised of these values */ /* SO_TIMESTAMPING gets an integer bit field comprised of these values */
enum SOF_TIMESTAMPING { enum SOF_TIMESTAMPING {
...@@ -276,7 +276,7 @@ class WriteCheckTimestampCallback : ...@@ -276,7 +276,7 @@ class WriteCheckTimestampCallback :
bool gotTimestamp_{false}; bool gotTimestamp_{false};
bool gotByteSeq_{false}; bool gotByteSeq_{false};
}; };
#endif // MSG_ERRQUEUE #endif // FOLLY_HAVE_MSG_ERRQUEUE
class ReadCallbackBase : class ReadCallbackBase :
public AsyncTransportWrapper::ReadCallback { public AsyncTransportWrapper::ReadCallback {
......
...@@ -2857,7 +2857,7 @@ TEST(AsyncSocketTest, EvbCallbacks) { ...@@ -2857,7 +2857,7 @@ TEST(AsyncSocketTest, EvbCallbacks) {
socket->attachEventBase(&evb); socket->attachEventBase(&evb);
} }
#ifdef MSG_ERRQUEUE #ifdef FOLLY_HAVE_MSG_ERRQUEUE
/* copied from include/uapi/linux/net_tstamp.h */ /* copied from include/uapi/linux/net_tstamp.h */
/* SO_TIMESTAMPING gets an integer bit field comprised of these values */ /* SO_TIMESTAMPING gets an integer bit field comprised of these values */
enum SOF_TIMESTAMPING { enum SOF_TIMESTAMPING {
...@@ -2980,7 +2980,7 @@ TEST(AsyncSocketTest, ErrMessageCallback) { ...@@ -2980,7 +2980,7 @@ TEST(AsyncSocketTest, ErrMessageCallback) {
ASSERT_EQ( ASSERT_EQ(
errMsgCB.gotByteSeq_ + errMsgCB.gotTimestamp_, errMsgCB.resetAfter_); errMsgCB.gotByteSeq_ + errMsgCB.gotTimestamp_, errMsgCB.resetAfter_);
} }
#endif // MSG_ERRQUEUE #endif // FOLLY_HAVE_MSG_ERRQUEUE
TEST(AsyncSocket, PreReceivedData) { TEST(AsyncSocket, PreReceivedData) {
TestServer server; TestServer server;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <sys/un.h> #include <sys/un.h>
#ifdef MSG_ERRQUEUE #ifdef MSG_ERRQUEUE
#define FOLLY_HAVE_MSG_ERRQUEUE 1
/* for struct sock_extended_err*/ /* for struct sock_extended_err*/
#include <linux/errqueue.h> #include <linux/errqueue.h>
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment