From 83c1312b22f651b6f56a6778990109471c7d3f0a Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Fri, 26 Aug 2016 16:12:23 +0100 Subject: [PATCH] shutils: ensure we use "cat" version provided by Busybox Signed-off-by: Patrick Bellasi --- devlib/bin/scripts/shutils.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/devlib/bin/scripts/shutils.in b/devlib/bin/scripts/shutils.in index 7e8bdb8..849f6b4 100755 --- a/devlib/bin/scripts/shutils.in +++ b/devlib/bin/scripts/shutils.in @@ -7,6 +7,7 @@ BUSYBOX=${BUSYBOX:-__DEVLIB_BUSYBOX__} FIND=${FIND:-$BUSYBOX find} GREP=${GREP:-$BUSYBOX grep} SED=${SED:-$BUSYBOX sed} +CAT=${CAT:-$BUSYBOX cat} ################################################################################ # CPUFrequency Utility Functions @@ -37,7 +38,7 @@ cpufreq_get_all_governors() { } cpufreq_trace_all_frequencies() { - FREQS=$(cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq) + FREQS=$($CAT /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq) CPU=0; for F in $FREQS; do echo "cpu_frequency: state=$F cpu_id=$CPU" > /sys/kernel/debug/tracing/trace_marker CPU=$((CPU + 1)) @@ -51,7 +52,7 @@ cpufreq_trace_all_frequencies() { ftrace_get_function_stats() { for CPU in $(ls /sys/kernel/debug/tracing/trace_stat | sed 's/function//'); do REPLACE_STRING="s/ Function/\n Function (CPU$CPU)/" - cat /sys/kernel/debug/tracing/trace_stat/function$CPU \ + $CAT /sys/kernel/debug/tracing/trace_stat/function$CPU \ | sed "$REPLACE_STRING" done } @@ -135,7 +136,7 @@ cgroups_tasks_move() { DST_GRP=${2} GREP_EXCLUSE=${3:-''} - cat $SRC_GRP/tasks | while read TID; do + $CAT $SRC_GRP/tasks | while read TID; do echo $TID > $DST_GRP/cgroup.procs done @@ -145,7 +146,7 @@ cgroups_tasks_move() { PIDS=`echo $PIDS` echo "PIDs to save: [$PIDS]" for TID in $PIDS; do - CMDLINE=`cat /proc/$TID/cmdline` + CMDLINE=`$CAT /proc/$TID/cmdline` echo "$TID : $CMDLINE" echo $TID > $SRC_GRP/cgroup.procs done