Skip to content

Commit 236bdb8

Browse files
unixbhaskarfbq
authored andcommitted
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 <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Boqun Feng <[email protected]>
1 parent 7c3a8b4 commit 236bdb8

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

tools/rcu/extract-stall.sh

100644100755
+20-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
#!/bin/sh
22
# SPDX-License-Identifier: GPL-2.0+
3-
#
4-
# Extract any RCU CPU stall warnings present in specified file.
5-
# Filter out clocksource lines. Note that preceding-lines excludes the
6-
# initial line of the stall warning but trailing-lines includes it.
7-
#
8-
# Usage: extract-stall.sh dmesg-file [ preceding-lines [ trailing-lines ] ]
3+
4+
usage() {
5+
echo Extract any RCU CPU stall warnings present in specified file.
6+
echo Filter out clocksource lines. Note that preceding-lines excludes the
7+
echo initial line of the stall warning but trailing-lines includes it.
8+
echo
9+
echo Usage: $(basename $0) dmesg-file [ preceding-lines [ trailing-lines ] ]
10+
echo
11+
echo Error: $1
12+
}
13+
14+
# Terminate the script, if the argument is missing
15+
16+
if test -f "$1" && test -r "$1"
17+
then
18+
:
19+
else
20+
usage "Console log file \"$1\" missing or unreadable."
21+
exit 1
22+
fi
923

1024
echo $1
1125
preceding_lines="${2-3}"

0 commit comments

Comments
 (0)