|
19 | 19 | #include <sys/wait.h> |
20 | 20 |
|
21 | 21 |
|
| 22 | +char *signalName[] = { |
| 23 | + /* 0 */ nullptr, |
| 24 | + /* 1 */ "Hangup", // SIGHUP - Posix |
| 25 | + /* 2 */ "Interrupt", // SIGINT |
| 26 | + /* 3 */ "Aborted", // SIGABRT |
| 27 | + /* 4 */ "Illegal instruction", // SIGILL |
| 28 | + /* 5 */ "Polling event", // SIGPOLL |
| 29 | + /* 6 */ "Socket data available", // SIGURG |
| 30 | + /* 7 */ "Stopped (signal)", // SIGSTOP - Posix |
| 31 | + /* 8 */ "Floating point exception", // SIGFPE |
| 32 | + /* 9 */ "Killed", // SIGKILL - Posix |
| 33 | + /* 10 */ "Bus error", // SIGBUS |
| 34 | + /* 11 */ "Segmentation fault", // SIGSEGV |
| 35 | + /* 12 */ "Bad system call", // SIGSYS |
| 36 | + /* 13 */ "Broken pipe", // SIGPIPE - Posix |
| 37 | + /* 14 */ "Alarm clock", // SIGALRM - Posix |
| 38 | + /* 15 */ "Terminated", // SIGTERM |
| 39 | + /* 16 */ "User defined signal 1", // SIGUSR1 |
| 40 | + /* 17 */ "User defined signal 2", // SIGUSR2 |
| 41 | + /* 18 */ "Abend", // SIGABND |
| 42 | + /* 19 */ "Continued", // SIGCONT - Posix |
| 43 | + /* 20 */ "Child exited", // SIGCHLD - Posix |
| 44 | + /* 21 */ "Stopped (tty input)", // SIGTTIN - Posix |
| 45 | + /* 22 */ "Stopped (tty output)", // SIGTTOU - Posix |
| 46 | + /* 23 */ "I/O complete", // SIGIO |
| 47 | + /* 24 */ "Quit", // SIGQUIT - Posix |
| 48 | + /* 25 */ "Stopped", // SIGTSTP - Posix |
| 49 | + /* 26 */ "Trace/breakpoint trap", // SIGTRAP |
| 50 | + /* 27 */ "I/O error", // SIGIOERR |
| 51 | + /* 28 */ "Window changed", // SIGWINCH |
| 52 | + /* 29 */ "CPU time limit exceeded", // SIGXCPU |
| 53 | + /* 30 */ "File size limit exceeded", // SIGXFSZ |
| 54 | + /* 31 */ "Virtual timer expired", // SIGVTALRM |
| 55 | + /* 32 */ "Profiling timer expired", |
| 56 | + /* 33 */ "OMVS subsystem shutdown", // SIGDANGER |
| 57 | + /* 34 */ "Thread stop", // SIGTHSTOP |
| 58 | + /* 35 */ "Thread resume", // SIGTHCONT |
| 59 | + /* 36 */ nullptr, |
| 60 | + /* 37 */ "Toggle syscall trace", // SIGTRACE |
| 61 | + /* 38 */ nullptr, // SIGDCE |
| 62 | + /* 39 */ "System dump", // SIGDUMP - Posix |
| 63 | +}; |
| 64 | + |
22 | 65 | // z/OS Unix System Services does not have strsignal() support, so the |
23 | 66 | // strsignal() function is implemented here. |
24 | 67 | char *strsignal(int sig) { |
| 68 | + if (sig < sizeof(signalName)/sizeof(signalName[0]) && signalName[sig]) |
| 69 | + return signalName[sig]; |
25 | 70 | static char msg[256]; |
26 | | - sprintf(msg, "%d", sig); |
| 71 | + sprintf(msg, "Unknown signal %d", sig); |
27 | 72 | return msg; |
28 | 73 | } |
29 | 74 |
|
|
0 commit comments