Skip to content

Commit 6169322

Browse files
committed
perf beauty mmap_flags: Conditionaly define the mmap flags
So that in older systems we get it in the mmap flags scnprintf routines: $ tools/perf/trace/beauty/mmap_flags.sh | head -9 2> /dev/null static const char *mmap_flags[] = { [ilog2(0x40) + 1] = "32BIT", #ifndef MAP_32BIT #define MAP_32BIT 0x40 #endif [ilog2(0x01) + 1] = "SHARED", #ifndef MAP_SHARED #define MAP_SHARED 0x01 #endif $ Cc: Adrian Hunter <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 9012e3d commit 6169322

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tools/perf/trace/beauty/mmap_flags.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ printf "static const char *mmap_flags[] = {\n"
2121
regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MAP_([[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
2222
egrep -q $regex ${arch_mman} && \
2323
(egrep $regex ${arch_mman} | \
24-
sed -r "s/$regex/\2 \1/g" | \
25-
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n")
24+
sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \
25+
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n")
2626
egrep -q $regex ${linux_mman} && \
2727
(egrep $regex ${linux_mman} | \
2828
egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
29-
sed -r "s/$regex/\2 \1/g" | \
30-
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n")
29+
sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \
30+
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n")
3131
([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.*' ${arch_mman}) &&
3232
(egrep $regex ${header_dir}/mman-common.h | \
3333
egrep -vw 'MAP_(UNINITIALIZED|TYPE|SHARED_VALIDATE)' | \
34-
sed -r "s/$regex/\2 \1/g" | \
35-
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n")
34+
sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \
35+
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n")
3636
([ ! -f ${arch_mman} ] || egrep -q '#[[:space:]]*include[[:space:]]+<uapi/asm-generic/mman.h>.*' ${arch_mman}) &&
3737
(egrep $regex ${header_dir}/mman.h | \
38-
sed -r "s/$regex/\2 \1/g" | \
39-
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n")
38+
sed -r "s/$regex/\2 \1 \1 \1 \2/g" | \
39+
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n#ifndef MAP_%s\n#define MAP_%s %s\n#endif\n")
4040
printf "};\n"

0 commit comments

Comments
 (0)