Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit c9d9618

Browse files
committed
solaris: comments
1 parent 3a8ac8c commit c9d9618

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

pfetch

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ get_os() {
251251
;;
252252

253253
SunOS)
254+
# Grab the first line of the '/etc/release' file
255+
# discarding everything after '('.
254256
IFS='(' read -r distro _ < /etc/release
255257
;;
256258

@@ -377,6 +379,13 @@ get_uptime() {
377379
;;
378380

379381
SunOS)
382+
# Split the output of 'kstat' on '.' and any white-space
383+
# which exists in the command output.
384+
#
385+
# The output is as follows:
386+
# unix:0:system_misc:snaptime 14809.906993005
387+
#
388+
# The parser extracts: ^^^^^
380389
IFS=' .' read -r _ s _ <<-EOF
381390
$(kstat -p unix:0:system_misc:snaptime)
382391
EOF
@@ -637,15 +646,15 @@ get_memory() {
637646

638647
while read -r key val; do
639648
case $key in
640-
*total) pages_total=$val ;;
649+
*total) pages_full=$val ;;
641650
*free) pages_free=$val ;;
642651
esac
643652
done <<-EOF
644653
$(kstat -p unix:0:system_pages:pagestotal \
645654
unix:0:system_pages:pagesfree)
646655
EOF
647656

648-
mem_full=$((pages_total * hw_pagesize / 1024 / 1024))
657+
mem_full=$((pages_full * hw_pagesize / 1024 / 1024))
649658
mem_free=$((pages_free * hw_pagesize / 1024 / 1024))
650659
mem_used=$((mem_full - mem_free))
651660
;;

0 commit comments

Comments
 (0)