2 # Use vfs_getname probe to get syscall args filenames
4 # Uses the 'perf test shell' library to add probe:vfs_getname to the system
5 # then use it with 'perf record' using 'touch' to write to a temp file, then
6 # checks that that was captured by the vfs_getname probe in the generated
7 # perf.data file, with the temp file name as the pathname argument.
9 # SPDX-License-Identifier: GPL-2.0
10 # Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
12 . $(dirname $0)/lib/probe.sh
14 skip_if_no_perf_probe || exit 2
16 . $(dirname $0)/lib/probe_vfs_getname.sh
18 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
19 file=$(mktemp /tmp/temporary_file.XXXXX)
22 echo "Recording open file:"
23 perf record -o ${perfdata} -e probe:vfs_getname\* touch $file
26 perf_script_filenames() {
27 echo "Looking at perf.data file for vfs_getname records for the file we touched:"
28 perf script -i ${perfdata} | \
29 egrep " +touch +[0-9]+ +\[[0-9]+\] +[0-9]+\.[0-9]+: +probe:vfs_getname[_0-9]*: +\([[:xdigit:]]+\) +pathname=\"${file}\""
32 add_probe_vfs_getname || skip_if_no_debuginfo
34 if [ $err -ne 0 ] ; then
38 record_open_file && perf_script_filenames
42 cleanup_probe_vfs_getname