aboutsummaryrefslogtreecommitdiffstats
path: root/lib/os_mon/src
diff options
context:
space:
mode:
authorAndrew Thompson <[email protected]>2011-04-01 00:34:21 -0400
committerAndrew Thompson <[email protected]>2011-04-01 00:34:21 -0400
commit6d1cfbcd7a782cc96f58b86372d108b50c14cc05 (patch)
tree3c27265a61b9f6276ddf89da905584093f0549d2 /lib/os_mon/src
parent07307ef070010af9a2ba1d3fb0eeb969f5a9e847 (diff)
downloadotp-6d1cfbcd7a782cc96f58b86372d108b50c14cc05.tar.gz
otp-6d1cfbcd7a782cc96f58b86372d108b50c14cc05.tar.bz2
otp-6d1cfbcd7a782cc96f58b86372d108b50c14cc05.zip
Add support for DragonFlyBSD to memsup
DragonFly was partially supported by os_mon already but when trying to start the os_mon application it'd crash with an error about an unknown operating system in memsup. This patch changes memsup to use the FreeBSD sysctl method to get memory information when on DragonFly.
Diffstat (limited to 'lib/os_mon/src')
-rw-r--r--lib/os_mon/src/memsup.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/os_mon/src/memsup.erl b/lib/os_mon/src/memsup.erl
index 822e1f939c..6c677fae8e 100644
--- a/lib/os_mon/src/memsup.erl
+++ b/lib/os_mon/src/memsup.erl
@@ -176,6 +176,7 @@ init([]) ->
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 @@ code_change(Vsn, PrevState, "1.8") ->
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, linux}) -> get_os_wordsize_with_uname();
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.
@@ -736,7 +739,7 @@ get_memory_usage({unix,darwin}) ->
%% FreeBSD: Look in /usr/include/sys/vmmeter.h for the format of struct
%% vmmeter
-get_memory_usage({unix,freebsd}) ->
+get_memory_usage({unix,OSname}) when OSname == freebsd; OSname == 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"),
@@ -779,6 +782,9 @@ get_ext_memory_usage(OS, {Alloc, Total}) ->
{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}];