From 74b83e04aef808c8c4b174ff1f8a90858165cf3a Mon Sep 17 00:00:00 2001 From: falkTX Date: Sun, 19 Nov 2017 03:00:07 +0100 Subject: [PATCH] Fix shm MAP_LOCKED usage, it's Linux only --- source/utils/CarlaShmUtils.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/utils/CarlaShmUtils.hpp b/source/utils/CarlaShmUtils.hpp index 1d45b23b3..71ca6f0f7 100644 --- a/source/utils/CarlaShmUtils.hpp +++ b/source/utils/CarlaShmUtils.hpp @@ -27,7 +27,7 @@ struct carla_shm_t { HANDLE map; bool isServer; const char* filename; }; # ifndef __WINE__ # include # endif -# ifdef CARLA_OS_HAIKU +# ifndef CARLA_OS_LINUX # define MAP_LOCKED 0x0 # endif # include @@ -197,11 +197,7 @@ void* carla_shm_map(carla_shm_t& shm, const std::size_t size) noexcept CARLA_SAFE_ASSERT_RETURN(ret == 0, nullptr); } -# ifdef CARLA_OS_MAC - void* const ptr(::mmap(nullptr, size, PROT_READ|PROT_WRITE, MAP_SHARED, shm.fd, 0)); -# else void* const ptr(::mmap(nullptr, size, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_LOCKED, shm.fd, 0)); -# endif if (ptr == nullptr) { @@ -346,8 +342,12 @@ bool carla_shm_map(carla_shm_t& shm, T*& value) noexcept return (value != nullptr); } +#endif // __WINE__ + // ----------------------------------------------------------------------- -#endif // __WINE__ +#ifndef CARLA_OS_LINUX +# undef MAP_LOCKED +#endif #endif // CARLA_SHM_UTILS_HPP_INCLUDED