sysctl HW_PHYSMEM -> HW_PHYSMEM64; ok wilfried@

This commit is contained in:
naddy 2008-04-16 20:29:38 +00:00
parent a5824ce4c8
commit 8c2a2bdea0
2 changed files with 13 additions and 12 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.10 2008/04/08 13:37:19 jasper Exp $
# $OpenBSD: Makefile,v 1.11 2008/04/16 20:29:38 naddy Exp $
COMMENT= common libraries and data for the MySQL GUI Suites
DISTNAME= mysql-gui-tools-5.0r12
PKGNAME= mysql-gui-common-5.0.6.1r12p0
PKGNAME= mysql-gui-common-5.0.6.1r12p1
CATEGORIES= devel
HOMEPAGE= http://www.mysql.com/products/tools/administrator/

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-library_utilities_source_myx_util_functions_c,v 1.3 2007/10/23 13:37:11 wilfried Exp $
$OpenBSD: patch-library_utilities_source_myx_util_functions_c,v 1.4 2008/04/16 20:29:38 naddy Exp $
--- library/utilities/source/myx_util_functions.c.orig Wed Feb 28 18:36:19 2007
+++ library/utilities/source/myx_util_functions.c Tue Oct 23 13:39:24 2007
+++ library/utilities/source/myx_util_functions.c Tue Apr 15 16:30:18 2008
@@ -52,6 +52,10 @@
# include <sys/types.h>
# include <sys/stat.h>
@ -12,7 +12,7 @@ $OpenBSD: patch-library_utilities_source_myx_util_functions_c,v 1.3 2007/10/23 1
#endif
// MacOS X
@@ -1315,7 +1319,56 @@ static int _get_hardware_info(char **cpu, char **clock
@@ -1315,7 +1319,57 @@ static int _get_hardware_info(char **cpu, char **clock
//----------------------------------------------------------------------------------------------------------------------
@ -22,6 +22,7 @@ $OpenBSD: patch-library_utilities_source_myx_util_functions_c,v 1.3 2007/10/23 1
+ int mib[2];
+ size_t len;
+ int val;
+ int64_t val64;
+ char *p;
+
+#if 0 // string too long
@ -58,10 +59,10 @@ $OpenBSD: patch-library_utilities_source_myx_util_functions_c,v 1.3 2007/10/23 1
+ *cpu_count = val;
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_PHYSMEM;
+ len = sizeof(val);
+ if (sysctl(mib, 2, &val, &len, NULL, 0) != -1)
+ *mem_kb = (unsigned)val/1024;
+ mib[1] = HW_PHYSMEM64;
+ len = sizeof(val64);
+ if (sysctl(mib, 2, &val64, &len, NULL, 0) != -1)
+ *mem_kb = val64/1024;
+
+ return 0;
+}
@ -69,7 +70,7 @@ $OpenBSD: patch-library_utilities_source_myx_util_functions_c,v 1.3 2007/10/23 1
// Linux
static int _get_hardware_info(char **cpu, char **clock, int *cpu_count, unsigned long *mem_kb)
{
@@ -1554,6 +1607,19 @@ bigint get_physical_memory_size()
@@ -1554,6 +1608,19 @@ bigint get_physical_memory_size()
}
return mem64;
@ -77,10 +78,10 @@ $OpenBSD: patch-library_utilities_source_myx_util_functions_c,v 1.3 2007/10/23 1
+ bigint mem64 = 0;
+ int mib[2];
+ size_t len;
+ int val;
+ int64_t val;
+
+ mib[0] = CTL_HW;
+ mib[1] = HW_PHYSMEM;
+ mib[1] = HW_PHYSMEM64;
+ len = sizeof(val);
+ if (sysctl(mib, 2, &val, &len, NULL, 0) != -1)
+ mem64 = val;