1 #ifndef EFD_SEMAPHORE
2 #define EFD_SEMAPHORE 1
3 #endif
4
5 #ifndef EFD_NONBLOCK
6 #define EFD_NONBLOCK 00004000
7 #endif
8
9 #ifndef EFD_CLOEXEC
10 #define EFD_CLOEXEC 02000000
11 #endif
12
syscall_arg__scnprintf_eventfd_flags(char * bf,size_t size,struct syscall_arg * arg)13 static size_t syscall_arg__scnprintf_eventfd_flags(char *bf, size_t size, struct syscall_arg *arg)
14 {
15 int printed = 0, flags = arg->val;
16
17 if (flags == 0)
18 return scnprintf(bf, size, "NONE");
19 #define P_FLAG(n) \
20 if (flags & EFD_##n) { \
21 printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
22 flags &= ~EFD_##n; \
23 }
24
25 P_FLAG(SEMAPHORE);
26 P_FLAG(CLOEXEC);
27 P_FLAG(NONBLOCK);
28 #undef P_FLAG
29
30 if (flags)
31 printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
32
33 return printed;
34 }
35
36 #define SCA_EFD_FLAGS syscall_arg__scnprintf_eventfd_flags
37