1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fix compilation on non Linux targets

This commit is contained in:
Steffen Vogel 2018-08-21 15:55:32 +02:00
parent 1ca73d018c
commit 8ea4016803
2 changed files with 13 additions and 5 deletions

View file

@ -26,10 +26,6 @@ add_library(villas-common SHARED
memory.cpp
memory_manager.cpp
kernel/kernel.c
kernel/pci.c
kernel/vfio.cpp
utils.c
list.c
log.c
@ -37,6 +33,14 @@ add_library(villas-common SHARED
log_helper.c
)
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
target_sources(villas-common
kernel/kernel.c
kernel/pci.c
kernel/vfio.cpp
)
endif()
target_include_directories(villas-common PUBLIC
${villas-common_SOURCE_DIR}/include
${villas-common_SOURCE_DIR}/thirdparty/spdlog/include

View file

@ -39,9 +39,13 @@ HostRam::HostRamAllocator::allocateBlock(size_t size)
size &= size_t(~0xFFF);
}
const int mmap_flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT;
const int mmap_flags = MAP_PRIVATE | MAP_ANONYMOUS;
const int mmap_protection = PROT_READ | PROT_WRITE;
#ifdef __linux__
mmap_flags |= MAP_32BIT;
#endif
const void* addr = mmap(nullptr, size, mmap_protection, mmap_flags, 0, 0);
if(addr == nullptr) {
throw std::bad_alloc();