Switch uses of networking headers to <folly/portability/Sockets.h>
authorChristopher Dykes <cdykes@fb.com>
Mon, 30 May 2016 23:05:21 +0000 (16:05 -0700)
committerFacebook Github Bot 6 <facebook-github-bot-6-bot@fb.com>
Mon, 30 May 2016 23:09:20 +0000 (16:09 -0700)
Summary:
Diff #14 of 14.

This just switches the includes of the headers, it does not make the adjustments actually required to work for MSVC.

Reviewed By: mzlee

Differential Revision: D3249009

fbshipit-source-id: 434f58a7b8f4d0b7d142bc6a4abed8d95c953a7f

26 files changed:
folly/FileUtil.cpp
folly/SocketAddress.h
folly/Subprocess.cpp
folly/detail/IPAddress.h
folly/detail/SocketFastOpen.h
folly/experimental/io/test/AsyncIOTest.cpp
folly/io/ShutdownSocketSet.cpp
folly/io/async/AsyncSSLSocket.cpp
folly/io/async/AsyncSSLSocket.h
folly/io/async/AsyncServerSocket.cpp
folly/io/async/AsyncServerSocket.h
folly/io/async/AsyncSocket.cpp
folly/io/async/AsyncSocket.h
folly/io/async/AsyncUDPSocket.cpp
folly/io/async/NotificationQueue.h
folly/io/async/SSLContext.h
folly/io/async/ssl/OpenSSLUtils.cpp
folly/io/async/ssl/OpenSSLUtils.h
folly/io/async/test/AsyncSSLSocketTest.cpp
folly/io/async/test/AsyncSSLSocketTest.h
folly/io/async/test/AsyncSocketTest.h
folly/io/async/test/AsyncSocketTest2.cpp
folly/io/async/test/SocketPair.cpp
folly/io/test/ShutdownSocketSetTest.cpp
folly/test/IPAddressTest.h
folly/test/SocketAddressTestHelper.cpp

index 9d50e82ada00692c36750a071d59745d82de07da..71eee1d88f039d0839b3cd67ec22c5c32f6bc3ff 100644 (file)
 #include <folly/FileUtil.h>
 
 #include <cerrno>
-#include <sys/socket.h>
 
 #include <folly/detail/FileUtilDetail.h>
 #include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/SysFile.h>
 
 namespace folly {
index 1953e2135574ee1aecd0d6796394d3dd9230e09c..d48f3ccc81bf43ca88d7b8daef4637f356b831e8 100644 (file)
 #pragma once
 
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <netinet/in.h>
-#include <netdb.h>
 #include <cstddef>
 #include <iostream>
 #include <string>
@@ -28,6 +24,7 @@
 #include <folly/IPAddress.h>
 #include <folly/Portability.h>
 #include <folly/Range.h>
+#include <folly/portability/Sockets.h>
 
 namespace folly {
 
index c208de51eac8b53ec9cc680cd478edaccd513282..1e294ba767b985b91d083877f9eab3984cfe324d 100644 (file)
@@ -24,7 +24,6 @@
 #include <sys/prctl.h>
 #endif
 #include <fcntl.h>
-#include <poll.h>
 
 #include <array>
 #include <algorithm>
@@ -41,6 +40,7 @@
 #include <folly/String.h>
 #include <folly/io/Cursor.h>
 #include <folly/portability/Environment.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 constexpr int kExecFailure = 127;
index 19dba3726bbd9913c4d73434d47ee03371e16dfc..b92ce65785888e8c0a9d605a5fc87b2017432a8e 100644 (file)
 #include <sstream>
 #include <type_traits>
 #include <vector>
-
-extern "C" {
-#ifndef _MSC_VER
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#else
-#include <winsock2.h>
-#include <ws2tcpip.h>
-// missing in socket headers
-#define sa_family_t ADDRESS_FAMILY
-#endif
-
 #include <sys/types.h>
-#include <netdb.h>
-}
 
 #include <folly/Conv.h>
 #include <folly/Format.h>
+#include <folly/portability/Sockets.h>
 
 // BSDish platforms don't provide standard access to s6_addr16
 #ifndef s6_addr16
index a372a902b3ca1df46d4c16d91bca4c225eefcbe6..1295a1e640967311400d06916b4cbe7a0a3e85b5 100644 (file)
@@ -16,7 +16,7 @@
 
 #pragma once
 
-#include <sys/socket.h>
+#include <folly/portability/Sockets.h>
 #include <sys/types.h>
 
 #if !defined(FOLLY_ALLOW_TFO) && defined(TCP_FASTOPEN) && defined(MSG_FASTOPEN)
index e117ebdbbe3dafad65ba00e2265d13b829c665a7..eae19c1d9d2ae59bdf48d57d592ab41d3d9da761 100644 (file)
@@ -19,7 +19,6 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <fcntl.h>
-#include <poll.h>
 
 #include <cstdlib>
 #include <cstdio>
@@ -34,6 +33,7 @@
 #include <folly/experimental/io/FsUtil.h>
 #include <folly/ScopeGuard.h>
 #include <folly/String.h>
+#include <folly/portability/Sockets.h>
 
 namespace fs = folly::fs;
 using folly::AsyncIO;
index 024d14556a60a608d73c059ee971eb0a17a1885a..9114c8f088b85fee77f474d3b48236a8e2f58407 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <folly/io/ShutdownSocketSet.h>
 
-#include <sys/socket.h>
 #include <sys/types.h>
 
 #include <chrono>
@@ -26,6 +25,7 @@
 
 #include <folly/FileUtil.h>
 #include <folly/Malloc.h>
+#include <folly/portability/Sockets.h>
 
 namespace folly {
 
index c972c87764a2884b3a8b84cd197686e13393f2ee..1656589cd34f1e8f6b2ae7bdc112d3edab2a22d4 100644 (file)
 #include <folly/io/async/AsyncSSLSocket.h>
 
 #include <folly/io/async/EventBase.h>
+#include <folly/portability/Sockets.h>
 
 #include <boost/noncopyable.hpp>
 #include <errno.h>
 #include <fcntl.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
 #include <openssl/err.h>
 #include <openssl/asn1.h>
 #include <openssl/ssl.h>
 #include <sys/types.h>
-#include <sys/socket.h>
 #include <chrono>
 
 #include <folly/Bits.h>
index af3fd06b8c1e6a7f9d224a534dd479320c2923eb..b4e4ca47b134a4099ff54e11c42d1cbe476b459e 100644 (file)
@@ -16,7 +16,6 @@
 
 #pragma once
 
-#include <arpa/inet.h>
 #include <iomanip>
 
 #include <folly/Optional.h>
@@ -33,6 +32,7 @@
 #include <folly/Bits.h>
 #include <folly/io/IOBuf.h>
 #include <folly/io/Cursor.h>
+#include <folly/portability/Sockets.h>
 
 namespace folly {
 
index 5d15ff4905cd16ddab052b3bab658ee3ac2c3142..bc68a3096a27c9d735ce1ef8480687c7477829be 100644 (file)
 #include <folly/io/async/EventBase.h>
 #include <folly/io/async/NotificationQueue.h>
 #include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 #include <errno.h>
-#include <netinet/tcp.h>
 #include <string.h>
-#include <sys/socket.h>
 #include <sys/types.h>
 
 namespace folly {
index 9214d231fc7fa18c0d3246a2e5f2950b810fc7d9..d2f5002b45a50fd0d8fa0cea61c3ef4fe3d27656 100644 (file)
 #include <folly/io/async/EventBase.h>
 #include <folly/io/async/EventHandler.h>
 #include <folly/io/async/NotificationQueue.h>
+#include <folly/portability/Sockets.h>
+
 #include <limits.h>
 #include <stddef.h>
-#include <sys/socket.h>
 #include <exception>
 #include <memory>
 #include <vector>
index c35d7b473a6a026e6cfe1d5b6dd090709b543273..0fe8e88613c013b759771b476ed6b7db33344d3c 100644 (file)
 #include <folly/SocketAddress.h>
 #include <folly/io/IOBuf.h>
 #include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/SysUio.h>
 #include <folly/portability/Unistd.h>
 
-#include <poll.h>
 #include <errno.h>
 #include <limits.h>
 #include <thread>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
 #include <boost/preprocessor/control/if.hpp>
 
 using std::string;
index 37fdf08e89318c8703e176f061e57326bde9c4b6..2a77ac3b67465f68aa376827655844c727f711d4 100644 (file)
@@ -25,7 +25,8 @@
 #include <folly/io/async/AsyncTransport.h>
 #include <folly/io/async/DelayedDestruction.h>
 #include <folly/io/async/EventHandler.h>
-#include <sys/socket.h>
+#include <folly/portability/Sockets.h>
+
 #include <sys/types.h>
 
 #include <chrono>
index 236e60e6df0394141ca2c47d47b4ae9d2e8ae9d6..2166f848121420ca6bbaa700d3c4e41ff97cd1cb 100644 (file)
@@ -19,6 +19,7 @@
 #include <folly/io/async/EventBase.h>
 #include <folly/Likely.h>
 #include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 #include <errno.h>
index 0f26d88d51a13546f61d21bbce11af247370344f..625d64ed274512c068f41ad161235dd2e014925a 100644 (file)
@@ -16,7 +16,6 @@
 
 #pragma once
 
-#include <poll.h>
 #include <sys/types.h>
 
 #include <algorithm>
@@ -35,6 +34,7 @@
 #include <folly/ScopeGuard.h>
 #include <folly/SpinLock.h>
 #include <folly/portability/Fcntl.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 #include <glog/logging.h>
index e3ebaf5f7e8bc2486f8fbf90b3291d808e369403..81c8a210de52bf2d65530a97745820ad2d2a2356 100644 (file)
 #include <string>
 #include <random>
 
+// This has to come before SSL.
+#include <folly/portability/Sockets.h>
+
 #include <openssl/ssl.h>
 #include <openssl/tls1.h>
 
-#include <sys/socket.h>
-#include <netinet/in.h>
-
 #include <glog/logging.h>
 
 #ifndef FOLLY_NO_CONFIG
index c276f6d6f7f73809670aa4250d19acab45e431c0..4df8b3b027e04c405be720bfe2203ac851acda2f 100644 (file)
  */
 #include <folly/io/async/ssl/OpenSSLUtils.h>
 #include <folly/ScopeGuard.h>
+#include <folly/portability/Sockets.h>
 
 #include <openssl/err.h>
 #include <openssl/rand.h>
 #include <openssl/ssl.h>
 #include <openssl/x509v3.h>
 
-#include <netinet/in.h>
-#include <sys/socket.h>
-
 #include <glog/logging.h>
 
 namespace folly {
index 5d232c447e8947dbd0a2507ce9292d4379a5be1b..7f211bfd1e76c43a79db6ce1db25cdaf6bd65c1f 100644 (file)
  */
 #pragma once
 
-#include <openssl/x509v3.h>
+#include <folly/portability/Sockets.h>
 
-#include <netinet/in.h>
-#include <sys/socket.h>
+#include <openssl/x509v3.h>
 
 namespace folly {
 namespace ssl {
index 2e5f246213fa7b4bf8351e6ee00b6b173628a7bb..d4078e56b01818c2d5f74234c6bd5c00a98f1c96 100644 (file)
@@ -21,6 +21,7 @@
 #include <folly/io/async/AsyncSSLSocket.h>
 #include <folly/io/async/EventBase.h>
 #include <folly/SocketAddress.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 #include <folly/io/async/test/BlockingSocket.h>
 #include <set>
 #include <fcntl.h>
 #include <openssl/bio.h>
-#include <poll.h>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/tcp.h>
 #include <folly/io/Cursor.h>
 
 using std::string;
index 5c0fe43704543d46a7c9da598bb13b2df4f8ebbc..43ada2497afea62d0b8a5d0bc95da2a50a9fa485 100644 (file)
 #include <folly/io/async/AsyncTransport.h>
 #include <folly/io/async/EventBase.h>
 #include <folly/io/async/ssl/SSLErrors.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 #include <gtest/gtest.h>
 #include <iostream>
 #include <list>
 #include <fcntl.h>
-#include <poll.h>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/tcp.h>
 
 namespace folly {
 
index fe03fa6f9412855580640f5e20d45e8fa1b44896..a0087c13effa913e6d95782236e229fdae2c1d25 100644 (file)
@@ -17,9 +17,9 @@
 
 #include <folly/io/async/AsyncSocket.h>
 #include <folly/io/async/test/BlockingSocket.h>
+#include <folly/portability/Sockets.h>
 
 #include <boost/scoped_array.hpp>
-#include <poll.h>
 
 enum StateEnum {
   STATE_WAITING,
index 927d74f7d3b35dfac42ebe17bff4745078e0eec1..23b806adefca6e908fc1096092a8cab5aac6e0d7 100644 (file)
@@ -24,6 +24,7 @@
 #include <folly/io/IOBuf.h>
 #include <folly/io/async/test/AsyncSocketTest.h>
 #include <folly/io/async/test/Util.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 #include <folly/test/SocketAddressTestHelper.h>
 
 #include <boost/scoped_array.hpp>
 #include <iostream>
 #include <fcntl.h>
-#include <poll.h>
 #include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/tcp.h>
 #include <thread>
 
 using namespace boost;
index eff35d762818ad13cc86293e64ed5addcb68466e..7d0cafd1cf1a9fb6f1a7adab48c336e02088a599 100644 (file)
 #include <folly/io/async/test/SocketPair.h>
 
 #include <folly/Conv.h>
+#include <folly/portability/Sockets.h>
 #include <folly/portability/Unistd.h>
 
 #include <fcntl.h>
 #include <errno.h>
 #include <sys/types.h>
-#include <sys/socket.h>
 #include <stdexcept>
 
 namespace folly {
index 88b9e9894af3490b84b99c36b4ec35699828ba55..63dd96c42631671809e8b1dd57c829515658b6d0 100644 (file)
 #include <chrono>
 #include <thread>
 
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <sys/socket.h>
-
 #include <glog/logging.h>
 #include <gtest/gtest.h>
 
+#include <folly/portability/Sockets.h>
+
 using folly::ShutdownSocketSet;
 
 namespace folly { namespace test {
index ef50c134e523b7117e32572e11a4461f7f89308f..01aa3c49021485caf61b464ba020e03b4c569367 100644 (file)
 
 #include <gtest/gtest.h>
 
-extern "C" {
 #include <sys/types.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-}
 
 #include <folly/IPAddress.h>
+#include <folly/portability/Sockets.h>
 
 namespace folly {
 
index ae29c2e3a3e819636d9ee31b5131cb05f5baff2e..62110239a1e0b2eb25b2701b0d4a309731583bba 100644 (file)
@@ -16,8 +16,7 @@
 
 #include <folly/test/SocketAddressTestHelper.h>
 
-#include <sys/socket.h>
-#include <netdb.h>
+#include <folly/portability/Sockets.h>
 #include <glog/logging.h>
 
 namespace folly {