diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-12-17 15:55:57 +0100 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2018-12-18 20:07:42 +0100 |
commit | 601d66d43309534eb7a268bdc42c205521014645 (patch) | |
tree | 938d474607077e425c175ca5e3533ab44193d744 /tools/perf/trace | |
parent | perf trace: Allow asking for not suppressing common string prefixes (diff) | |
download | linux-601d66d43309534eb7a268bdc42c205521014645.tar.xz linux-601d66d43309534eb7a268bdc42c205521014645.zip |
perf trace beauty: Print O_RDONLY when (flags & O_ACCMODE) == 0
And there are more flags, to match strace's output.
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
Also to help with regression tests.
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>
Link: https://lkml.kernel.org/n/tip-ofovpmvdli3bwch30936xn7t@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/trace')
-rw-r--r-- | tools/perf/trace/beauty/open_flags.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/trace/beauty/open_flags.c b/tools/perf/trace/beauty/open_flags.c index 6da48893a1bb..78f6566ef110 100644 --- a/tools/perf/trace/beauty/open_flags.c +++ b/tools/perf/trace/beauty/open_flags.c @@ -27,8 +27,10 @@ size_t open__scnprintf_flags(unsigned long flags, char *bf, size_t size, bool sh const char *prefix = "O_"; int printed = 0; + if ((flags & O_ACCMODE) == O_RDONLY) + printed = scnprintf(bf, size, "%s%s", show_prefix ? prefix : "", "RDONLY"); if (flags == 0) - return scnprintf(bf, size, "%s%s", show_prefix ? prefix : "", "RDONLY"); + return printed; #define P_FLAG(n) \ if (flags & O_##n) { \ printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \ |