You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/08/16 08:24:51 UTC
svn commit: r804630 -
/commons/sandbox/runtime/trunk/src/main/native/port/strsignal.c
Author: mturk
Date: Sun Aug 16 06:24:51 2009
New Revision: 804630
URL: http://svn.apache.org/viewvc?rev=804630&view=rev
Log:
Rewrite strsignal
Modified:
commons/sandbox/runtime/trunk/src/main/native/port/strsignal.c
Modified: commons/sandbox/runtime/trunk/src/main/native/port/strsignal.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/port/strsignal.c?rev=804630&r1=804629&r2=804630&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/port/strsignal.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/port/strsignal.c Sun Aug 16 06:24:51 2009
@@ -35,48 +35,53 @@
* TODO: Create a mapping table from real signal
* number to our description table if that's a problem.
*/
-static const char *signal_description[] = {
- "Signal #0",
- "Hangup",
- "Interrupt",
- "Quit",
- "Illegal instruction",
- "Trace trap",
- "Abort",
- "EMT instruction",
- "Floating point exception",
- "Kill",
- "Bus error",
- "Segmentation violation",
- "Bad argument to system call",
- "Write on a pipe with no one to read it",
- "Alarm clock",
- "Software termination signal from kill",
- "Urgent condition on IO channel",
- "Stopped (signal)",
- "Stop signal from tty",
- "Continue a stopped process",
- "To parent on child stop or exit",
- "Stopped (tty input)",
- "Stopped (tty output)",
- "Input/output possible signal",
- "Exceeded CPU time limit",
- "Exceeded file size limit",
- "Virtual time alarm",
- "Profiling time alarm",
- "Window size changes",
- "Information request",
- "User defined signal #1",
- "User defined signal #2",
+static const char *const _posix_siglist[] = {
+ "Signal 0",
+ "Hangup", /* SIGHUP */
+ "Interrupt", /* SIGINT */
+ "Quit", /* SIGQUIT */
+ "Illegal instruction", /* SIGILL */
+ "Trace/BPT trap", /* SIGTRAP */
+ "Abort trap", /* SIGABRT */
+ "EMT trap", /* SIGEMT */
+ "Floating point exception", /* SIGFPE */
+ "Killed", /* SIGKILL */
+ "Bus error", /* SIGBUS */
+ "Segmentation fault", /* SIGSEGV */
+ "Bad system call", /* SIGSYS */
+ "Broken pipe", /* SIGPIPE */
+ "Alarm clock", /* SIGALRM */
+ "Terminated", /* SIGTERM */
+ "Urgent I/O condition", /* SIGURG */
+ "Suspended (signal)", /* SIGSTOP */
+ "Suspended", /* SIGTSTP */
+ "Continued", /* SIGCONT */
+ "Child exited", /* SIGCHLD */
+ "Stopped (tty input)", /* SIGTTIN */
+ "Stopped (tty output)", /* SIGTTOU */
+ "I/O possible", /* SIGIO */
+ "Cputime limit exceeded", /* SIGXCPU */
+ "Filesize limit exceeded", /* SIGXFSZ */
+ "Virtual timer expired", /* SIGVTALRM */
+ "Profiling timer expired", /* SIGPROF */
+ "Window size changes", /* SIGWINCH */
+ "Information request", /* SIGINFO */
+ "User defined signal 1", /* SIGUSR1 */
+ "User defined signal 2", /* SIGUSR2 */
NULL
};
char *strsignal(int signum)
{
- if (signum >= 0 && signum < ACR_NUMSIGS)
- return (char *)signal_description[signum];
+ static char buf[32];
+ int saved = errno;
+ if (signum < ACR_NUMSIGS)
+ strcpy(buf, _posix_siglist[signum];
else
- return NULL;
+ sprintf(buf, "Unknown signal (%d)", signum);
+
+ errno = saved;;
+ return buf;
}
#else