xref: /linux/tools/perf/trace/beauty/waitid_options.c (revision 0883c2c06fb5bcf5b9e008270827e63c09a88c1e)
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
27