From 7dd218760b766b45ae3b70bd3d128c333deb3d50 Mon Sep 17 00:00:00 2001 From: Krzysztof Gibas Date: Fri, 21 Dec 2012 12:51:28 +0100 Subject: [PATCH 1/3] fix memory detection on FreeBSD --- mysqltuner.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index f61881c..00f08a5 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -219,14 +219,14 @@ sub os_setup { } elsif ($os =~ /Darwin/) { $physical_memory = `sysctl -n hw.memsize` or memerror; $swap_memory = `sysctl -n vm.swapusage | awk '{print \$3}' | sed 's/\..*\$//'` or memerror; - } elsif ($os =~ /NetBSD|OpenBSD/) { + } elsif ($os =~ /NetBSD|OpenBSD|FreeBSD/) { $physical_memory = `sysctl -n hw.physmem` or memerror; if ($physical_memory < 0) { $physical_memory = `sysctl -n hw.physmem64` or memerror; } $swap_memory = `swapctl -l | grep '^/' | awk '{ s+= \$2 } END { print s }'` or memerror; } elsif ($os =~ /BSD/) { - $physical_memory = `sysctl -n hw.realmem`; + $physical_memory = `sysctl -n hw.realmem` or memerror; $swap_memory = `swapinfo | grep '^/' | awk '{ s+= \$2 } END { print s }'`; } elsif ($os =~ /SunOS/) { $physical_memory = `/usr/sbin/prtconf | grep Memory | cut -f 3 -d ' '` or memerror; From 409884e597ce7dee5b5fc738fe6e0a70f06d2102 Mon Sep 17 00:00:00 2001 From: Krzysztof Gibas Date: Fri, 21 Dec 2012 13:11:38 +0100 Subject: [PATCH 2/3] fix finding a 64bit architecture on FreeBSD --- mysqltuner.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysqltuner.pl b/mysqltuner.pl index 00f08a5..df3dde7 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -473,6 +473,9 @@ sub check_architecture { } elsif (`uname` =~ /AIX/ && `bootinfo -K` =~ /64/) { $arch = 64; goodprint "Operating on 64-bit architecture\n"; + } elsif (`uname` =~ /FreeBSD/ && `sysctl -b hw.machine_arch` =~ /64/) { + $arch = 64; + goodprint "Operating on 64-bit architecture\n"; } else { $arch = 32; if ($physical_memory > 2147483648) { From 1188149f32c02a8774b3b6fa00edfd2f5f197b63 Mon Sep 17 00:00:00 2001 From: Krzysztof Gibas Date: Fri, 21 Dec 2012 13:39:36 +0100 Subject: [PATCH 3/3] fixed finding a 64bit architecture on NetBSD/OpenBSD and FreeBSD --- mysqltuner.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysqltuner.pl b/mysqltuner.pl index df3dde7..9414ee6 100755 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -473,6 +473,9 @@ sub check_architecture { } elsif (`uname` =~ /AIX/ && `bootinfo -K` =~ /64/) { $arch = 64; goodprint "Operating on 64-bit architecture\n"; + } elsif (`uname` =~ /NetBSD|OpenBSD/ && `sysctl -b hw.machine` =~ /64/) { + $arch = 64; + goodprint "Operating on 64-bit architecture\n"; } elsif (`uname` =~ /FreeBSD/ && `sysctl -b hw.machine_arch` =~ /64/) { $arch = 64; goodprint "Operating on 64-bit architecture\n";