Commit 45082113 authored by Saar Gross's avatar Saar Gross Committed by Facebook GitHub Bot

Further changes to support building over XROS

Summary: Include the xr_socket compatibility header in multiple places in folly (net_net_ops, network_address etc.) to have these parts of folly build-able over XROS

Reviewed By: yfeldblum, luciang

Differential Revision: D31057430

fbshipit-source-id: 2aceaa1c1c50da2b1a6a1aa9d401df050d68cef1
parent 5b38d6fa
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
#include <folly/detail/IPAddress.h> #include <folly/detail/IPAddress.h>
#include <folly/hash/Hash.h> #include <folly/hash/Hash.h>
#ifdef __XROS__
#include <xros/portability/third_party/include/netinet/in.h> // @manual
#endif
namespace folly { namespace folly {
class IPAddress; class IPAddress;
......
...@@ -29,9 +29,7 @@ ...@@ -29,9 +29,7 @@
#include <folly/String.h> #include <folly/String.h>
#include <folly/detail/IPAddressSource.h> #include <folly/detail/IPAddressSource.h>
#ifndef _WIN32 #ifdef _WIN32
#include <net/if.h>
#else
// Because of the massive pain that is libnl, this can't go into the socket // Because of the massive pain that is libnl, this can't go into the socket
// portability header as you can't include <linux/if.h> and <net/if.h> in // portability header as you can't include <linux/if.h> and <net/if.h> in
// the same translation unit without getting errors -_-... // the same translation unit without getting errors -_-...
...@@ -40,6 +38,9 @@ ...@@ -40,6 +38,9 @@
// Alias the max size of an interface name to what posix expects. // Alias the max size of an interface name to what posix expects.
#define IFNAMSIZ IF_NAMESIZE #define IFNAMSIZ IF_NAMESIZE
#elif defined __XROS__
#else
#include <net/if.h>
#endif #endif
using std::ostream; using std::ostream;
......
...@@ -245,6 +245,8 @@ inline void fastIpv4AppendToString(const in_addr& inAddr, std::string& out) { ...@@ -245,6 +245,8 @@ inline void fastIpv4AppendToString(const in_addr& inAddr, std::string& out) {
inline size_t fastIpv6ToBufferUnsafe(const in6_addr& in6Addr, char* str) { inline size_t fastIpv6ToBufferUnsafe(const in6_addr& in6Addr, char* str) {
#ifdef _MSC_VER #ifdef _MSC_VER
const uint16_t* bytes = reinterpret_cast<const uint16_t*>(&in6Addr.u.Word); const uint16_t* bytes = reinterpret_cast<const uint16_t*>(&in6Addr.u.Word);
#elif defined __XROS__
const uint16_t* bytes = reinterpret_cast<const uint16_t*>(&in6Addr.s6_addr);
#else #else
const uint16_t* bytes = reinterpret_cast<const uint16_t*>(&in6Addr.s6_addr16); const uint16_t* bytes = reinterpret_cast<const uint16_t*>(&in6Addr.s6_addr16);
#endif #endif
......
...@@ -81,7 +81,7 @@ struct sockaddr_un { ...@@ -81,7 +81,7 @@ struct sockaddr_un {
// Someone thought it would be a good idea // Someone thought it would be a good idea
// to define a field via a macro... // to define a field via a macro...
#undef s_host #undef s_host
#elif defined(__XROS__) || defined(__EMSCRIPTEN__) #elif defined(__EMSCRIPTEN__)
// Stub this out for now. // Stub this out for now.
using nfds_t = int; using nfds_t = int;
using socklen_t = int; using socklen_t = int;
...@@ -101,6 +101,32 @@ struct mmsghdr { ...@@ -101,6 +101,32 @@ struct mmsghdr {
struct msghdr msg_hdr; struct msghdr msg_hdr;
unsigned int msg_len; unsigned int msg_len;
}; };
#elif defined(__XROS__)
#include <xros/portability/net/xr_socket_compat.h> // @manual
// Stub this out for now.
using nfds_t = int;
struct msghdr {
void* msg_name;
socklen_t msg_namelen;
struct iovec* msg_iov;
size_t msg_iovlen;
void* msg_control;
size_t msg_controllen;
int msg_flags;
};
struct mmsghdr {
struct msghdr msg_hdr;
unsigned int msg_len;
};
struct sockaddr_un {
sa_family_t sun_family;
char sun_path[108];
};
#define SHUT_RDWR 5
#else #else
......
...@@ -24,6 +24,10 @@ namespace folly { ...@@ -24,6 +24,10 @@ namespace folly {
namespace portability { namespace portability {
namespace sockets { namespace sockets {
#ifdef __XROS__
#include <xros/portability/net/xr_socket_compat.h> // @manual
#endif
#ifdef _WIN32 #ifdef _WIN32
// Some Windows specific helper functions. // Some Windows specific helper functions.
......
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