| 66 | using bess::utils::Parse; |
| 67 | |
| 68 | static const char *si_code_to_str(int sig_num, int si_code) { |
| 69 | /* See the manpage of sigaction() */ |
| 70 | switch (si_code) { |
| 71 | case SI_USER: |
| 72 | return "SI_USER: kill"; |
| 73 | case SI_KERNEL: |
| 74 | return "SI_KERNEL: sent by the kernel"; |
| 75 | case SI_QUEUE: |
| 76 | return "SI_QUEUE: sigqueue"; |
| 77 | case SI_TIMER: |
| 78 | return "SI_TIMER: POSIX timer expired"; |
| 79 | case SI_MESGQ: |
| 80 | return "SI_MESGQ: POSIX message queue state changed"; |
| 81 | case SI_ASYNCIO: |
| 82 | return "SI_ASYNCIO: AIO completed"; |
| 83 | case SI_SIGIO: |
| 84 | return "SI_SIGIO: Queued SIGIO"; |
| 85 | case SI_TKILL: |
| 86 | return "SI_TKILL: tkill or tgkill"; |
| 87 | } |
| 88 | |
| 89 | switch (sig_num) { |
| 90 | case SIGILL: |
| 91 | switch (si_code) { |
| 92 | case ILL_ILLOPC: |
| 93 | return "ILL_ILLOPC: illegal opcode"; |
| 94 | case ILL_ILLOPN: |
| 95 | return "ILL_ILLOPN: illegal operand"; |
| 96 | case ILL_ILLADR: |
| 97 | return "ILL_ILLADR: illegal addressing mode"; |
| 98 | case ILL_ILLTRP: |
| 99 | return "ILL_ILLTRP: illegal trap"; |
| 100 | case ILL_PRVOPC: |
| 101 | return "ILL_PRVOPC: privileged opcode"; |
| 102 | case ILL_PRVREG: |
| 103 | return "ILL_PRVREG: privileged register"; |
| 104 | case ILL_COPROC: |
| 105 | return "ILL_COPROC: coprocessor error"; |
| 106 | case ILL_BADSTK: |
| 107 | return "ILL_PRVREG: internal stack error"; |
| 108 | default: |
| 109 | return "unknown"; |
| 110 | } |
| 111 | |
| 112 | case SIGFPE: |
| 113 | switch (si_code) { |
| 114 | case FPE_INTDIV: |
| 115 | return "FPE_INTDIV: integer divide by zero"; |
| 116 | case FPE_INTOVF: |
| 117 | return "FPE_INTOVF: integer overflow"; |
| 118 | case FPE_FLTDIV: |
| 119 | return "FPE_FLTDIV: floating-point divide by zero"; |
| 120 | case FPE_FLTOVF: |
| 121 | return "FPE_FLTOVF: floating-point overflow"; |
| 122 | case FPE_FLTUND: |
| 123 | return "FPE_FLTOVF: floating-point underflow"; |
| 124 | case FPE_FLTRES: |
| 125 | return "FPE_FLTOVF: floating-point inexact result"; |