$NetBSD: patch-ag,v 1.1 2007/09/25 04:18:26 bjs Exp $ Get the physical memory size using hw.physmem on _PR_HAVE_SYSCTL platforms. --- pr/src/misc/prsystem.c.orig 2006-07-14 18:33:47.000000000 -0400 +++ pr/src/misc/prsystem.c @@ -356,6 +356,19 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMem odm_terminate(); } +#elif defined(_PR_HAVE_SYSCTL) + + int mib[2]; + unsigned long physmem; + size_t len; + + mib[0] = CTL_HW; + mib[1] = HW_PHYSMEM; + len = sizeof(physmem); + if(sysctl(mib, 2, &physmem, &len, NULL, 0) == 0 + && len == sizeof(physmem)) + bytes = physmem; + #else PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);