signum.c 931 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. static size_t syscall_arg__scnprintf_signum(char *bf, size_t size, struct syscall_arg *arg)
  2. {
  3. int sig = arg->val;
  4. switch (sig) {
  5. #define P_SIGNUM(n) case SIG##n: return scnprintf(bf, size, #n)
  6. P_SIGNUM(HUP);
  7. P_SIGNUM(INT);
  8. P_SIGNUM(QUIT);
  9. P_SIGNUM(ILL);
  10. P_SIGNUM(TRAP);
  11. P_SIGNUM(ABRT);
  12. P_SIGNUM(BUS);
  13. P_SIGNUM(FPE);
  14. P_SIGNUM(KILL);
  15. P_SIGNUM(USR1);
  16. P_SIGNUM(SEGV);
  17. P_SIGNUM(USR2);
  18. P_SIGNUM(PIPE);
  19. P_SIGNUM(ALRM);
  20. P_SIGNUM(TERM);
  21. P_SIGNUM(CHLD);
  22. P_SIGNUM(CONT);
  23. P_SIGNUM(STOP);
  24. P_SIGNUM(TSTP);
  25. P_SIGNUM(TTIN);
  26. P_SIGNUM(TTOU);
  27. P_SIGNUM(URG);
  28. P_SIGNUM(XCPU);
  29. P_SIGNUM(XFSZ);
  30. P_SIGNUM(VTALRM);
  31. P_SIGNUM(PROF);
  32. P_SIGNUM(WINCH);
  33. P_SIGNUM(IO);
  34. P_SIGNUM(PWR);
  35. P_SIGNUM(SYS);
  36. #ifdef SIGEMT
  37. P_SIGNUM(EMT);
  38. #endif
  39. #ifdef SIGSTKFLT
  40. P_SIGNUM(STKFLT);
  41. #endif
  42. #ifdef SIGSWI
  43. P_SIGNUM(SWI);
  44. #endif
  45. default: break;
  46. }
  47. return scnprintf(bf, size, "%#x", sig);
  48. }
  49. #define SCA_SIGNUM syscall_arg__scnprintf_signum