]> git.ipfire.org Git - people/arne_f/kernel.git/blob - tools/perf/trace/beauty/waitid_options.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[people/arne_f/kernel.git] / tools / perf / trace / beauty / waitid_options.c
1 // SPDX-License-Identifier: GPL-2.0
2 #include <sys/types.h>
3 #include <sys/wait.h>
4
5 static size_t syscall_arg__scnprintf_waitid_options(char *bf, size_t size,
6 struct syscall_arg *arg)
7 {
8 int printed = 0, options = arg->val;
9
10 #define P_OPTION(n) \
11 if (options & W##n) { \
12 printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
13 options &= ~W##n; \
14 }
15
16 P_OPTION(NOHANG);
17 P_OPTION(UNTRACED);
18 P_OPTION(CONTINUED);
19 #undef P_OPTION
20
21 if (options)
22 printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", options);
23
24 return printed;
25 }
26
27 #define SCA_WAITID_OPTIONS syscall_arg__scnprintf_waitid_options