Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf beauty socket: Add generator for socket level (SOL_*) string table

$ tools/perf/trace/beauty/socket.sh
static const char *socket_ipproto[] = {
[0] = "IP",
[1] = "ICMP",
<SNIP>
[255] = "RAW",
[262] = "MPTCP",
};

static const char *socket_level[] = {
[0] = "IP",
[6] = "TCP",
[17] = "UDP",
[41] = "IPV6",
[58] = "ICMPV6",
[132] = "SCTP",
[136] = "UDPLITE",
[255] = "RAW",
[256] = "IPX",
[257] = "AX25",
[258] = "ATALK",
[259] = "NETROM",
[260] = "ROSE",
[261] = "DECNET",
[262] = "X25",
[263] = "PACKET",
[264] = "ATM",
[265] = "AAL",
[266] = "IRDA",
[267] = "NETBEUI",
[268] = "LLC",
[269] = "DCCP",
[270] = "NETLINK",
[271] = "TIPC",
[272] = "RXRPC",
[273] = "PPPOL2TP",
[274] = "BLUETOOTH",
[275] = "PNPIPE",
[276] = "RDS",
[277] = "IUCV",
[278] = "CAIF",
[279] = "ALG",
[280] = "NFC",
[281] = "KCM",
[282] = "TLS",
[283] = "XDP",
[284] = "MPTCP",
[285] = "MCTP",
};
$

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+17 -3
+2 -2
tools/perf/Makefile.perf
··· 519 519 socket_arrays := $(beauty_outdir)/socket.c 520 520 socket_tbl := $(srctree)/tools/perf/trace/beauty/socket.sh 521 521 522 - $(socket_arrays): $(linux_uapi_dir)/in.h $(socket_tbl) 523 - $(Q)$(SHELL) '$(socket_tbl)' $(linux_uapi_dir) > $@ 522 + $(socket_arrays): $(linux_uapi_dir)/in.h $(beauty_linux_dir)/socket.h $(socket_tbl) 523 + $(Q)$(SHELL) '$(socket_tbl)' $(linux_uapi_dir) $(beauty_linux_dir) > $@ 524 524 525 525 sockaddr_arrays := $(beauty_outdir)/sockaddr.c 526 526 sockaddr_tbl := $(srctree)/tools/perf/trace/beauty/sockaddr.sh
+2
tools/perf/trace/beauty/beauty.h
··· 62 62 63 63 extern struct strarray strarray__socket_families; 64 64 65 + extern struct strarray strarray__socket_level; 66 + 65 67 /** 66 68 * augmented_arg: extra payload for syscall pointer arguments 67 69
+13 -1
tools/perf/trace/beauty/socket.sh
··· 3 3 4 4 if [ $# -gt 0 ] ; then 5 5 uapi_header_dir=$1 6 + beauty_header_dir=$2 6 7 else 7 8 uapi_header_dir=tools/include/uapi/linux/ 9 + beauty_header_dir=tools/perf/trace/beauty/include/linux/ 8 10 fi 9 11 10 12 printf "static const char *socket_ipproto[] = {\n" ··· 15 13 egrep $ipproto_regex ${uapi_header_dir}/in.h | \ 16 14 sed -r "s/$ipproto_regex/\2 \1/g" | \ 17 15 sort -n | xargs printf "\t[%s] = \"%s\",\n" 18 - printf "};\n" 16 + printf "};\n\n" 17 + 18 + printf "static const char *socket_level[] = {\n" 19 + socket_level_regex='^#define[[:space:]]+SOL_(\w+)[[:space:]]+([[:digit:]]+)([[:space:]]+\/.*)?' 20 + 21 + egrep $socket_level_regex ${beauty_header_dir}/socket.h | \ 22 + sed -r "s/$socket_level_regex/\2 \1/g" | \ 23 + sort -n | xargs printf "\t[%s] = \"%s\",\n" 24 + printf "};\n\n" 25 + 26 + printf 'DEFINE_STRARRAY(socket_level, "SOL_");\n'