aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2016-07-05 13:43:27 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-07-11 23:00:39 -0400
commit256763b01741ec74bbecb3021baee229727935e6 (patch)
tree744c4f776b3f8a3b2a55285dac40d7c0c61f0103 /tools/perf
parent9d4a94cabcffd1f069666ddf9ad3cdc25565eec6 (diff)
perf trace beauty mmap: Add more conditional defines
Don't handle some flags only if they have its defines in headers at time of building, define what is missing. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-czbmxb01xzcl3h2qxuzoqkj5@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/trace/beauty/mmap.c77
1 files changed, 55 insertions, 22 deletions
diff --git a/tools/perf/trace/beauty/mmap.c b/tools/perf/trace/beauty/mmap.c
index 3444a4d5382d..d0a3a8e402e7 100644
--- a/tools/perf/trace/beauty/mmap.c
+++ b/tools/perf/trace/beauty/mmap.c
@@ -1,5 +1,9 @@
1#include <sys/mman.h> 1#include <sys/mman.h>
2 2
3#ifndef PROT_SEM
4#define PROT_SEM 0x8
5#endif
6
3static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size, 7static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size,
4 struct syscall_arg *arg) 8 struct syscall_arg *arg)
5{ 9{
@@ -16,9 +20,7 @@ static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size,
16 P_MMAP_PROT(EXEC); 20 P_MMAP_PROT(EXEC);
17 P_MMAP_PROT(READ); 21 P_MMAP_PROT(READ);
18 P_MMAP_PROT(WRITE); 22 P_MMAP_PROT(WRITE);
19#ifdef PROT_SEM
20 P_MMAP_PROT(SEM); 23 P_MMAP_PROT(SEM);
21#endif
22 P_MMAP_PROT(GROWSDOWN); 24 P_MMAP_PROT(GROWSDOWN);
23 P_MMAP_PROT(GROWSUP); 25 P_MMAP_PROT(GROWSUP);
24#undef P_MMAP_PROT 26#undef P_MMAP_PROT
@@ -31,10 +33,31 @@ static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size,
31 33
32#define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot 34#define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot
33 35
36#ifndef MAP_FIXED
37#define MAP_FIXED 0x10
38#endif
39
40#ifndef MAP_ANONYMOUS
41#define MAP_ANONYMOUS 0x20
42#endif
43
44#ifndef MAP_32BIT
45#define MAP_32BIT 0x40
46#endif
47
34#ifndef MAP_STACK 48#ifndef MAP_STACK
35# define MAP_STACK 0x20000 49#define MAP_STACK 0x20000
36#endif 50#endif
37 51
52#ifndef MAP_HUGETLB
53#define MAP_HUGETLB 0x40000
54#endif
55
56#ifndef MAP_UNINITIALIZED
57#define MAP_UNINITIALIZED 0x4000000
58#endif
59
60
38static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size, 61static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size,
39 struct syscall_arg *arg) 62 struct syscall_arg *arg)
40{ 63{
@@ -48,26 +71,20 @@ static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size,
48 71
49 P_MMAP_FLAG(SHARED); 72 P_MMAP_FLAG(SHARED);
50 P_MMAP_FLAG(PRIVATE); 73 P_MMAP_FLAG(PRIVATE);
51#ifdef MAP_32BIT
52 P_MMAP_FLAG(32BIT); 74 P_MMAP_FLAG(32BIT);
53#endif
54 P_MMAP_FLAG(ANONYMOUS); 75 P_MMAP_FLAG(ANONYMOUS);
55 P_MMAP_FLAG(DENYWRITE); 76 P_MMAP_FLAG(DENYWRITE);
56 P_MMAP_FLAG(EXECUTABLE); 77 P_MMAP_FLAG(EXECUTABLE);
57 P_MMAP_FLAG(FILE); 78 P_MMAP_FLAG(FILE);
58 P_MMAP_FLAG(FIXED); 79 P_MMAP_FLAG(FIXED);
59 P_MMAP_FLAG(GROWSDOWN); 80 P_MMAP_FLAG(GROWSDOWN);
60#ifdef MAP_HUGETLB
61 P_MMAP_FLAG(HUGETLB); 81 P_MMAP_FLAG(HUGETLB);
62#endif
63 P_MMAP_FLAG(LOCKED); 82 P_MMAP_FLAG(LOCKED);
64 P_MMAP_FLAG(NONBLOCK); 83 P_MMAP_FLAG(NONBLOCK);
65 P_MMAP_FLAG(NORESERVE); 84 P_MMAP_FLAG(NORESERVE);
66 P_MMAP_FLAG(POPULATE); 85 P_MMAP_FLAG(POPULATE);
67 P_MMAP_FLAG(STACK); 86 P_MMAP_FLAG(STACK);
68#ifdef MAP_UNINITIALIZED
69 P_MMAP_FLAG(UNINITIALIZED); 87 P_MMAP_FLAG(UNINITIALIZED);
70#endif
71#undef P_MMAP_FLAG 88#undef P_MMAP_FLAG
72 89
73 if (flags) 90 if (flags)
@@ -78,6 +95,13 @@ static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size,
78 95
79#define SCA_MMAP_FLAGS syscall_arg__scnprintf_mmap_flags 96#define SCA_MMAP_FLAGS syscall_arg__scnprintf_mmap_flags
80 97
98#ifndef MREMAP_MAYMOVE
99#define MREMAP_MAYMOVE 1
100#endif
101#ifndef MREMAP_FIXED
102#define MREMAP_FIXED 2
103#endif
104
81static size_t syscall_arg__scnprintf_mremap_flags(char *bf, size_t size, 105static size_t syscall_arg__scnprintf_mremap_flags(char *bf, size_t size,
82 struct syscall_arg *arg) 106 struct syscall_arg *arg)
83{ 107{
@@ -90,9 +114,7 @@ static size_t syscall_arg__scnprintf_mremap_flags(char *bf, size_t size,
90 } 114 }
91 115
92 P_MREMAP_FLAG(MAYMOVE); 116 P_MREMAP_FLAG(MAYMOVE);
93#ifdef MREMAP_FIXED
94 P_MREMAP_FLAG(FIXED); 117 P_MREMAP_FLAG(FIXED);
95#endif
96#undef P_MREMAP_FLAG 118#undef P_MREMAP_FLAG
97 119
98 if (flags) 120 if (flags)
@@ -107,6 +129,10 @@ static size_t syscall_arg__scnprintf_mremap_flags(char *bf, size_t size,
107#define MADV_HWPOISON 100 129#define MADV_HWPOISON 100
108#endif 130#endif
109 131
132#ifndef MADV_SOFT_OFFLINE
133#define MADV_SOFT_OFFLINE 101
134#endif
135
110#ifndef MADV_MERGEABLE 136#ifndef MADV_MERGEABLE
111#define MADV_MERGEABLE 12 137#define MADV_MERGEABLE 12
112#endif 138#endif
@@ -115,6 +141,23 @@ static size_t syscall_arg__scnprintf_mremap_flags(char *bf, size_t size,
115#define MADV_UNMERGEABLE 13 141#define MADV_UNMERGEABLE 13
116#endif 142#endif
117 143
144#ifndef MADV_HUGEPAGE
145#define MADV_HUGEPAGE 14
146#endif
147
148#ifndef MADV_NOHUGEPAGE
149#define MADV_NOHUGEPAGE 15
150#endif
151
152#ifndef MADV_DONTDUMP
153#define MADV_DONTDUMP 16
154#endif
155
156#ifndef MADV_DODUMP
157#define MADV_DODUMP 17
158#endif
159
160
118static size_t syscall_arg__scnprintf_madvise_behavior(char *bf, size_t size, 161static size_t syscall_arg__scnprintf_madvise_behavior(char *bf, size_t size,
119 struct syscall_arg *arg) 162 struct syscall_arg *arg)
120{ 163{
@@ -131,24 +174,14 @@ static size_t syscall_arg__scnprintf_madvise_behavior(char *bf, size_t size,
131 P_MADV_BHV(DONTFORK); 174 P_MADV_BHV(DONTFORK);
132 P_MADV_BHV(DOFORK); 175 P_MADV_BHV(DOFORK);
133 P_MADV_BHV(HWPOISON); 176 P_MADV_BHV(HWPOISON);
134#ifdef MADV_SOFT_OFFLINE
135 P_MADV_BHV(SOFT_OFFLINE); 177 P_MADV_BHV(SOFT_OFFLINE);
136#endif
137 P_MADV_BHV(MERGEABLE); 178 P_MADV_BHV(MERGEABLE);
138 P_MADV_BHV(UNMERGEABLE); 179 P_MADV_BHV(UNMERGEABLE);
139#ifdef MADV_HUGEPAGE
140 P_MADV_BHV(HUGEPAGE); 180 P_MADV_BHV(HUGEPAGE);
141#endif
142#ifdef MADV_NOHUGEPAGE
143 P_MADV_BHV(NOHUGEPAGE); 181 P_MADV_BHV(NOHUGEPAGE);
144#endif
145#ifdef MADV_DONTDUMP
146 P_MADV_BHV(DONTDUMP); 182 P_MADV_BHV(DONTDUMP);
147#endif
148#ifdef MADV_DODUMP
149 P_MADV_BHV(DODUMP); 183 P_MADV_BHV(DODUMP);
150#endif 184#undef P_MADV_BHV
151#undef P_MADV_PHV
152 default: break; 185 default: break;
153 } 186 }
154 187