diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-trace.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 81c20a6cc6b7..034152c7e974 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -50,6 +50,44 @@ static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size, unsigned l | |||
50 | 50 | ||
51 | #define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot | 51 | #define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot |
52 | 52 | ||
53 | static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size, unsigned long arg) | ||
54 | { | ||
55 | int printed = 0, flags = arg; | ||
56 | |||
57 | #define P_MMAP_FLAG(n) \ | ||
58 | if (flags & MAP_##n) { \ | ||
59 | printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \ | ||
60 | flags &= ~MAP_##n; \ | ||
61 | } | ||
62 | |||
63 | P_MMAP_FLAG(SHARED); | ||
64 | P_MMAP_FLAG(PRIVATE); | ||
65 | P_MMAP_FLAG(32BIT); | ||
66 | P_MMAP_FLAG(ANONYMOUS); | ||
67 | P_MMAP_FLAG(DENYWRITE); | ||
68 | P_MMAP_FLAG(EXECUTABLE); | ||
69 | P_MMAP_FLAG(FILE); | ||
70 | P_MMAP_FLAG(FIXED); | ||
71 | P_MMAP_FLAG(GROWSDOWN); | ||
72 | P_MMAP_FLAG(HUGETLB); | ||
73 | P_MMAP_FLAG(LOCKED); | ||
74 | P_MMAP_FLAG(NONBLOCK); | ||
75 | P_MMAP_FLAG(NORESERVE); | ||
76 | P_MMAP_FLAG(POPULATE); | ||
77 | P_MMAP_FLAG(STACK); | ||
78 | #ifdef MAP_UNINITIALIZED | ||
79 | P_MMAP_FLAG(UNINITIALIZED); | ||
80 | #endif | ||
81 | #undef P_MMAP_FLAG | ||
82 | |||
83 | if (flags) | ||
84 | printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags); | ||
85 | |||
86 | return printed; | ||
87 | } | ||
88 | |||
89 | #define SCA_MMAP_FLAGS syscall_arg__scnprintf_mmap_flags | ||
90 | |||
53 | static struct syscall_fmt { | 91 | static struct syscall_fmt { |
54 | const char *name; | 92 | const char *name; |
55 | const char *alias; | 93 | const char *alias; |
@@ -72,7 +110,8 @@ static struct syscall_fmt { | |||
72 | { .name = "lstat", .errmsg = true, .alias = "newlstat", }, | 110 | { .name = "lstat", .errmsg = true, .alias = "newlstat", }, |
73 | { .name = "mmap", .hexret = true, | 111 | { .name = "mmap", .hexret = true, |
74 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ | 112 | .arg_scnprintf = { [0] = SCA_HEX, /* addr */ |
75 | [2] = SCA_MMAP_PROT, /* prot */ }, }, | 113 | [2] = SCA_MMAP_PROT, /* prot */ |
114 | [3] = SCA_MMAP_FLAGS, /* flags */ }, }, | ||
76 | { .name = "mprotect", .errmsg = true, | 115 | { .name = "mprotect", .errmsg = true, |
77 | .arg_scnprintf = { [0] = SCA_HEX, /* start */ | 116 | .arg_scnprintf = { [0] = SCA_HEX, /* start */ |
78 | [2] = SCA_MMAP_PROT, /* prot */ }, }, | 117 | [2] = SCA_MMAP_PROT, /* prot */ }, }, |