7 static size_t syscall_arg__scnprintf_mmap_prot(char *bf, size_t size,
8 struct syscall_arg *arg)
10 int printed = 0, prot = arg->val;
12 if (prot == PROT_NONE)
13 return scnprintf(bf, size, "NONE");
14 #define P_MMAP_PROT(n) \
15 if (prot & PROT_##n) { \
16 printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
24 P_MMAP_PROT(GROWSDOWN);
29 printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", prot);
34 #define SCA_MMAP_PROT syscall_arg__scnprintf_mmap_prot
37 #define MAP_FIXED 0x10
41 #define MAP_ANONYMOUS 0x20
45 #define MAP_32BIT 0x40
49 #define MAP_STACK 0x20000
53 #define MAP_HUGETLB 0x40000
56 #ifndef MAP_UNINITIALIZED
57 #define MAP_UNINITIALIZED 0x4000000
61 static size_t syscall_arg__scnprintf_mmap_flags(char *bf, size_t size,
62 struct syscall_arg *arg)
64 int printed = 0, flags = arg->val;
66 #define P_MMAP_FLAG(n) \
67 if (flags & MAP_##n) { \
68 printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
75 P_MMAP_FLAG(ANONYMOUS);
76 P_MMAP_FLAG(DENYWRITE);
77 P_MMAP_FLAG(EXECUTABLE);
80 P_MMAP_FLAG(GROWSDOWN);
83 P_MMAP_FLAG(NONBLOCK);
84 P_MMAP_FLAG(NORESERVE);
85 P_MMAP_FLAG(POPULATE);
87 P_MMAP_FLAG(UNINITIALIZED);
91 printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
96 #define SCA_MMAP_FLAGS syscall_arg__scnprintf_mmap_flags
98 #ifndef MREMAP_MAYMOVE
99 #define MREMAP_MAYMOVE 1
102 #define MREMAP_FIXED 2
105 static size_t syscall_arg__scnprintf_mremap_flags(char *bf, size_t size,
106 struct syscall_arg *arg)
108 int printed = 0, flags = arg->val;
110 #define P_MREMAP_FLAG(n) \
111 if (flags & MREMAP_##n) { \
112 printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
113 flags &= ~MREMAP_##n; \
116 P_MREMAP_FLAG(MAYMOVE);
117 P_MREMAP_FLAG(FIXED);
121 printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
126 #define SCA_MREMAP_FLAGS syscall_arg__scnprintf_mremap_flags
128 #ifndef MADV_HWPOISON
129 #define MADV_HWPOISON 100
132 #ifndef MADV_SOFT_OFFLINE
133 #define MADV_SOFT_OFFLINE 101
136 #ifndef MADV_MERGEABLE
137 #define MADV_MERGEABLE 12
140 #ifndef MADV_UNMERGEABLE
141 #define MADV_UNMERGEABLE 13
144 #ifndef MADV_HUGEPAGE
145 #define MADV_HUGEPAGE 14
148 #ifndef MADV_NOHUGEPAGE
149 #define MADV_NOHUGEPAGE 15
152 #ifndef MADV_DONTDUMP
153 #define MADV_DONTDUMP 16
157 #define MADV_DODUMP 17
161 static size_t syscall_arg__scnprintf_madvise_behavior(char *bf, size_t size,
162 struct syscall_arg *arg)
164 int behavior = arg->val;
167 #define P_MADV_BHV(n) case MADV_##n: return scnprintf(bf, size, #n)
170 P_MADV_BHV(SEQUENTIAL);
171 P_MADV_BHV(WILLNEED);
172 P_MADV_BHV(DONTNEED);
174 P_MADV_BHV(DONTFORK);
176 P_MADV_BHV(HWPOISON);
177 P_MADV_BHV(SOFT_OFFLINE);
178 P_MADV_BHV(MERGEABLE);
179 P_MADV_BHV(UNMERGEABLE);
180 P_MADV_BHV(HUGEPAGE);
181 P_MADV_BHV(NOHUGEPAGE);
182 P_MADV_BHV(DONTDUMP);
188 return scnprintf(bf, size, "%#x", behavior);
191 #define SCA_MADV_BHV syscall_arg__scnprintf_madvise_behavior