aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/include/libtest.shlib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/zfs-tests/include/libtest.shlib')
-rw-r--r--tests/zfs-tests/include/libtest.shlib18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib
index a641a0b7a..f917c5812 100644
--- a/tests/zfs-tests/include/libtest.shlib
+++ b/tests/zfs-tests/include/libtest.shlib
@@ -4056,13 +4056,19 @@ function ls_xattr # path
function get_arcstat # stat
{
- if is_linux; then
- typeset stat=$1
+ typeset stat=$1
+
+ case $(uname) in
+ FreeBSD)
+ sysctl -n kstat.zfs.misc.arcstats.$stat
+ ;;
+ Linux)
typeset zfs_arcstats="/proc/spl/kstat/zfs/arcstats"
[[ -f "$zfs_arcstats" ]] || return 1
grep $stat $zfs_arcstats | awk '{print $3}'
- return $?
- else
- return 1
- fi
+ ;;
+ *)
+ false
+ ;;
+ esac
}