Browse Source

Fix shm MAP_LOCKED usage, it's Linux only

tags/1.9.8
falkTX 7 years ago
parent
commit
74b83e04ae
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      source/utils/CarlaShmUtils.hpp

+ 6
- 6
source/utils/CarlaShmUtils.hpp View File

@@ -27,7 +27,7 @@ struct carla_shm_t { HANDLE map; bool isServer; const char* filename; };
# ifndef __WINE__
# include <cerrno>
# endif
# ifdef CARLA_OS_HAIKU
# ifndef CARLA_OS_LINUX
# define MAP_LOCKED 0x0
# endif
# include <fcntl.h>
@@ -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

Loading…
Cancel
Save