xref: /linux/tools/perf/trace/beauty/madvise_behavior.sh (revision 1a2ac6d7ecdcde74a4e16f31de64124160fc7237)
1#!/bin/sh
2# SPDX-License-Identifier: LGPL-2.1
3
4[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/asm-generic/
5
6printf "static const char *madvise_advices[] = {\n"
7regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MADV_([[:alnum:]_]+)[[:space:]]+([[:digit:]]+)[[:space:]]*.*'
8grep -E $regex ${header_dir}/mman-common.h | \
9	sed -r "s/$regex/\2 \1/g"	| \
10	sort -n | xargs printf "\t[%s] = \"%s\",\n"
11printf "};\n"
12