netbsd: memory detection
This commit is contained in:
parent
676db1bc58
commit
b744122e0d
17
pfetch
17
pfetch
|
@ -394,6 +394,23 @@ get_memory() {
|
||||||
# the used memory amount, I'll be able to add support here.
|
# the used memory amount, I'll be able to add support here.
|
||||||
mem_full=$(($(sysctl -n hw.physmem) / 1024 / 1024))
|
mem_full=$(($(sysctl -n hw.physmem) / 1024 / 1024))
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
NetBSD*)
|
||||||
|
mem_full=$(($(sysctl -n hw.physmem64) / 1024 / 1024))
|
||||||
|
|
||||||
|
# NetBSD implements a lot of the Linux '/proc' filesystem,
|
||||||
|
# this uses the same parser as the Linux memory detection.
|
||||||
|
while IFS=:k read -r key val _; do
|
||||||
|
case $key in
|
||||||
|
MemFree)
|
||||||
|
mem_free=$((val / 1024))
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done < /proc/meminfo
|
||||||
|
|
||||||
|
mem_used=$((mem_full - mem_free))
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
log memory "${mem_used:-?}MiB / ${mem_full:-?}MiB" >&6
|
log memory "${mem_used:-?}MiB / ${mem_full:-?}MiB" >&6
|
||||||
|
|
Loading…
Reference in New Issue
Block a user