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