Commit cd8df4fb authored by Douglas Carmichael's avatar Douglas Carmichael

OpenBSD compilation support.

parent 16730fc6
...@@ -209,6 +209,8 @@ ...@@ -209,6 +209,8 @@
# endif # endif
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
# define CAF_BSD # define CAF_BSD
#elif defined(__OpenBSD__)
# define CAF_BSD
#elif defined(__CYGWIN__) #elif defined(__CYGWIN__)
# define CAF_CYGWIN # define CAF_CYGWIN
#elif defined(WIN32) || defined(_WIN32) #elif defined(WIN32) || defined(_WIN32)
......
...@@ -288,8 +288,10 @@ bool interfaces::get_endpoint(const std::string& host, uint16_t port, ...@@ -288,8 +288,10 @@ bool interfaces::get_endpoint(const std::string& host, uint16_t port,
hint.ai_socktype = SOCK_DGRAM; hint.ai_socktype = SOCK_DGRAM;
if (preferred) if (preferred)
hint.ai_family = *preferred == protocol::network::ipv4 ? AF_INET : AF_INET6; hint.ai_family = *preferred == protocol::network::ipv4 ? AF_INET : AF_INET6;
#ifndef __OpenBSD__
if (hint.ai_family == AF_INET6) if (hint.ai_family == AF_INET6)
hint.ai_flags = AI_V4MAPPED; hint.ai_flags = AI_V4MAPPED;
#endif
addrinfo* tmp = nullptr; addrinfo* tmp = nullptr;
if (getaddrinfo(host.c_str(), port_hint, &hint, &tmp) != 0) if (getaddrinfo(host.c_str(), port_hint, &hint, &tmp) != 0)
return false; return false;
......
...@@ -96,7 +96,12 @@ const int ec_interrupted_syscall = EINTR; ...@@ -96,7 +96,12 @@ const int ec_interrupted_syscall = EINTR;
// platform-dependent SIGPIPE setup // platform-dependent SIGPIPE setup
#if defined(CAF_MACOS) || defined(CAF_IOS) || defined(CAF_BSD) #if defined(CAF_MACOS) || defined(CAF_IOS) || defined(CAF_BSD)
// Use the socket option but no flags to recv/send on macOS/iOS/BSD. // Use the socket option but no flags to recv/send on macOS/iOS/BSD.
// (OpenBSD doesn't have SO_NOSIGPIPE)
#ifndef __OpenBSD__
const int no_sigpipe_socket_flag = SO_NOSIGPIPE; const int no_sigpipe_socket_flag = SO_NOSIGPIPE;
#else
const int no_sigpipe_socket_flag = 0;
#endif
const int no_sigpipe_io_flag = 0; const int no_sigpipe_io_flag = 0;
#elif defined(CAF_WINDOWS) #elif defined(CAF_WINDOWS)
// Do nothing on Windows (SIGPIPE does not exist). // Do nothing on Windows (SIGPIPE does not exist).
......
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