Commit a0879217 authored by Yorick Hardy's avatar Yorick Hardy Committed by Alexandre Julliard

Added the sysctl calls for NetBSD to determine the physical memory

available.
parent 401a9e09
......@@ -1573,9 +1573,10 @@ VOID WINAPI GlobalMemoryStatus(
#ifdef linux
FILE *f;
#endif
#ifdef __FreeBSD__
#if defined(__FreeBSD__) || defined(__NetBSD__)
int *tmp;
int size_sys;
int mib[2] = { CTL_HW };
#endif
if (time(NULL)==cache_lastchecked) {
memcpy(lpmem,&cached_memstatus,sizeof(MEMORYSTATUS));
......@@ -1637,17 +1638,19 @@ VOID WINAPI GlobalMemoryStatus(
/ (TotalPhysical / 100);
}
}
#elif defined(__FreeBSD__)
sysctlbyname("hw.physmem", NULL, &size_sys, NULL, 0);
#elif defined(__FreeBSD__) || defined(__NetBSD__)
mib[1] = HW_PHYSMEM;
sysctl(mib, 2, NULL, &size_sys, NULL, 0);
tmp = malloc(size_sys * sizeof(int));
sysctlbyname("hw.physmem", tmp, &size_sys, NULL, 0);
sysctl(mib, 2, tmp, &size_sys, NULL, 0);
if (tmp && *tmp)
{
lpmem->dwTotalPhys = *tmp;
free(tmp);
sysctlbyname("hw.usermem", NULL, &size_sys, NULL, 0);
mib[1] = HW_USERMEM;
sysctl(mib, 2, NULL, &size_sys, NULL, 0);
tmp = malloc(size_sys * sizeof(int));
sysctlbyname("hw.usermem", tmp, &size_sys, NULL, 0);
sysctl(mib, 2, tmp, &size_sys, NULL, 0);
if (tmp && *tmp)
{
lpmem->dwAvailPhys = *tmp;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment