Commit 46f3788d authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 6

Switch uses of networking headers to <folly/portability/Sockets.h>

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
parent 5c321256
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
#include <folly/FileUtil.h> #include <folly/FileUtil.h>
#include <cerrno> #include <cerrno>
#include <sys/socket.h>
#include <folly/detail/FileUtilDetail.h> #include <folly/detail/FileUtilDetail.h>
#include <folly/portability/Fcntl.h> #include <folly/portability/Fcntl.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/SysFile.h> #include <folly/portability/SysFile.h>
namespace folly { namespace folly {
......
...@@ -17,10 +17,6 @@ ...@@ -17,10 +17,6 @@
#pragma once #pragma once
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netdb.h>
#include <cstddef> #include <cstddef>
#include <iostream> #include <iostream>
#include <string> #include <string>
...@@ -28,6 +24,7 @@ ...@@ -28,6 +24,7 @@
#include <folly/IPAddress.h> #include <folly/IPAddress.h>
#include <folly/Portability.h> #include <folly/Portability.h>
#include <folly/Range.h> #include <folly/Range.h>
#include <folly/portability/Sockets.h>
namespace folly { namespace folly {
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include <sys/prctl.h> #include <sys/prctl.h>
#endif #endif
#include <fcntl.h> #include <fcntl.h>
#include <poll.h>
#include <array> #include <array>
#include <algorithm> #include <algorithm>
...@@ -41,6 +40,7 @@ ...@@ -41,6 +40,7 @@
#include <folly/String.h> #include <folly/String.h>
#include <folly/io/Cursor.h> #include <folly/io/Cursor.h>
#include <folly/portability/Environment.h> #include <folly/portability/Environment.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h> #include <folly/portability/Unistd.h>
constexpr int kExecFailure = 127; constexpr int kExecFailure = 127;
......
...@@ -26,25 +26,11 @@ ...@@ -26,25 +26,11 @@
#include <sstream> #include <sstream>
#include <type_traits> #include <type_traits>
#include <vector> #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 <sys/types.h>
#include <netdb.h>
}
#include <folly/Conv.h> #include <folly/Conv.h>
#include <folly/Format.h> #include <folly/Format.h>
#include <folly/portability/Sockets.h>
// BSDish platforms don't provide standard access to s6_addr16 // BSDish platforms don't provide standard access to s6_addr16
#ifndef s6_addr16 #ifndef s6_addr16
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#pragma once #pragma once
#include <sys/socket.h> #include <folly/portability/Sockets.h>
#include <sys/types.h> #include <sys/types.h>
#if !defined(FOLLY_ALLOW_TFO) && defined(TCP_FASTOPEN) && defined(MSG_FASTOPEN) #if !defined(FOLLY_ALLOW_TFO) && defined(TCP_FASTOPEN) && defined(MSG_FASTOPEN)
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>
#include <poll.h>
#include <cstdlib> #include <cstdlib>
#include <cstdio> #include <cstdio>
...@@ -34,6 +33,7 @@ ...@@ -34,6 +33,7 @@
#include <folly/experimental/io/FsUtil.h> #include <folly/experimental/io/FsUtil.h>
#include <folly/ScopeGuard.h> #include <folly/ScopeGuard.h>
#include <folly/String.h> #include <folly/String.h>
#include <folly/portability/Sockets.h>
namespace fs = folly::fs; namespace fs = folly::fs;
using folly::AsyncIO; using folly::AsyncIO;
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <folly/io/ShutdownSocketSet.h> #include <folly/io/ShutdownSocketSet.h>
#include <sys/socket.h>
#include <sys/types.h> #include <sys/types.h>
#include <chrono> #include <chrono>
...@@ -26,6 +25,7 @@ ...@@ -26,6 +25,7 @@
#include <folly/FileUtil.h> #include <folly/FileUtil.h>
#include <folly/Malloc.h> #include <folly/Malloc.h>
#include <folly/portability/Sockets.h>
namespace folly { namespace folly {
......
...@@ -17,17 +17,15 @@ ...@@ -17,17 +17,15 @@
#include <folly/io/async/AsyncSSLSocket.h> #include <folly/io/async/AsyncSSLSocket.h>
#include <folly/io/async/EventBase.h> #include <folly/io/async/EventBase.h>
#include <folly/portability/Sockets.h>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/asn1.h> #include <openssl/asn1.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include <chrono> #include <chrono>
#include <folly/Bits.h> #include <folly/Bits.h>
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#pragma once #pragma once
#include <arpa/inet.h>
#include <iomanip> #include <iomanip>
#include <folly/Optional.h> #include <folly/Optional.h>
...@@ -33,6 +32,7 @@ ...@@ -33,6 +32,7 @@
#include <folly/Bits.h> #include <folly/Bits.h>
#include <folly/io/IOBuf.h> #include <folly/io/IOBuf.h>
#include <folly/io/Cursor.h> #include <folly/io/Cursor.h>
#include <folly/portability/Sockets.h>
namespace folly { namespace folly {
......
...@@ -26,12 +26,11 @@ ...@@ -26,12 +26,11 @@
#include <folly/io/async/EventBase.h> #include <folly/io/async/EventBase.h>
#include <folly/io/async/NotificationQueue.h> #include <folly/io/async/NotificationQueue.h>
#include <folly/portability/Fcntl.h> #include <folly/portability/Fcntl.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h> #include <folly/portability/Unistd.h>
#include <errno.h> #include <errno.h>
#include <netinet/tcp.h>
#include <string.h> #include <string.h>
#include <sys/socket.h>
#include <sys/types.h> #include <sys/types.h>
namespace folly { namespace folly {
......
...@@ -24,9 +24,10 @@ ...@@ -24,9 +24,10 @@
#include <folly/io/async/EventBase.h> #include <folly/io/async/EventBase.h>
#include <folly/io/async/EventHandler.h> #include <folly/io/async/EventHandler.h>
#include <folly/io/async/NotificationQueue.h> #include <folly/io/async/NotificationQueue.h>
#include <folly/portability/Sockets.h>
#include <limits.h> #include <limits.h>
#include <stddef.h> #include <stddef.h>
#include <sys/socket.h>
#include <exception> #include <exception>
#include <memory> #include <memory>
#include <vector> #include <vector>
......
...@@ -21,17 +21,14 @@ ...@@ -21,17 +21,14 @@
#include <folly/SocketAddress.h> #include <folly/SocketAddress.h>
#include <folly/io/IOBuf.h> #include <folly/io/IOBuf.h>
#include <folly/portability/Fcntl.h> #include <folly/portability/Fcntl.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/SysUio.h> #include <folly/portability/SysUio.h>
#include <folly/portability/Unistd.h> #include <folly/portability/Unistd.h>
#include <poll.h>
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <thread> #include <thread>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <boost/preprocessor/control/if.hpp> #include <boost/preprocessor/control/if.hpp>
using std::string; using std::string;
......
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
#include <folly/io/async/AsyncTransport.h> #include <folly/io/async/AsyncTransport.h>
#include <folly/io/async/DelayedDestruction.h> #include <folly/io/async/DelayedDestruction.h>
#include <folly/io/async/EventHandler.h> #include <folly/io/async/EventHandler.h>
#include <sys/socket.h> #include <folly/portability/Sockets.h>
#include <sys/types.h> #include <sys/types.h>
#include <chrono> #include <chrono>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <folly/io/async/EventBase.h> #include <folly/io/async/EventBase.h>
#include <folly/Likely.h> #include <folly/Likely.h>
#include <folly/portability/Fcntl.h> #include <folly/portability/Fcntl.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h> #include <folly/portability/Unistd.h>
#include <errno.h> #include <errno.h>
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#pragma once #pragma once
#include <poll.h>
#include <sys/types.h> #include <sys/types.h>
#include <algorithm> #include <algorithm>
...@@ -35,6 +34,7 @@ ...@@ -35,6 +34,7 @@
#include <folly/ScopeGuard.h> #include <folly/ScopeGuard.h>
#include <folly/SpinLock.h> #include <folly/SpinLock.h>
#include <folly/portability/Fcntl.h> #include <folly/portability/Fcntl.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h> #include <folly/portability/Unistd.h>
#include <glog/logging.h> #include <glog/logging.h>
......
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
#include <string> #include <string>
#include <random> #include <random>
// This has to come before SSL.
#include <folly/portability/Sockets.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/tls1.h> #include <openssl/tls1.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <glog/logging.h> #include <glog/logging.h>
#ifndef FOLLY_NO_CONFIG #ifndef FOLLY_NO_CONFIG
......
...@@ -15,15 +15,13 @@ ...@@ -15,15 +15,13 @@
*/ */
#include <folly/io/async/ssl/OpenSSLUtils.h> #include <folly/io/async/ssl/OpenSSLUtils.h>
#include <folly/ScopeGuard.h> #include <folly/ScopeGuard.h>
#include <folly/portability/Sockets.h>
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/rand.h> #include <openssl/rand.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#include <openssl/x509v3.h> #include <openssl/x509v3.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <glog/logging.h> #include <glog/logging.h>
namespace folly { namespace folly {
......
...@@ -15,10 +15,9 @@ ...@@ -15,10 +15,9 @@
*/ */
#pragma once #pragma once
#include <openssl/x509v3.h> #include <folly/portability/Sockets.h>
#include <netinet/in.h> #include <openssl/x509v3.h>
#include <sys/socket.h>
namespace folly { namespace folly {
namespace ssl { namespace ssl {
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <folly/io/async/AsyncSSLSocket.h> #include <folly/io/async/AsyncSSLSocket.h>
#include <folly/io/async/EventBase.h> #include <folly/io/async/EventBase.h>
#include <folly/SocketAddress.h> #include <folly/SocketAddress.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h> #include <folly/portability/Unistd.h>
#include <folly/io/async/test/BlockingSocket.h> #include <folly/io/async/test/BlockingSocket.h>
...@@ -32,10 +33,7 @@ ...@@ -32,10 +33,7 @@
#include <set> #include <set>
#include <fcntl.h> #include <fcntl.h>
#include <openssl/bio.h> #include <openssl/bio.h>
#include <poll.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <folly/io/Cursor.h> #include <folly/io/Cursor.h>
using std::string; using std::string;
......
...@@ -27,16 +27,14 @@ ...@@ -27,16 +27,14 @@
#include <folly/io/async/AsyncTransport.h> #include <folly/io/async/AsyncTransport.h>
#include <folly/io/async/EventBase.h> #include <folly/io/async/EventBase.h>
#include <folly/io/async/ssl/SSLErrors.h> #include <folly/io/async/ssl/SSLErrors.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h> #include <folly/portability/Unistd.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <iostream> #include <iostream>
#include <list> #include <list>
#include <fcntl.h> #include <fcntl.h>
#include <poll.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
namespace folly { namespace folly {
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
#include <folly/io/async/AsyncSocket.h> #include <folly/io/async/AsyncSocket.h>
#include <folly/io/async/test/BlockingSocket.h> #include <folly/io/async/test/BlockingSocket.h>
#include <folly/portability/Sockets.h>
#include <boost/scoped_array.hpp> #include <boost/scoped_array.hpp>
#include <poll.h>
enum StateEnum { enum StateEnum {
STATE_WAITING, STATE_WAITING,
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <folly/io/IOBuf.h> #include <folly/io/IOBuf.h>
#include <folly/io/async/test/AsyncSocketTest.h> #include <folly/io/async/test/AsyncSocketTest.h>
#include <folly/io/async/test/Util.h> #include <folly/io/async/test/Util.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h> #include <folly/portability/Unistd.h>
#include <folly/test/SocketAddressTestHelper.h> #include <folly/test/SocketAddressTestHelper.h>
...@@ -31,10 +32,7 @@ ...@@ -31,10 +32,7 @@
#include <boost/scoped_array.hpp> #include <boost/scoped_array.hpp>
#include <iostream> #include <iostream>
#include <fcntl.h> #include <fcntl.h>
#include <poll.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <thread> #include <thread>
using namespace boost; using namespace boost;
......
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
#include <folly/io/async/test/SocketPair.h> #include <folly/io/async/test/SocketPair.h>
#include <folly/Conv.h> #include <folly/Conv.h>
#include <folly/portability/Sockets.h>
#include <folly/portability/Unistd.h> #include <folly/portability/Unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include <stdexcept> #include <stdexcept>
namespace folly { namespace folly {
......
...@@ -19,13 +19,11 @@ ...@@ -19,13 +19,11 @@
#include <chrono> #include <chrono>
#include <thread> #include <thread>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <folly/portability/Sockets.h>
using folly::ShutdownSocketSet; using folly::ShutdownSocketSet;
namespace folly { namespace test { namespace folly { namespace test {
......
...@@ -20,13 +20,10 @@ ...@@ -20,13 +20,10 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
extern "C" {
#include <sys/types.h> #include <sys/types.h>
#include <arpa/inet.h>
#include <sys/socket.h>
}
#include <folly/IPAddress.h> #include <folly/IPAddress.h>
#include <folly/portability/Sockets.h>
namespace folly { namespace folly {
......
...@@ -16,8 +16,7 @@ ...@@ -16,8 +16,7 @@
#include <folly/test/SocketAddressTestHelper.h> #include <folly/test/SocketAddressTestHelper.h>
#include <sys/socket.h> #include <folly/portability/Sockets.h>
#include <netdb.h>
#include <glog/logging.h> #include <glog/logging.h>
namespace folly { namespace folly {
......
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