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