xref: /linux/tools/perf/trace/beauty/madvise_behavior.sh (revision 15a1fbdcfb519c2bd291ed01c6c94e0b89537a77)
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:]]*.*'
8egrep $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