waitid_options.c 629 B

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