--- otp_src_R13A/lib/os_mon/src/memsup.erl.orig	2009-03-12 13:18:18 +0100
+++ otp_src_R13A/lib/os_mon/src/memsup.erl	2009-04-04 21:20:48 +0200
@@ -176,6 +176,7 @@
     PortMode = case OS of
 		   {unix, darwin} -> false;
 		   {unix, freebsd} -> false;
+		   {unix, dragonfly} -> false;
 		   % Linux supports this.
 		   {unix, linux} -> true;
 		   {unix, openbsd} -> true;
@@ -610,6 +611,7 @@
 	    PortMode = case OS of
 			   {unix, darwin} -> false;
 			   {unix, freebsd} -> false;
+			   {unix, dragonfly} -> false;
 			   {unix, linux} -> false;
 			   {unix, openbsd} -> true;
 			   {unix, sunos} -> true;
@@ -687,6 +689,7 @@
 get_os_wordsize({unix, darwin})  -> get_os_wordsize_with_uname();
 get_os_wordsize({unix, netbsd})  -> get_os_wordsize_with_uname();
 get_os_wordsize({unix, freebsd}) -> get_os_wordsize_with_uname();
+get_os_wordsize({unix, dragonfly}) -> get_os_wordsize_with_uname();
 get_os_wordsize({unix, openbsd}) -> get_os_wordsize_with_uname();
 get_os_wordsize(_)               -> unsupported_os.
 
@@ -743,6 +746,13 @@
     NMemUsed  = (PageCount - FreeCount) * PageSize,
     NMemTotal = PageCount * PageSize,
     {NMemUsed, NMemTotal};
+get_memory_usage({unix,dragonfly}) ->
+    PageSize  = freebsd_sysctl("vm.stats.vm.v_page_size"),
+    PageCount = freebsd_sysctl("vm.stats.vm.v_page_count"),
+    FreeCount = freebsd_sysctl("vm.stats.vm.v_free_count"),
+    NMemUsed  = (PageCount - FreeCount) * PageSize,
+    NMemTotal = PageCount * PageSize,
+    {NMemUsed, NMemTotal};
 
 %% Win32: Find out how much memory is in use by asking
 %% the os_mon_sysinfo process.
@@ -776,6 +786,9 @@
 	{unix, freebsd} ->
 	    [{total_memory, Total}, {free_memory, Total-Alloc},
 	     {system_total_memory, Total}];
+	{unix, dragonfly} ->
+	    [{total_memory, Total}, {free_memory, Total-Alloc},
+	     {system_total_memory, Total}];
 	{unix, darwin} ->
 	    [{total_memory, Total}, {free_memory, Total-Alloc},
 	     {system_total_memory, Total}];
