mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-04 23:32:26 +00:00
Fix KSM build
This commit is contained in:
parent
49d45d7686
commit
7aa669d041
@ -25,7 +25,6 @@
|
||||
#include <unistd.h> // For sysconf, sbrk
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
// Windows-specific functionality
|
||||
|
||||
@ -48,6 +47,38 @@ size_t PageAlignedAllocatorBase::getPageSize() const
|
||||
return sysInfo.dwPageSize; // Page size in bytes
|
||||
}
|
||||
|
||||
namespace KSM {
|
||||
|
||||
// Windows-specific placeholder functions (no-op)
|
||||
void CheckPageAlignment(void* ptr)
|
||||
{
|
||||
}
|
||||
|
||||
void* AllocatePageAligned(size_t size)
|
||||
{
|
||||
return memset(malloc(size), 0, size);
|
||||
}
|
||||
|
||||
void MarkMemoryForKSM(void* start, size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
void AlignHeapToPageBoundary()
|
||||
{
|
||||
}
|
||||
|
||||
void* MarkHeapStart()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t MeasureHeapUsage(void* start)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace KSM
|
||||
|
||||
#else
|
||||
|
||||
// Linux-specific functionality
|
||||
@ -69,6 +100,8 @@ size_t PageAlignedAllocatorBase::getPageSize() const
|
||||
return static_cast<size_t>(sysconf(_SC_PAGESIZE));
|
||||
}
|
||||
|
||||
namespace KSM {
|
||||
|
||||
void CheckPageAlignment(void* ptr)
|
||||
{
|
||||
size_t page_size = sysconf(_SC_PAGESIZE);
|
||||
@ -154,4 +187,6 @@ size_t MeasureHeapUsage(void* start)
|
||||
return static_cast<char*>(current_break) - static_cast<char*>(start);
|
||||
}
|
||||
|
||||
} // namespace KSM
|
||||
|
||||
#endif
|
||||
|
||||
@ -64,38 +64,6 @@ bool operator!=(const PageAlignedAllocator<T>&, const PageAlignedAllocator<U>&)
|
||||
// Kernel Samepage Merging (KSM) functionality
|
||||
namespace KSM {
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
// Windows-specific placeholder functions (no-op)
|
||||
inline void CheckPageAlignment(void* ptr)
|
||||
{
|
||||
}
|
||||
|
||||
inline void* AllocatePageAligned(size_t size)
|
||||
{
|
||||
return memset(malloc(size), 0, size);
|
||||
}
|
||||
|
||||
inline void MarkMemoryForKSM(void* start, size_t size)
|
||||
{
|
||||
}
|
||||
|
||||
inline void AlignHeapToPageBoundary()
|
||||
{
|
||||
}
|
||||
|
||||
inline void* MarkHeapStart()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline size_t MeasureHeapUsage(void* start)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void CheckPageAlignment(void* ptr);
|
||||
void* AllocatePageAligned(size_t size);
|
||||
void MarkMemoryForKSM(void* start, size_t size);
|
||||
@ -103,5 +71,4 @@ void AlignHeapToPageBoundary();
|
||||
void* MarkHeapStart();
|
||||
size_t MeasureHeapUsage(void* start);
|
||||
|
||||
#endif
|
||||
}
|
||||
} // namespace KSM
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user