$OpenBSD: patch-src_libtracker-common_tracker-os-dependant-unix_c,v 1.3 2012/01/02 14:11:21 ajacoutot Exp $
--- src/libtracker-common/tracker-os-dependant-unix.c.orig	Mon Jan  2 14:50:59 2012
+++ src/libtracker-common/tracker-os-dependant-unix.c	Mon Jan  2 14:50:11 2012
@@ -26,6 +26,12 @@
 #include <unistd.h>
 #include <sys/resource.h>
 
+#if defined (__OpenBSD__)
+#include <errno.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#endif
+
 #include <glib.h>
 
 #include "tracker-log.h"
@@ -225,10 +231,11 @@ tracker_create_permission_string (struct stat finfo)
 static guint
 get_memory_total (void)
 {
+	glong        total = 0;
+#if !defined (__OpenBSD__)
 	GError      *error = NULL;
 	const gchar *filename;
 	gchar       *contents = NULL;
-	glong        total = 0;
 
 	filename = "/proc/meminfo";
 
@@ -258,6 +265,19 @@ get_memory_total (void)
 		}
 		g_free (contents);
 	}
+#else
+	int64_t physmem;
+	size_t len;
+	static int mib[2] = { CTL_HW, HW_PHYSMEM64 };
+
+	len = sizeof(physmem);
+
+	if (sysctl(mib, 2, &physmem, &len, NULL, 0) == -1) {
+		g_critical ("Couldn't get memory information: %d", errno);
+	} else {
+		total = physmem;
+	}
+#endif /* !OpenBSD */
 
 	if (!total) {
 		/* Setting limit to an arbitary limit */
