Changeset: 8b4df6144801 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8b4df6144801
Modified Files:
gdk/gdk_utils.mx
Branch: Apr2011
Log Message:
memory detection: only use 64-bits methods on 64-bits configurations
In the quest to get memory detection right on all BSD and Darwin
machines, this commit tries to finally fix it everywhere. Last commit
here broke detection on 32-bits Darwin, since the 64-bit method to
retrieve the memory is available there too, but the idea was not to use
it. Hence, guard in such a way that we only use the 64-bits methods
when we're running a 64-bits target.
On FreeBSD, HW_MEMSIZE returns an unsigned long (non-documented, but
visible in the code and sysctl.h header), which hence adapts to the
caller's target.
diffs (36 lines):
diff --git a/gdk/gdk_utils.mx b/gdk/gdk_utils.mx
--- a/gdk/gdk_utils.mx
+++ b/gdk/gdk_utils.mx
@@ -500,7 +500,7 @@
GlobalMemoryStatus(&memStat);
_MT_npages = memStat.dwTotalPhys / _MT_pagesize;
}
-#elif defined(HAVE_SYS_SYSCTL_H) && defined(HW_MEMSIZE)
+#elif defined(HAVE_SYS_SYSCTL_H) && defined(HW_MEMSIZE) && SIZEOF_SIZE_T ==
SIZEOF_LNG
/* Darwin, 64-bits */
{
uint64_t size = 0;
@@ -514,7 +514,7 @@
sysctl(mib, 2, &size, &len, NULL, 0);
_MT_npages = size / _MT_pagesize;
}
-#elif defined(HAVE_SYS_SYSCTL_H) && defined (HW_PHYSMEM64)
+#elif defined(HAVE_SYS_SYSCTL_H) && defined (HW_PHYSMEM64) && SIZEOF_SIZE_T ==
SIZEOF_LNG
/* OpenBSD, 64-bits */
{
int64_t size = 0;
@@ -529,9 +529,13 @@
_MT_npages = size / _MT_pagesize;
}
#elif defined(HAVE_SYS_SYSCTL_H) && defined(HW_PHYSMEM)
- /* FreeBSD, NetBSD, OpenBSD, Darwin, 32-bits */
+ /* NetBSD, OpenBSD, Darwin, 32-bits; FreeBSD 32 & 64-bits */
{
+# ifdef __FreeBSD__
+ unsigned long size = 0
+# else
int size = 0;
+# endif
size_t len = sizeof(size);
int mib[2];
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list