diff --git a/CMakeLists.txt b/CMakeLists.txt index 30b42284a..b72da837d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -573,6 +573,9 @@ if(NOT MINIUPNP_FOUND) option(UPNPC_BUILD_SAMPLE "Build sample executables" OFF) option(UPNPC_NO_INSTALL "Disable installation" ON) add_subdirectory(core/deps/miniupnpc) + if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD") + set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE") + endif() if(WINDOWS_STORE) get_target_property(miniupnpc-private-defs miniupnpc-private INTERFACE_COMPILE_DEFINITIONS) list(REMOVE_ITEM miniupnpc-private-defs "_WIN32_WINNT=0x0501") diff --git a/core/hw/naomi/multiboard.h b/core/hw/naomi/multiboard.h index 10a7b72b6..f2c273bda 100644 --- a/core/hw/naomi/multiboard.h +++ b/core/hw/naomi/multiboard.h @@ -140,9 +140,7 @@ public: { pthread_mutexattr_t mattr; pthread_mutexattr_init(&mattr); -#if !defined(__NetBSD__) && !defined(__OpenBSD__) pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED); -#endif pthread_mutex_init(&mutex, &mattr); pthread_mutexattr_destroy(&mattr); } @@ -176,9 +174,7 @@ public: { pthread_condattr_t cvattr; pthread_condattr_init(&cvattr); -#if !defined(__NetBSD__) && !defined(__OpenBSD__) pthread_condattr_setpshared(&cvattr, PTHREAD_PROCESS_SHARED); -#endif pthread_cond_init(&cond, &cvattr); pthread_condattr_destroy(&cvattr); } diff --git a/core/linux/context.cpp b/core/linux/context.cpp index 50e3b0b8d..2d5bd6230 100644 --- a/core/linux/context.cpp +++ b/core/linux/context.cpp @@ -98,9 +98,9 @@ static void context_segfault(host_context_t* hostctx, void* segfault_ctx) bicopy(hostctx->rdi, MCTX(->sc_rdi)); #elif defined(__NetBSD__) bicopy(hostctx->pc, MCTX(.__gregs[_REG_RIP])); - bicopy(hostctx->rsp, MCTX(.__gregs[REG_RSP])); - bicopy(hostctx->r9, MCTX(.__gregs[REG_R9])); - bicopy(hostctx->rdi, MCTX(.__gregs[REG_RDI])); + bicopy(hostctx->rsp, MCTX(.__gregs[_REG_RSP])); + bicopy(hostctx->r9, MCTX(.__gregs[_REG_R9])); + bicopy(hostctx->rdi, MCTX(.__gregs[_REG_RDI])); #elif defined(__unix__) bicopy(hostctx->pc, MCTX(.gregs[REG_RIP])); bicopy(hostctx->rsp, MCTX(.gregs[REG_RSP])); diff --git a/core/log/StringUtil.h b/core/log/StringUtil.h index b14a9a645..ea804dc61 100644 --- a/core/log/StringUtil.h +++ b/core/log/StringUtil.h @@ -24,7 +24,7 @@ int vasprintf(char **s, const char *fmt, va_list ap) } #endif -#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__SWITCH__) +#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__SWITCH__) static locale_t GetCLocale() { static locale_t c_locale = newlocale(LC_ALL_MASK, "C", nullptr); @@ -69,11 +69,11 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar writtenCount = vsnprintf(out, outsize, format, args); #endif #else -#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__SWITCH__) +#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__SWITCH__) locale_t previousLocale = uselocale(GetCLocale()); #endif writtenCount = vsnprintf(out, outsize, format, args); -#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__SWITCH__) +#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__SWITCH__) uselocale(previousLocale); #endif #endif @@ -101,7 +101,7 @@ std::string StringFromFormatV(const char* format, va_list args) std::string temp = buf; delete[] buf; #else -#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__SWITCH__) +#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__SWITCH__) locale_t previousLocale = uselocale(GetCLocale()); #endif if (vasprintf(&buf, format, args) < 0) @@ -110,7 +110,7 @@ std::string StringFromFormatV(const char* format, va_list args) buf = nullptr; } -#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__SWITCH__) +#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__SWITCH__) uselocale(previousLocale); #endif