diff options
| author | Dylan Araps <dylan.araps@gmail.com> | 2019-09-25 10:48:38 +0300 |
|---|---|---|
| committer | Dylan Araps <dylan.araps@gmail.com> | 2019-09-25 10:48:38 +0300 |
| commit | b744122e0dc69fb618f8afae8e6f66337102990f (patch) | |
| tree | ec3b8d0531b7c0b4e9a280a38f7da0b999101fe2 | |
| parent | 676db1bc586b38a7e8d4e0ec6792495041635faf (diff) | |
| download | pfetch-b744122e0dc69fb618f8afae8e6f66337102990f.tar.gz | |
netbsd: memory detection
| -rwxr-xr-x | pfetch | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -394,6 +394,23 @@ get_memory() { # the used memory amount, I'll be able to add support here. 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 log memory "${mem_used:-?}MiB / ${mem_full:-?}MiB" >&6 |
