linux/linux-5.4.31/tools/perf/trace/beauty/socket_ipproto.sh

13 lines
370 B
Bash
Raw Normal View History

2024-01-30 10:43:28 +00:00
#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1
[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
printf "static const char *socket_ipproto[] = {\n"
regex='^[[:space:]]+IPPROTO_(\w+)[[:space:]]+=[[:space:]]+([[:digit:]]+),.*'
egrep $regex ${header_dir}/in.h | \
sed -r "s/$regex/\2 \1/g" | \
sort | xargs printf "\t[%s] = \"%s\",\n"
printf "};\n"