diff --git a/sysdeps/openbsd/cpu.c b/sysdeps/openbsd/cpu.c
index 81b4cac..fdc11f4 100644
--- a/sysdeps/openbsd/cpu.c
+++ b/sysdeps/openbsd/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.6 2011/05/31 14:19:18 jasper Exp $	*/
+/* $OpenBSD: cpu.c,v 1.7 2011/07/10 15:23:01 jasper Exp $	*/
 
 /* Copyright (C) 1998 Joshua Sled
    This file is part of LibGTop 1.0.
@@ -70,14 +70,14 @@ glibtop_get_cpu_p (glibtop *server, glibtop_cpu *buf)
 
 	length = sizeof (cpts);
 	if (sysctl (mib2, mib_length, cpts, &length, NULL, 0)) {
-		glibtop_warn_io_r (server, "sysctl");
+		glibtop_warn_io_r (server, "sysctl (kern.cptime)");
 		return;
 	}
 
 	/* Get the clockrate data */
 	length = sizeof (struct clockinfo);
 	if (sysctl (mib, mib_length, &ci, &length, NULL, 0)) {
-		glibtop_warn_io_r (server, "sysctl");
+		glibtop_warn_io_r (server, "sysctl (kern.clockrate)");
 		return;
 	}
 
diff --git a/sysdeps/openbsd/mem.c b/sysdeps/openbsd/mem.c
index 3d90b97..b0b0ed1 100644
--- a/sysdeps/openbsd/mem.c
+++ b/sysdeps/openbsd/mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.c,v 1.8 2011/05/26 08:07:22 jasper Exp $	*/
+/* $OpenBSD: mem.c,v 1.11 2011/07/10 15:23:01 jasper Exp $	*/
 
 /* Copyright (C) 1998 Joshua Sled
    This file is part of LibGTop 1.0.
@@ -28,17 +28,17 @@
 
 #include <glibtop_suid.h>
 
+#include <sys/mount.h>
 #include <sys/sysctl.h>
 #include <sys/vmmeter.h>
 #include <uvm/uvm_extern.h>
 #include <uvm/uvm_param.h>
 
 static const unsigned long _glibtop_sysdeps_mem =
-(1L << GLIBTOP_MEM_TOTAL) + (1L << GLIBTOP_MEM_USED) +
-(1L << GLIBTOP_MEM_FREE) +
-(1L << GLIBTOP_MEM_SHARED) +
-(1L << GLIBTOP_MEM_BUFFER) +
-(1L << GLIBTOP_MEM_USER) + (1L << GLIBTOP_MEM_LOCKED);
+(1L << GLIBTOP_MEM_TOTAL)  + (1L << GLIBTOP_MEM_USED) +
+(1L << GLIBTOP_MEM_FREE)   + (1L << GLIBTOP_MEM_SHARED) +
+(1L << GLIBTOP_MEM_BUFFER) + (1L << GLIBTOP_MEM_CACHED) +
+(1L << GLIBTOP_MEM_USER)   + (1L << GLIBTOP_MEM_LOCKED);
 
 #ifndef LOG1024
 #define LOG1024		10
@@ -57,8 +57,9 @@ static struct nlist nlst [] = {
 };
 
 /* MIB array for sysctl */
-static int mib [] = { CTL_VM, VM_METER };
-static int mib_uvmexp [] = { CTL_VM, VM_UVMEXP };
+static int vmmeter_mib [] = { CTL_VM, VM_METER };
+static int uvmexp_mib  [] = { CTL_VM, VM_UVMEXP };
+static int bcstats_mib [] = { CTL_VFS, VFS_GENERIC, VFS_BCACHESTAT };
 
 /* Init function. */
 
@@ -90,12 +91,12 @@ void
 glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
 {
 	struct vmtotal vmt;
-	size_t length_vmt;
 	struct uvmexp uvmexp;
-	size_t length_uvmexp;
+	struct bcachestats bcstats;
 	u_int v_used_count;
 	u_int v_total_count;
 	u_int v_free_count;
+	size_t length;
 
 	glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_MEM), 0);
 
@@ -105,15 +106,24 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
 		return;
 
 	/* Get the data from sysctl */
-	length_vmt = sizeof (vmt);
-	if (sysctl (mib, 2, &vmt, &length_vmt, NULL, 0)) {
-		glibtop_warn_io_r (server, "sysctl (vm.meter)");
+	length = sizeof (vmt);
+	if (sysctl (vmmeter_mib, 2, &vmt, &length, NULL, 0)) {
+		glibtop_warn_io_r (server, "sysctl (vm.vmmeter)");
+		bzero(&vmt, sizeof(length));
 		return;
 	}
 
-	length_uvmexp = sizeof (uvmexp);
-	if (sysctl (mib_uvmexp, 2, &uvmexp, &length_uvmexp, NULL, 0)) {
-		glibtop_warn_io_r (server, "sysctl (uvmexp)");
+	length = sizeof (uvmexp);
+	if (sysctl (uvmexp_mib, 2, &uvmexp, &length, NULL, 0)) {
+		glibtop_warn_io_r (server, "sysctl (vm.uvmexp)");
+		bzero(&uvmexp, sizeof(length));
+		return;
+	}
+
+	length = sizeof (bcstats);
+	if (sysctl (bcstats_mib, 3, &bcstats, &length, NULL, 0)) {
+		glibtop_warn_io_r (server, "sysctl (vfs.generic.bcstats)");
+		bzero(&bcstats, sizeof(length));
 		return;
 	}
 
@@ -132,9 +142,10 @@ glibtop_get_mem_p (glibtop *server, glibtop_mem *buf)
 	buf->free  = (guint64) pagetok (v_free_count) << LOG1024;
 	buf->locked = (guint64) pagetok (uvmexp.wired) << LOG1024;
 	buf->shared = (guint64) pagetok (vmt.t_rmshr) << LOG1024;
+	buf->cached = (guint64) pagetok (bcstats.numbufpages) << LOG1024;
 	buf->buffer = 0;
 
-	buf->user = buf->total - buf->free - buf->shared - buf->buffer;
+	buf->user = buf->total - buf->free - buf->cached - buf->buffer;
 
 	/* Set the values to return */
 	buf->flags = _glibtop_sysdeps_mem;
diff --git a/sysdeps/openbsd/swap.c b/sysdeps/openbsd/swap.c
index 7f24365..4d46133 100644
--- a/sysdeps/openbsd/swap.c
+++ b/sysdeps/openbsd/swap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: swap.c,v 1.6 2011/05/25 10:44:34 jasper Exp $	*/
+/* $OpenBSD: swap.c,v 1.7 2011/07/10 15:23:01 jasper Exp $	*/
 
 /* Copyright (C) 1998-99 Martin Baulig
    This file is part of LibGTop 1.0.
@@ -79,7 +79,7 @@ glibtop_get_swap_p (glibtop *server, glibtop_swap *buf)
 
 	length_uvmexp = sizeof (uvmexp);
 	if (sysctl (mib_uvmexp, 2, &uvmexp, &length_uvmexp, NULL, 0)) {
-		glibtop_warn_io_r (server, "sysctl (uvmexp)");
+		glibtop_warn_io_r (server, "sysctl (vm.uvmexp)");
 		return;
 	}
 
