1 #ifndef PERF_FLAG_FD_NO_GROUP 2 # define PERF_FLAG_FD_NO_GROUP (1UL << 0) 3 #endif 4 5 #ifndef PERF_FLAG_FD_OUTPUT 6 # define PERF_FLAG_FD_OUTPUT (1UL << 1) 7 #endif 8 9 #ifndef PERF_FLAG_PID_CGROUP 10 # define PERF_FLAG_PID_CGROUP (1UL << 2) /* pid=cgroup id, per-cpu mode only */ 11 #endif 12 13 #ifndef PERF_FLAG_FD_CLOEXEC 14 # define PERF_FLAG_FD_CLOEXEC (1UL << 3) /* O_CLOEXEC */ 15 #endif 16 17 static size_t syscall_arg__scnprintf_perf_flags(char *bf, size_t size, 18 struct syscall_arg *arg) 19 { 20 int printed = 0, flags = arg->val; 21 22 if (flags == 0) 23 return 0; 24 25 #define P_FLAG(n) \ 26 if (flags & PERF_FLAG_##n) { \ 27 printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \ 28 flags &= ~PERF_FLAG_##n; \ 29 } 30 31 P_FLAG(FD_NO_GROUP); 32 P_FLAG(FD_OUTPUT); 33 P_FLAG(PID_CGROUP); 34 P_FLAG(FD_CLOEXEC); 35 #undef P_FLAG 36 37 if (flags) 38 printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags); 39 40 return printed; 41 } 42 43 #define SCA_PERF_FLAGS syscall_arg__scnprintf_perf_flags 44