summaryrefslogtreecommitdiff
path: root/tools/rcu
diff options
context:
space:
mode:
authorBhaskar Chowdhury <unixbhaskar@gmail.com>2023-01-10 16:46:34 +0530
committerBoqun Feng <boqun.feng@gmail.com>2023-03-11 18:10:17 -0800
commit236bdb881d9656194a2d9c78ee11dba39329a3b1 (patch)
tree53e09a22423dfcb65aff66d043fb0951bbe03072 /tools/rcu
parent7c3a8b48dc5452ec639293fd7796402d02213f58 (diff)
tools: rcu: Add usage function and check for argument
This commit converts extract-stall.sh script's header comment to a usage() function, and adds an argument check. While in the area, make this script be executable. [ paulmck: Strength argument check, remove extraneous comment. ] Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Diffstat (limited to 'tools/rcu')
-rwxr-xr-x[-rw-r--r--]tools/rcu/extract-stall.sh26
1 files changed, 20 insertions, 6 deletions
diff --git a/tools/rcu/extract-stall.sh b/tools/rcu/extract-stall.sh
index e565697c9f90..08a39ad44320 100644..100755
--- a/tools/rcu/extract-stall.sh
+++ b/tools/rcu/extract-stall.sh
@@ -1,11 +1,25 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0+
-#
-# Extract any RCU CPU stall warnings present in specified file.
-# Filter out clocksource lines. Note that preceding-lines excludes the
-# initial line of the stall warning but trailing-lines includes it.
-#
-# Usage: extract-stall.sh dmesg-file [ preceding-lines [ trailing-lines ] ]
+
+usage() {
+ echo Extract any RCU CPU stall warnings present in specified file.
+ echo Filter out clocksource lines. Note that preceding-lines excludes the
+ echo initial line of the stall warning but trailing-lines includes it.
+ echo
+ echo Usage: $(basename $0) dmesg-file [ preceding-lines [ trailing-lines ] ]
+ echo
+ echo Error: $1
+}
+
+# Terminate the script, if the argument is missing
+
+if test -f "$1" && test -r "$1"
+then
+ :
+else
+ usage "Console log file \"$1\" missing or unreadable."
+ exit 1
+fi
echo $1
preceding_lines="${2-3}"