1
2#include <sys/types.h>
3#include <sys/wait.h>
4
5static size_t syscall_arg__scnprintf_waitid_options(char *bf, size_t size,
6 struct syscall_arg *arg)
7{
8 bool show_prefix = arg->show_string_prefix;
9 const char *prefix = "W";
10 int printed = 0, options = arg->val;
11
12#define P_OPTION(n) \
13 if (options & W##n) { \
14 printed += scnprintf(bf + printed, size - printed, "%s%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
15 options &= ~W##n; \
16 }
17
18 P_OPTION(NOHANG);
19 P_OPTION(UNTRACED);
20 P_OPTION(CONTINUED);
21#undef P_OPTION
22
23 if (options)
24 printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", options);
25
26 return printed;
27}
28
29#define SCA_WAITID_OPTIONS syscall_arg__scnprintf_waitid_options
30