From 671ba8312ae525622fa0fc610a899da7bf9d3e06 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Fri, 20 Jan 2017 14:45:41 -0500 Subject: [PATCH] Get the page size on Windows --- src/core/System.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/System.cc b/src/core/System.cc index 70117e7..ba8f4b3 100644 --- a/src/core/System.cc +++ b/src/core/System.cc @@ -17,14 +17,20 @@ static std::string Executable_Path; bool System::init(char * argv[]) { - long sc_page_size = sysconf(_SC_PAGESIZE); - if (sc_page_size < 0) +#if defined(PLATFORM_LINUX) + long system_page_size = sysconf(_SC_PAGESIZE); + if (system_page_size < 0) { fprintf(stderr, "Unable to determine operating system page size.\n"); return false; } +#elif defined(PLATFORM_WINDOWS) + SYSTEM_INFO system_info = {0}; + GetSystemInfo(&system_info); + unsigned long system_page_size = system_info.dwPageSize; +#endif - System::page_size = (unsigned long)sc_page_size; + System::page_size = (unsigned long)system_page_size; System::page_size_log = 0u; System::page_offset_mask = System::page_size - 1u; System::page_base_mask = ~System::page_offset_mask;