Merge tag 'tty-4.20-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
[sfrench/cifs-2.6.git] / tools / perf / trace / beauty / waitid_options.c
1 // SPDX-License-Identifier: LGPL-2.1
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