From c106e6cb2440badb624cf6f48e36be8eaa30f9db Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Wed, 8 May 2024 22:33:23 +0800 Subject: [PATCH] Minor fixes for < 10.6 (#515) * Fix for missing AI_NUMERICSERV on < 10.6 * Do not use pthread_setname_np on < 10.6 --- ixwebsocket/IXDNSLookup.cpp | 6 ++++++ ixwebsocket/IXSetThreadName.cpp | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ixwebsocket/IXDNSLookup.cpp b/ixwebsocket/IXDNSLookup.cpp index 5966be23..cc39a383 100644 --- a/ixwebsocket/IXDNSLookup.cpp +++ b/ixwebsocket/IXDNSLookup.cpp @@ -35,6 +35,12 @@ #endif #endif +#ifdef __APPLE__ +#ifndef AI_NUMERICSERV +#define AI_NUMERICSERV 0 +#endif +#endif + namespace ix { const int64_t DNSLookup::kDefaultWait = 1; // ms diff --git a/ixwebsocket/IXSetThreadName.cpp b/ixwebsocket/IXSetThreadName.cpp index b1e77379..2f4ee75b 100644 --- a/ixwebsocket/IXSetThreadName.cpp +++ b/ixwebsocket/IXSetThreadName.cpp @@ -15,6 +15,10 @@ #include #endif +#ifdef __APPLE__ +#include +#endif + // Windows #ifdef _WIN32 #include @@ -58,7 +62,7 @@ namespace ix void setThreadName(const std::string& name) { -#if defined(__APPLE__) +#if defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) // // Apple reserves 16 bytes for its thread names // Notice that the Apple version of pthread_setname_np