Skip to content

Commit 2afefdc

Browse files
committed
Add names for signals
1 parent 6db3e61 commit 2afefdc

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

llvm/lib/Support/zOSLibFunctions.cpp

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,56 @@
1919
#include <sys/wait.h>
2020

2121

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+
2265
// z/OS Unix System Services does not have strsignal() support, so the
2366
// strsignal() function is implemented here.
2467
char *strsignal(int sig) {
68+
if (sig < sizeof(signalName)/sizeof(signalName[0]) && signalName[sig])
69+
return signalName[sig];
2570
static char msg[256];
26-
sprintf(msg, "%d", sig);
71+
sprintf(msg, "Unknown signal %d", sig);
2772
return msg;
2873
}
2974

0 commit comments

Comments
 (0)