GNU Linux-libre 4.9.292-gnu1
[releases.git] / tools / perf / trace / beauty / waitid_options.c
1 #include <sys/types.h>
2 #include <sys/wait.h>
3
4 static size_t syscall_arg__scnprintf_waitid_options(char *bf, size_t size,
5                                                     struct syscall_arg *arg)
6 {
7         int printed = 0, options = arg->val;
8
9 #define P_OPTION(n) \
10         if (options & W##n) { \
11                 printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
12                 options &= ~W##n; \
13         }
14
15         P_OPTION(NOHANG);
16         P_OPTION(UNTRACED);
17         P_OPTION(CONTINUED);
18 #undef P_OPTION
19
20         if (options)
21                 printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", options);
22
23         return printed;
24 }
25
26 #define SCA_WAITID_OPTIONS syscall_arg__scnprintf_waitid_options