From 5931cb59abe19c0722d3bc51dc99145c067e01f5 Mon Sep 17 00:00:00 2001 From: R4SAS Date: Tue, 26 Jan 2021 18:53:56 +0300 Subject: [PATCH] fix thread setname on NetBSD Signed-off-by: R4SAS --- libi2pd/util.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libi2pd/util.cpp b/libi2pd/util.cpp index 123d233c..ff27718a 100644 --- a/libi2pd/util.cpp +++ b/libi2pd/util.cpp @@ -119,10 +119,12 @@ namespace util } void SetThreadName (const char *name) { -#if defined (__APPLE__) +#if defined(__APPLE__) pthread_setname_np(name); #elif defined(__FreeBSD__) || defined(__OpenBSD__) pthread_set_name_np(pthread_self(), name); +#elif defined(__NetBSD__) + pthread_setname_np(pthread_self(), "%s", (void *)name); #else pthread_setname_np(pthread_self(), name); #endif @@ -437,15 +439,15 @@ namespace net boost::asio::ip::address_v6::bytes_type bytes; memcpy (bytes.data (), &sa->sin6_addr, 16); return boost::asio::ip::address_v6 (bytes); - } - } + } + } cur = cur->ifa_next; - } + } } return boost::asio::ip::address_v6 (); -#endif - } - +#endif + } + bool IsInReservedRange (const boost::asio::ip::address& host, bool checkYggdrasil) { // https://en.wikipedia.org/wiki/Reserved_IP_addresses