FreeBSD Bugzilla – Attachment 222952 Details for
Bug 253996
sysutils/byobu: Handle FreeBSD memory model correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch usr/lib/byobu/memory for FreeBSD memory handling
byobu-5.133_1.diff (text/plain), 3.58 KB, created by
Justin Coffman
on 2021-03-03 20:59:24 UTC
(
hide
)
Description:
Patch usr/lib/byobu/memory for FreeBSD memory handling
Filename:
MIME Type:
Creator:
Justin Coffman
Created:
2021-03-03 20:59:24 UTC
Size:
3.58 KB
patch
obsolete
>Index: sysutils/byobu/Makefile >=================================================================== >--- sysutils/byobu/Makefile (revision 567257) >+++ sysutils/byobu/Makefile (working copy) >@@ -3,6 +3,7 @@ > > PORTNAME= byobu > PORTVERSION= 5.133 >+PORTREVISION= 1 > CATEGORIES= sysutils > MASTER_SITES= http://launchpad.net/${PORTNAME}/trunk/${PORTVERSION}/+download/ > DISTNAME= ${PORTNAME}_${PORTVERSION}.orig >Index: sysutils/byobu/files/patch-usr_lib_byobu_memory >=================================================================== >--- sysutils/byobu/files/patch-usr_lib_byobu_memory (revision 567257) >+++ sysutils/byobu/files/patch-usr_lib_byobu_memory (working copy) >@@ -1,11 +1,71 @@ >---- usr/lib/byobu/memory.orig 2019-08-23 17:23:09 UTC >+--- usr/lib/byobu/memory.orig 2016-09-15 19:22:48 UTC > +++ usr/lib/byobu/memory >-@@ -52,7 +52,7 @@ __memory() { >- buffers_plus_cached=$(($buffers+$cached)) >- # "free output" buffers and cache (output from 'free') >- fo_buffers=$(($kb_main_used - $buffers_plus_cached)) >+@@ -26,16 +26,32 @@ __memory_detail() { >+ __memory() { >+ local free="" total="" buffers="" cached="" >+ local kb_main_used=0 buffers_plus_cached=0 fo_buffers=0 fo_cached=0 >+- if [ -r /proc/meminfo ]; then >+- while read tok val unit; do >+- case "$tok" in >+- MemTotal:) total=${val};; >+- MemFree:) free=${val};; >+- Buffers:) buffers=${val};; >+- Cached:) cached=${val};; >+- esac >+- [ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break; >+- done < /proc/meminfo >++ >++ if [ $(uname) = "Linux" ]; then >++ if [ -r /proc/meminfo ]; then >++ while read tok val unit; do >++ case "$tok" in >++ MemTotal:) total=${val};; >++ MemFree:) free=${val};; >++ Buffers:) buffers=${val};; >++ Cached:) cached=${val};; >++ esac >++ [ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break; >++ done < /proc/meminfo >++ fi >++ elif [ $(uname) = "FreeBSD" ]; then >++ # FreeBSD support >++ page_size=$(sysctl vm.stats.vm.v_page_size | awk '{print $2'}) >++ page_count=$(sysctl vm.stats.vm.v_page_count | awk '{print $2'}) >++ total=$((($page_count*$page_size)/1024)) >++ >++ cache_pages=$(sysctl vm.stats.vm.v_cache_count | awk '{print $2'}) >++ inact_pages=$(sysctl vm.stats.vm.v_inactive_count | awk '{print $2'}) >++ free_pages=$(sysctl vm.stats.vm.v_free_count | awk '{print $2'}) >++ free=$(((($cache_pages+$inact_pages+$free_pages)*$page_size)/1024)) >++ >++ buffers=0 >++ cached=0 >+ elif eval $BYOBU_TEST vm_stat >/dev/null 2>&1; then >+ # MacOS support >+ # calculation borrowed from http://apple.stackexchange.com/a/48195/18857 >+@@ -44,16 +60,18 @@ __memory() { >+ speculative_blocks=$(vm_stat | grep speculative | awk '{ print $3 }' | sed -e 's/\.//') >+ free=$((($free_blocks+speculative_blocks)*4)) >+ inactive=$(($inactive_blocks*4)) >+- total=$((($free+$inactive))) >++ total=$(($free+$inactive)) >+ buffers=0 >+ cached=0 >+ fi >+- kb_main_used=$(($total-$free)) >+- buffers_plus_cached=$(($buffers+$cached)) >+- # "free output" buffers and cache (output from 'free') >+- fo_buffers=$(($kb_main_used - $buffers_plus_cached)) > - fpdiv $((100*${fo_buffers})) "${total}" 0; >-+ fpdiv $((100*${kb_main_used})) "${total}" 0; >- usage=${_RET} >+- usage=${_RET} >++ >++ kb_main_used=$(($total-$free)) >++ buffers_plus_cached=$(($buffers+$cached)) >++ # "free output" buffers and cache (output from 'free') >++ fo_buffers=$(($kb_main_used - $buffers_plus_cached)) >++ fpdiv $((100*${fo_buffers})) "${total}" 0; >++ usage=${_RET} >++ > if [ $total -ge 1048576 ]; then > fpdiv "$total" 1048567 1 >+ total=${_RET}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 253996
:
222952
|
222958
|
223104