$OpenBSD: patch-library_source_myx_aux_functions_c,v 1.1.1.1 2005/11/04 13:58:34 wilfried Exp $
--- library/source/myx_aux_functions.c.orig	Fri Oct  7 22:14:34 2005
+++ library/source/myx_aux_functions.c	Fri Nov  4 11:48:45 2005
@@ -44,7 +44,12 @@
 # include <sys/types.h>
 # include <sys/stat.h>
 # include <unistd.h>
+
+#if defined (__OpenBSD__)
+# include <sys/param.h>
+# include <sys/sysctl.h>
 #endif
+#endif
 
 // MacOS X
 #if defined(__APPLE__) && defined(__MACH__)
@@ -1281,6 +1286,55 @@ static int _get_hardware_info(char **cpu
   return 0;
 }
 
+#elif defined (__OpenBSD__)
+static int _get_hardware_info(char **cpu, char **clock, int *cpu_count, unsigned long *mem_kb)
+{
+	int mib[2];
+	size_t len;
+	int val;
+	char *p;
+
+#if 0 // string too long
+	mib[0] = CTL_HW;
+	mib[1] = HW_MODEL;
+	if (sysctl(mib, 2, NULL, &len, NULL, 0) != -1)
+		if ((p = malloc(len)) != NULL)
+		{
+			if (sysctl(mib, 2, p, &len, NULL, 0) != -1)
+				*cpu = g_strdup(p);
+			free(p);
+		}
+#else
+	*cpu = g_strdup("");
+#endif
+
+	mib[0] = CTL_HW;
+	mib[1] = HW_CPUSPEED;
+	len = sizeof(val);
+	if (sysctl(mib, 2, &val, &len, NULL, 0) != -1)
+	{
+		if ((p = malloc(16)) != NULL)
+		{
+			snprintf(p, 16, "%d", val);
+			*clock = g_strdup(p);
+			free(p);
+		}
+	}
+
+	mib[0] = CTL_HW;
+	mib[1] = HW_NCPU;
+	len = sizeof(val);
+	if (sysctl(mib, 2, &val, &len, NULL, 0) != -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 = val/1024;
+
+	return 0;
+}
 #else
 // Linux
 static int _get_hardware_info(char **cpu, char **clock, int *cpu_count, unsigned long *mem_kb)
