From f700d553abb984e59167b63f8c1a8ae8ad793cb4 Mon Sep 17 00:00:00 2001 From: nipos Date: Mon, 20 Feb 2023 15:29:50 +0000 Subject: [PATCH] LibCore: Add support for NetBSD in anon_create --- Meta/Lagom/CMakeLists.txt | 4 ++++ Userland/Libraries/LibCore/System.cpp | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 6a81dc92d1..743a05593e 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -333,6 +333,10 @@ install(TARGETS LibC LibCrypt LibSystem NoCoverage EXPORT LagomTargets) add_serenity_subdirectory(AK) add_serenity_subdirectory(Userland/Libraries/LibCore) target_link_libraries(LibCore PRIVATE Threads::Threads) +if (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD") + # NetBSD has its shm_open and shm_unlink functions in librt so we need to link that + target_link_libraries(LibCore PRIVATE librt.so) +endif() target_sources(LibCore PRIVATE ${AK_SOURCES}) # LibMain diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index cd997ae9ba..d662d5d705 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -403,7 +403,7 @@ ErrorOr anon_create([[maybe_unused]] size_t size, [[maybe_unused]] int opti TRY(close(fd)); return Error::from_errno(saved_errno); } -#elif defined(AK_OS_MACOS) || defined(AK_OS_EMSCRIPTEN) || defined(AK_OS_OPENBSD) +#elif defined(AK_OS_MACOS) || defined(AK_OS_EMSCRIPTEN) || defined(AK_OS_OPENBSD) || defined(AK_OS_NETBSD) struct timespec time; clock_gettime(CLOCK_REALTIME, &time); auto name = DeprecatedString::formatted("/shm-{}{}", (unsigned long)time.tv_sec, (unsigned long)time.tv_nsec);