diff --git a/src/pal/src/loader/module.cpp b/src/pal/src/loader/module.cpp index 7cae708c76dd..dfc4b3073807 100644 --- a/src/pal/src/loader/module.cpp +++ b/src/pal/src/loader/module.cpp @@ -56,7 +56,7 @@ Module Name: #include #include -#if !defined(__APPLE__) +#if defined(__LINUX__) #include #endif @@ -1382,6 +1382,8 @@ static HMODULE LOADLoadLibrary(LPCSTR ShortAsciiName, BOOL fDynamic) { #if defined(__APPLE__) ShortAsciiName = "libc.dylib"; +#elif defined(__FreeBSD__) + ShortAsciiName = "libc.so"; #else ShortAsciiName = LIBC_SO; #endif @@ -1939,4 +1941,4 @@ PAL_GetSymbolModuleBase(void *symbol) PERF_EXIT(PAL_GetPalModuleBase); return retval; -} \ No newline at end of file +} diff --git a/src/pal/src/misc/sysinfo.cpp b/src/pal/src/misc/sysinfo.cpp index 9bd442f49085..1f6f91278916 100644 --- a/src/pal/src/misc/sysinfo.cpp +++ b/src/pal/src/misc/sysinfo.cpp @@ -76,6 +76,16 @@ SET_DEFAULT_DEBUG_CHANNEL(MISC); #include #endif +#ifndef __APPLE__ +#if HAVE_SYSCONF && HAVE__SC_AVPHYS_PAGES +#define SYSCONF_PAGES _SC_AVPHYS_PAGES +#elif HAVE_SYSCONF && HAVE__SC_PHYS_PAGES +#define SYSCONF_PAGES _SC_PHYS_PAGES +#else +#error Dont know how to get page-size on this architecture! +#endif +#endif // __APPLE__ + /*++ Function: @@ -256,8 +266,8 @@ GlobalMemoryStatusEx( // We do this only when we have the total physical memory available. if (lpBuffer->ullTotalPhys > 0) { -#if HAVE_SYSCONF && HAVE__SC_AVPHYS_PAGES - lpBuffer->ullAvailPhys = sysconf(_SC_AVPHYS_PAGES) * sysconf(_SC_PAGE_SIZE); +#ifndef __APPLE__ + lpBuffer->ullAvailPhys = sysconf(SYSCONF_PAGES) * sysconf(_SC_PAGE_SIZE); INT64 used_memory = lpBuffer->ullTotalPhys - lpBuffer->ullAvailPhys; lpBuffer->dwMemoryLoad = (DWORD)((used_memory * 100) / lpBuffer->ullTotalPhys); #else @@ -276,7 +286,7 @@ GlobalMemoryStatusEx( lpBuffer->dwMemoryLoad = (DWORD)((used_memory * 100) / lpBuffer->ullTotalPhys); } } -#endif // HAVE_SYSCONF +#endif // __APPLE__ } // TODO: figure out a way to get the real values for the total / available virtual