Browse Source

sysctl(CTL_HW, HW_PHYSMEM) always returns unsigned long. Will work fine for 32 and 64 bit systems. Closes #1233.

v0.7.4-release
avz 14 years ago
committed by Paul Querna
parent
commit
cc83455534
  1. 4
      ChangeLog
  2. 8
      src/platform_freebsd.cc

4
ChangeLog

@ -1,3 +1,7 @@
In development, Version 0.5.1 (unstable)
* #1233 Fix os.totalmem on FreeBSD amd64 (Artem Zaytsev)
2011.07.05, Version 0.5.0 (unstable) 2011.07.05, Version 0.5.0 (unstable)
* New non-default libuv backend to support IOCP on Windows. * New non-default libuv backend to support IOCP on Windows.

8
src/platform_freebsd.cc

@ -181,13 +181,9 @@ double Platform::GetFreeMemory() {
} }
double Platform::GetTotalMemory() { double Platform::GetTotalMemory() {
#if defined(HW_PHYSMEM64) unsigned long info;
uint64_t info;
static int which[] = {CTL_HW, HW_PHYSMEM64};
#else
unsigned int info;
static int which[] = {CTL_HW, HW_PHYSMEM}; static int which[] = {CTL_HW, HW_PHYSMEM};
#endif
size_t size = sizeof(info); size_t size = sizeof(info);
if (sysctl(which, 2, &info, &size, NULL, 0) < 0) { if (sysctl(which, 2, &info, &size, NULL, 0) < 0) {

Loading…
Cancel
Save