fix thread setname on NetBSD

Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
R4SAS 2021-01-26 18:53:56 +03:00
parent fd73aab7d0
commit 5931cb59ab

View File

@ -119,10 +119,12 @@ namespace util
} }
void SetThreadName (const char *name) { void SetThreadName (const char *name) {
#if defined (__APPLE__) #if defined(__APPLE__)
pthread_setname_np(name); pthread_setname_np(name);
#elif defined(__FreeBSD__) || defined(__OpenBSD__) #elif defined(__FreeBSD__) || defined(__OpenBSD__)
pthread_set_name_np(pthread_self(), name); pthread_set_name_np(pthread_self(), name);
#elif defined(__NetBSD__)
pthread_setname_np(pthread_self(), "%s", (void *)name);
#else #else
pthread_setname_np(pthread_self(), name); pthread_setname_np(pthread_self(), name);
#endif #endif
@ -437,15 +439,15 @@ namespace net
boost::asio::ip::address_v6::bytes_type bytes; boost::asio::ip::address_v6::bytes_type bytes;
memcpy (bytes.data (), &sa->sin6_addr, 16); memcpy (bytes.data (), &sa->sin6_addr, 16);
return boost::asio::ip::address_v6 (bytes); return boost::asio::ip::address_v6 (bytes);
} }
} }
cur = cur->ifa_next; cur = cur->ifa_next;
} }
} }
return boost::asio::ip::address_v6 (); return boost::asio::ip::address_v6 ();
#endif #endif
} }
bool IsInReservedRange (const boost::asio::ip::address& host, bool checkYggdrasil) bool IsInReservedRange (const boost::asio::ip::address& host, bool checkYggdrasil)
{ {
// https://en.wikipedia.org/wiki/Reserved_IP_addresses // https://en.wikipedia.org/wiki/Reserved_IP_addresses