Fix build with Windows SDK v10.0.16232
authorChristopher Dykes <cdykes@fb.com>
Thu, 26 Oct 2017 19:14:23 +0000 (12:14 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 26 Oct 2017 19:21:37 +0000 (12:21 -0700)
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

folly/io/async/AsyncServerSocket.cpp
folly/io/async/AsyncSocket.cpp
folly/io/async/test/AsyncSSLSocketTest.cpp
folly/io/async/test/AsyncSSLSocketTest.h
folly/io/async/test/AsyncSocketTest2.cpp
folly/portability/Sockets.h

index 908a95b6865fd6465a4eab52ff1db8cb9a6d1156..19bc823f2fce2f1c04dbe881340eee3c03177cef 100644 (file)
@@ -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;
index b83496873cb17a2f20dc789b3259782f4910e072..a4c41969e49a9278d95094bc4101abd9cdda935d 100644 (file)
@@ -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 {
index 10e521107ef54f1feec0ef66b32b60f6f62fb07a..6268848b7a0e7ca4619915044ff343842f0f07cc 100644 (file)
@@ -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
 
index 0ee1287318ea8f4e458bf685a2b3136867aa4722..3768aee7c635fcef7bb1a3a1e47461e50acd2cf1 100644 (file)
@@ -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 {
index b00bfd361dc1c523b90ec0769f40357fca189a90..7e714048e3508d2428ed41e2534077fdf78be677 100644 (file)
@@ -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;
index b78ddaba9ae54ededb758043c4f7a8bb74cc4d43..ad6b5f0824eaaf1d3d2dfb465b334db77f2eaf87 100755 (executable)
@@ -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