View | Details | Raw Unified | Return to bug 202367 | Differences between
and this patch

Collapse All | Expand All

(-)./usr/lib/byobu/uptime (-2 / +2 lines)
Lines 27-34 Link Here
27
27
28
__uptime() {
28
__uptime() {
29
	local u= idle= str=
29
	local u= idle= str=
30
	if [ -r /proc/uptime ]; then
30
	if [ -r /compat/linux/proc/uptime ]; then
31
		read u idle < /proc/uptime
31
		read u idle < /compat/linux/proc/uptime
32
		u=${u%.*}
32
		u=${u%.*}
33
		if [ "$u" -gt 86400 ]; then
33
		if [ "$u" -gt 86400 ]; then
34
			str="$(($u / 86400))d$((($u % 86400) / 3600))h"
34
			str="$(($u / 86400))d$((($u % 86400) / 3600))h"
(-)./usr/lib/byobu/load_average (-3 / +3 lines)
Lines 20-31 Link Here
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
21
22
__load_average_detail() {
22
__load_average_detail() {
23
	cat /proc/loadavg
23
	cat /compat/linux/proc/loadavg
24
}
24
}
25
25
26
__load_average() {
26
__load_average() {
27
	if [ -r "/proc/loadavg" ]; then
27
	if [ -r "/compat/linux/proc/loadavg" ]; then
28
		read one five fifteen other < /proc/loadavg
28
		read one five fifteen other < /compat/linux/proc/loadavg
29
	else
29
	else
30
		one=$(uptime | sed -e "s/.*://" | awk '{print $1}')
30
		one=$(uptime | sed -e "s/.*://" | awk '{print $1}')
31
	fi
31
	fi
(-)./usr/lib/byobu/swap (-2 / +2 lines)
Lines 20-26 Link Here
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
21
22
__swap_detail() {
22
__swap_detail() {
23
	cat /proc/meminfo
23
	cat /compat/linux/proc/meminfo
24
}
24
}
25
25
26
__swap() {
26
__swap() {
Lines 34-40 Link Here
34
			continue
34
			continue
35
		fi
35
		fi
36
		[ -n "$stotal" -a -n "$sfree" ] && break;
36
		[ -n "$stotal" -a -n "$sfree" ] && break;
37
	done < /proc/meminfo
37
	done < /compat/linux/proc/meminfo
38
	[ "${stotal:-0}" = "0" ] && return 0
38
	[ "${stotal:-0}" = "0" ] && return 0
39
	mem=${stotal}
39
	mem=${stotal}
40
	f=$(((100*($stotal-$sfree))/$stotal))
40
	f=$(((100*($stotal-$sfree))/$stotal))
(-)./usr/lib/byobu/cpu_freq (-6 / +6 lines)
Lines 20-26 Link Here
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
21
22
__cpu_freq_detail() {
22
__cpu_freq_detail() {
23
	cat /proc/cpuinfo
23
	cat /compat/linux/proc/cpuinfo
24
}
24
}
25
25
26
__cpu_freq() {
26
__cpu_freq() {
Lines 29-41 Link Here
29
		read hz < /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
29
		read hz < /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
30
		fpdiv $hz "1000000" 1 # 1Ghz
30
		fpdiv $hz "1000000" 1 # 1Ghz
31
		freq="$_RET"
31
		freq="$_RET"
32
	elif [ -r "/proc/cpuinfo" ]; then
32
	elif [ -r "/compat/linux/proc/cpuinfo" ]; then
33
		if egrep -q -s -i -m 1 "^cpu MHz|^clock" /proc/cpuinfo; then
33
		if egrep -q -s -i -m 1 "^cpu MHz|^clock" /compat/linux/proc/cpuinfo; then
34
			freq=$(egrep -i -m 1 "^cpu MHz|^clock" /proc/cpuinfo | awk -F"[:.]" '{ printf "%01.1f", $2 / 1000 }')
34
			freq=$(egrep -i -m 1 "^cpu MHz|^clock" /compat/linux/proc/cpuinfo | awk -F"[:.]" '{ printf "%01.1f", $2 / 1000 }')
35
		else
35
		else
36
			# Must scale frequency by number of processors, if counting bogomips
36
			# Must scale frequency by number of processors, if counting bogomips
37
			count=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
37
			count=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /compat/linux/proc/cpuinfo)
38
			freq=$(egrep -i -m 1 "^bogomips" /proc/cpuinfo | awk -F"[:.]" '{ print $2 }')
38
			freq=$(egrep -i -m 1 "^bogomips" /compat/linux/proc/cpuinfo | awk -F"[:.]" '{ print $2 }')
39
			freq=$(printf "%s %s" "$freq" "$count" | awk '{printf "%01.1f\n", $1/$2/1000}')
39
			freq=$(printf "%s %s" "$freq" "$count" | awk '{printf "%01.1f\n", $1/$2/1000}')
40
		fi
40
		fi
41
	elif hz=$(sysctl -n hw.cpufrequency 2>/dev/null); then
41
	elif hz=$(sysctl -n hw.cpufrequency 2>/dev/null); then
(-)./usr/lib/byobu/cpu_temp (-2 / +2 lines)
Lines 21-27 Link Here
21
21
22
__cpu_temp_detail() {
22
__cpu_temp_detail() {
23
	local i
23
	local i
24
	for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal /proc/acpi/thermal_zone/*/temperature; do
24
	for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /compat/linux/proc/acpi/ibm/thermal /compat/linux/proc/acpi/thermal_zone/*/temperature; do
25
		[ -r "$i" ] || continue
25
		[ -r "$i" ] || continue
26
		printf "%s\n" "$i:"
26
		printf "%s\n" "$i:"
27
		cat "$i"/*
27
		cat "$i"/*
Lines 30-36 Link Here
30
30
31
__cpu_temp() {
31
__cpu_temp() {
32
	local i t unit
32
	local i t unit
33
	for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /proc/acpi/ibm/thermal /proc/acpi/thermal_zone/*/temperature; do
33
	for i in $MONITORED_TEMP /sys/class/hwmon/hwmon*/device/temp*_input /sys/class/hwmon/hwmon*/temp*_input /compat/linux/proc/acpi/ibm/thermal /compat/linux/proc/acpi/thermal_zone/*/temperature; do
34
		case "$i" in
34
		case "$i" in
35
			*temp*_input)
35
			*temp*_input)
36
				[ -s "$i" ] && read t < "$i" && t=$(($t/1000))
36
				[ -s "$i" ] && read t < "$i" && t=$(($t/1000))
(-)./usr/lib/byobu/ec2_cost (-3 / +3 lines)
Lines 56-63 Link Here
56
	file_to_stat="/etc/hostname"
56
	file_to_stat="/etc/hostname"
57
	hours=$(((`date +%s` - `stat --printf %Y $file_to_stat`) / 60 / 60 + 1))
57
	hours=$(((`date +%s` - `stat --printf %Y $file_to_stat`) / 60 / 60 + 1))
58
	# Auto detect network interface
58
	# Auto detect network interface
59
	[ -r "/proc/net/route" ] || return
59
	[ -r "/compat/linux/proc/net/route" ] || return
60
	interface=$(tail -n1 /proc/net/route  | awk '{print $1}')
60
	interface=$(tail -n1 /compat/linux/proc/net/route  | awk '{print $1}')
61
	local iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed
61
	local iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed
62
	while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do
62
	while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do
63
		case "$iface" in
63
		case "$iface" in
Lines 78-84 Link Here
78
			rx_gb=${rbytes}
78
			rx_gb=${rbytes}
79
			break
79
			break
80
		fi
80
		fi
81
	done < /proc/net/dev
81
	done < /compat/linux/proc/net/dev
82
	tx_gb=$(printf "%s" ${tx_gb} | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }')
82
	tx_gb=$(printf "%s" ${tx_gb} | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }')
83
	rx_gb=$(printf "%s" ${rx_gb} | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }')
83
	rx_gb=$(printf "%s" ${rx_gb} | awk '{ printf "%f", $1 / 1024 / 1024 / 1024 }')
84
	network_cost=`printf "%s %s %s %s" "$tx_gb" "$TX_RATE" "$rx_gb" "$RX_RATE" | awk '{printf "%f %f", $1*$2, $3*$4}' | awk '{printf "%f", $1 + $2}'`
84
	network_cost=`printf "%s %s %s %s" "$tx_gb" "$TX_RATE" "$rx_gb" "$RX_RATE" | awk '{printf "%f %f", $1*$2, $3*$4}' | awk '{printf "%f", $1 + $2}'`
(-)./usr/lib/byobu/processes (-1 / +1 lines)
Lines 26-32 Link Here
26
__processes() {
26
__processes() {
27
	local count=
27
	local count=
28
	if [ -r /proc ]; then
28
	if [ -r /proc ]; then
29
		count=$(ls -d /proc/[0-9]* 2>/dev/null| wc -l)
29
		count=$(ls -d /compat/linux/proc/[0-9]* 2>/dev/null| wc -l)
30
	else
30
	else
31
		count=$(ps -ef | wc -l | awk '{print $1}')
31
		count=$(ps -ef | wc -l | awk '{print $1}')
32
	fi
32
	fi
(-)./usr/lib/byobu/network (-1 / +1 lines)
Lines 41-47 Link Here
41
		cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/network.$i"
41
		cache="$BYOBU_RUN_DIR/cache.$BYOBU_BACKEND/network.$i"
42
		[ -r "$cache" ] && read x1 < "$cache" || tx1=0
42
		[ -r "$cache" ] && read x1 < "$cache" || tx1=0
43
		local iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed
43
		local iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed
44
		cat /proc/net/dev > "$cache".dev
44
		cat /compat/linux/proc/net/dev > "$cache".dev
45
		while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do
45
		while read iface rbytes rpackets rerrs rdrop rfifo rframe rcompressed rmulticast tbytes tpackets terrs tdrop tfifo tcolls tcarrier tcompressed; do
46
			case "$iface" in
46
			case "$iface" in
47
				${interface}:)
47
				${interface}:)
(-)./usr/lib/byobu/ip_address (-1 / +1 lines)
Lines 34-40 Link Here
34
		interface="$MONITORED_NETWORK"
34
		interface="$MONITORED_NETWORK"
35
	else
35
	else
36
		case "$IPV6" in
36
		case "$IPV6" in
37
			1|true|yes) interface=$(awk '$10 != "lo" { iface=$10 ; }; END { print iface; }' /proc/net/ipv6_route);;
37
			1|true|yes) interface=$(awk '$10 != "lo" { iface=$10 ; }; END { print iface; }' /compat/linux/proc/net/ipv6_route);;
38
			*) get_network_interface; interface="$_RET";;
38
			*) get_network_interface; interface="$_RET";;
39
		esac
39
		esac
40
	fi
40
	fi
(-)./usr/lib/byobu/raid (-2 / +2 lines)
Lines 20-26 Link Here
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
21
22
__raid_detail() {
22
__raid_detail() {
23
	[ -r /proc/mdstat ] && cat /proc/mdstat || true
23
	[ -r /compat/linux/proc/mdstat ] && cat /compat/linux/proc/mdstat || true
24
}
24
}
25
25
26
__raid() {
26
__raid() {
Lines 37-43 Link Here
37
				msg="$msg,$p"
37
				msg="$msg,$p"
38
			;;
38
			;;
39
		esac
39
		esac
40
	done < /proc/mdstat
40
	done < /compat/linux/proc/mdstat
41
	if [ -n "$msg" ]; then
41
	if [ -n "$msg" ]; then
42
		color B w r; printf "%s" "$msg"; color --
42
		color B w r; printf "%s" "$msg"; color --
43
	elif [ -e "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/raid" ]; then
43
	elif [ -e "$BYOBU_RUN_DIR/status.$BYOBU_BACKEND/raid" ]; then
(-)./usr/lib/byobu/rcs_cost (-3 / +3 lines)
Lines 40-46 Link Here
40
	# 15872MB       $0.960/h
40
	# 15872MB       $0.960/h
41
41
42
	# Instance memory
42
	# Instance memory
43
	memory=`grep "^MemTotal:" /proc/meminfo | awk '{print $2}'`
43
	memory=`grep "^MemTotal:" /compat/linux/proc/meminfo | awk '{print $2}'`
44
44
45
	# Round memory down to the nearest multiple of 64MB
45
	# Round memory down to the nearest multiple of 64MB
46
	memory=$((${memory} - (${memory} % (64 * 1024))))
46
	memory=$((${memory} - (${memory} % (64 * 1024))))
Lines 59-66 Link Here
59
	TX_RATE="0.22"
59
	TX_RATE="0.22"
60
60
61
	# Auto detect network interface
61
	# Auto detect network interface
62
	[ -r "/proc/net/route" ] || return
62
	[ -r "/compat/linux/proc/net/route" ] || return
63
	IF=$(tail -n1 /proc/net/route  | awk '{print $1}')
63
	IF=$(tail -n1 /compat/linux/proc/net/route  | awk '{print $1}')
64
64
65
	ifconfig_out=`LC_ALL=C /sbin/ifconfig "$IF"`
65
	ifconfig_out=`LC_ALL=C /sbin/ifconfig "$IF"`
66
66
(-)./usr/lib/byobu/memory (-2 / +2 lines)
Lines 26-32 Link Here
26
__memory() {
26
__memory() {
27
	local free="" total="" buffers="" cached=""
27
	local free="" total="" buffers="" cached=""
28
	local kb_main_used=0 buffers_plus_cached=0 fo_buffers=0 fo_cached=0
28
	local kb_main_used=0 buffers_plus_cached=0 fo_buffers=0 fo_cached=0
29
	if [ -r /proc/meminfo ]; then
29
	if [ -r /compat/linux/proc/meminfo ]; then
30
		while read tok val unit; do
30
		while read tok val unit; do
31
			case "$tok" in
31
			case "$tok" in
32
				MemTotal:) total=${val};;
32
				MemTotal:) total=${val};;
Lines 35-41 Link Here
35
				Cached:) cached=${val};;
35
				Cached:) cached=${val};;
36
			esac
36
			esac
37
			[ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
37
			[ -n "${free}" -a -n "${total}" -a -n "${buffers}" -a -n "${cached}" ] && break;
38
		done < /proc/meminfo
38
		done < /compat/linux/proc/meminfo
39
	elif $BYOBU_TEST vm_stat >/dev/null 2>&1; then
39
	elif $BYOBU_TEST vm_stat >/dev/null 2>&1; then
40
		# MacOS support
40
		# MacOS support
41
		# calculation borrowed from http://apple.stackexchange.com/a/48195/18857
41
		# calculation borrowed from http://apple.stackexchange.com/a/48195/18857
(-)./usr/lib/byobu/battery (-3 / +3 lines)
Lines 22-28 Link Here
22
22
23
__battery_detail() {
23
__battery_detail() {
24
	local bat
24
	local bat
25
	for bat in /proc/acpi/battery/*; do
25
	for bat in /compat/linux/proc/acpi/battery/*; do
26
		cat "$bat/info"
26
		cat "$bat/info"
27
		cat "$bat/state"
27
		cat "$bat/state"
28
	done
28
	done
Lines 32-38 Link Here
32
__battery() {
32
__battery() {
33
	local bat line present sign state percent full rem color bcolor
33
	local bat line present sign state percent full rem color bcolor
34
	# Linux support
34
	# Linux support
35
	for bat in $BATTERY /sys/class/power_supply/* /proc/acpi/battery/*; do
35
	for bat in $BATTERY /sys/class/power_supply/* /compat/linux/proc/acpi/battery/*; do
36
		present=""; full=""; rem=""; state=""
36
		present=""; full=""; rem=""; state=""
37
		case "$bat" in
37
		case "$bat" in
38
			/sys/*)
38
			/sys/*)
Lines 50-56 Link Here
50
					[ "$present" = "1" ] && [ -n "$full" ] && [ -n "$rem" ] && [ -n "$state" ] && break
50
					[ "$present" = "1" ] && [ -n "$full" ] && [ -n "$rem" ] && [ -n "$state" ] && break
51
				fi
51
				fi
52
			;;
52
			;;
53
			/proc/*)
53
			/compat/linux/proc/*)
54
				[ -f "$bat/info" ] || continue
54
				[ -f "$bat/info" ] || continue
55
				while read line; do
55
				while read line; do
56
					set -- ${line}
56
					set -- ${line}
(-)./usr/lib/byobu/cpu_count (-2 / +2 lines)
Lines 20-31 Link Here
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
21
22
__cpu_count_detail() {
22
__cpu_count_detail() {
23
	grep -i "^model name" /proc/cpuinfo
23
	grep -i "^model name" /compat/linux/proc/cpuinfo
24
}
24
}
25
25
26
__cpu_count() {
26
__cpu_count() {
27
	local c
27
	local c
28
	c=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /proc/cpuinfo)
28
	c=$(getconf _NPROCESSORS_ONLN 2>/dev/null || grep -ci "^processor" /compat/linux/proc/cpuinfo)
29
	[ "$c" = "1" ] || printf "%sx" "$c"
29
	[ "$c" = "1" ] || printf "%sx" "$c"
30
}
30
}
31
31
(-)./usr/lib/byobu/entropy (-3 / +3 lines)
Lines 19-30 Link Here
19
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
20
21
__entropy_detail() {
21
__entropy_detail() {
22
	cat /proc/sys/kernel/random/entropy_avail 2>/dev/null
22
	cat /compat/linux/proc/sys/kernel/random/entropy_avail 2>/dev/null
23
}
23
}
24
24
25
__entropy() {
25
__entropy() {
26
	if [ -r /proc/sys/kernel/random/entropy_avail ]; then
26
	if [ -r /compat/linux/proc/sys/kernel/random/entropy_avail ]; then
27
		local e=$(cat /proc/sys/kernel/random/entropy_avail)
27
		local e=$(cat /compat/linux/proc/sys/kernel/random/entropy_avail)
28
		[ -n "$e" ] || return
28
		[ -n "$e" ] || return
29
		color K Y; printf "e%s" "$e"; color --
29
		color K Y; printf "e%s" "$e"; color --
30
	fi
30
	fi
(-)./usr/lib/byobu/disk (-1 / +1 lines)
Lines 28-34 Link Here
28
	# Default to /, but let users override
28
	# Default to /, but let users override
29
	[ -z "$MONITORED_DISK" ] && MP="/" || MP="$MONITORED_DISK"
29
	[ -z "$MONITORED_DISK" ] && MP="/" || MP="$MONITORED_DISK"
30
	case $MP in
30
	case $MP in
31
		/dev/*) MP=$(awk '$1 == m { print $2; exit(0); }' "m=$MP" /proc/mounts);;
31
		/dev/*) MP=$(awk '$1 == m { print $2; exit(0); }' "m=$MP" /compat/linux/proc/mounts);;
32
	esac
32
	esac
33
	# this could be done faster with 'stat --file-system --format'
33
	# this could be done faster with 'stat --file-system --format'
34
	# but then we'd have to do blocks -> human units ourselves
34
	# but then we'd have to do blocks -> human units ourselves
(-)./usr/lib/byobu/fan_speed (-2 / +2 lines)
Lines 38-46 Link Here
38
	done
38
	done
39
39
40
	# But others (e.g. Dell Inspirons) seem to be here:
40
	# But others (e.g. Dell Inspirons) seem to be here:
41
	if [ -r /proc/i8k ]; then
41
	if [ -r /compat/linux/proc/i8k ]; then
42
		local line=""
42
		local line=""
43
		read line < /proc/i8k
43
		read line < /compat/linux/proc/i8k
44
		set -- $line
44
		set -- $line
45
		for speed in $7 $8; do
45
		for speed in $7 $8; do
46
			if [ -n "$speed" ] && [ "$speed" -gt 0 ]; then
46
			if [ -n "$speed" ] && [ "$speed" -gt 0 ]; then

Return to bug 202367