mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 09:36:57 +07:00
c3b81a500f
When the prefix suppresion/enabling logic was added, I forgot to add an extra %, which ended up chopping off the strings: Before: # perf trace -e *mmsg --map-dump syscalls [299] = 1, [307] = 1, DNS Res~ver #3/14587 sendmmsg(106<socket:[3462393]>, 0x7f252b0fcaf0, 2, MSG_) = 2 chronyd/1053 recvmmsg(4, 0x558542ca5740, 4, MSG_, NULL) = 1 DNS Res~ver #2/14445 sendmmsg(106<socket:[3461475]>, 0x7f252ab09af0, 2, MSG_) = 2 DNS Res~ver #2/14444 sendmmsg(146<socket:[3457863]>, 0x7f2521a7aaf0, 2, MSG_) = 2 DNS Res~ver #2/14445 sendmmsg(106<socket:[3461475]>, 0x7f252ab09af0, 2, MSG_) = 2 DNS Res~ver #3/14587 sendmmsg(148<socket:[3460636]>, 0x7f252b0fcaf0, 2, MSG_) = 2 DNS Res~ver #2/14444 sendmmsg(146<socket:[3457863]>, 0x7f2521a7aaf0, 2, MSG_) = 2 ^C# After: # perf trace -e *mmsg --map-dump syscalls [299] = 1, [307] = 1, NetworkManager/17467 sendmmsg(22<socket:[3466493
]>, 0x7f28927f9bb0, 2, MSG_NOSIGNAL) = 2 pool/17478 sendmmsg(10<socket:[3466523]>, 0x7f2769f95e90, 2, MSG_NOSIGNAL) = 2 DNS Res~ver #3/14587 sendmmsg(121<socket:[3466132]>, 0x7f252b0fcaf0, 2, MSG_NOSIGNAL) = 2 chronyd/1053 recvmmsg(4, 0x558542ca5740, 4, MSG_DONTWAIT, NULL) = 1 Socket Thread/17433 sendmmsg(121<socket:[3460903]>, 0x7f252668baf0, 2, MSG_NOSIGNAL) = 2 ^C# Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Fixes:c65c83ffe9
("perf trace: Allow asking for not suppressing common string prefixes") Link: https://lkml.kernel.org/n/tip-t2eu1rqx710k6jr4814mlzg7@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
65 lines
1.5 KiB
C
65 lines
1.5 KiB
C
// SPDX-License-Identifier: LGPL-2.1
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
|
|
#ifndef MSG_PROBE
|
|
#define MSG_PROBE 0x10
|
|
#endif
|
|
#ifndef MSG_WAITFORONE
|
|
#define MSG_WAITFORONE 0x10000
|
|
#endif
|
|
#ifndef MSG_SENDPAGE_NOTLAST
|
|
#define MSG_SENDPAGE_NOTLAST 0x20000
|
|
#endif
|
|
#ifndef MSG_FASTOPEN
|
|
#define MSG_FASTOPEN 0x20000000
|
|
#endif
|
|
#ifndef MSG_CMSG_CLOEXEC
|
|
# define MSG_CMSG_CLOEXEC 0x40000000
|
|
#endif
|
|
|
|
static size_t syscall_arg__scnprintf_msg_flags(char *bf, size_t size,
|
|
struct syscall_arg *arg)
|
|
{
|
|
bool show_prefix = arg->show_string_prefix;
|
|
const char *prefix = "MSG_";
|
|
int printed = 0, flags = arg->val;
|
|
|
|
if (flags == 0)
|
|
return scnprintf(bf, size, "NONE");
|
|
#define P_MSG_FLAG(n) \
|
|
if (flags & MSG_##n) { \
|
|
printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
|
|
flags &= ~MSG_##n; \
|
|
}
|
|
|
|
P_MSG_FLAG(OOB);
|
|
P_MSG_FLAG(PEEK);
|
|
P_MSG_FLAG(DONTROUTE);
|
|
P_MSG_FLAG(CTRUNC);
|
|
P_MSG_FLAG(PROBE);
|
|
P_MSG_FLAG(TRUNC);
|
|
P_MSG_FLAG(DONTWAIT);
|
|
P_MSG_FLAG(EOR);
|
|
P_MSG_FLAG(WAITALL);
|
|
P_MSG_FLAG(FIN);
|
|
P_MSG_FLAG(SYN);
|
|
P_MSG_FLAG(CONFIRM);
|
|
P_MSG_FLAG(RST);
|
|
P_MSG_FLAG(ERRQUEUE);
|
|
P_MSG_FLAG(NOSIGNAL);
|
|
P_MSG_FLAG(MORE);
|
|
P_MSG_FLAG(WAITFORONE);
|
|
P_MSG_FLAG(SENDPAGE_NOTLAST);
|
|
P_MSG_FLAG(FASTOPEN);
|
|
P_MSG_FLAG(CMSG_CLOEXEC);
|
|
#undef P_MSG_FLAG
|
|
|
|
if (flags)
|
|
printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
|
|
|
|
return printed;
|
|
}
|
|
|
|
#define SCA_MSG_FLAGS syscall_arg__scnprintf_msg_flags
|