summaryrefslogtreecommitdiffstats
path: root/newlib/libc/sys/linux/strsignal.c
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2002-06-05 20:58:59 +0000
committerJeff Johnston <jjohnstn@redhat.com>2002-06-05 20:58:59 +0000
commit39e65e0113e188e4177077407d337bb3a1ac1853 (patch)
tree7afb2759a870354f5267c72215acfcfc89bb12fa /newlib/libc/sys/linux/strsignal.c
parentea4e6ec8f9fe4a784d4ce2ef71037e05fb9a876d (diff)
downloadcygnal-39e65e0113e188e4177077407d337bb3a1ac1853.tar.gz
cygnal-39e65e0113e188e4177077407d337bb3a1ac1853.tar.bz2
cygnal-39e65e0113e188e4177077407d337bb3a1ac1853.zip
2002-06-05 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/string.h[__linux__]: Add strsignal prototype. * libc/include/sys/lock.h: New file with default locking support. * libc/include/sys/reent.h: Add signal buffer support for strsignal and psignal. * libc/posix/Makefile.am: Add support for readdir_r.c. * libc/posix/Makefile.in: Regenerated. * libc/posix/closedir.c: Add locking support and hash table cleanup. * libc/posix/opendir.c: Add lock support. * libc/posix/readdir.c: Ditto. * libc/posix/rewinddir.c: Ditto. * libc/posix/scandir.c: Ditto. * libc/posix/seekdir.c: Ditto. * libc/posix/telldir.c: Ditto plus add _cleanupdir routine to clean up leftover hash table entries. * libc/posix/readdir_r.c: New file. * libc/sys/linux/Makefile.am: Add psignal.c and strsignal.c support. * libc/sys/linux/Makefile.in: Regenerated. * libc/sys/linux/sys/dirent.h: Add dd_lock to DIR structure. * libc/sys/linux/sys/signal.h: Add psignal prototype. * libc/sys/linux/psignal.c: New file. * libc/sys/linux/strsignal.c: Ditto.
Diffstat (limited to 'newlib/libc/sys/linux/strsignal.c')
-rw-r--r--newlib/libc/sys/linux/strsignal.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/newlib/libc/sys/linux/strsignal.c b/newlib/libc/sys/linux/strsignal.c
new file mode 100644
index 000000000..3f95e18a7
--- /dev/null
+++ b/newlib/libc/sys/linux/strsignal.c
@@ -0,0 +1,63 @@
+#include <string.h>
+#include <signal.h>
+#include <stdio.h>
+#include <reent.h>
+
+static const char *sigstring[] =
+ {
+ "Signal 0",
+ "Hangup",
+ "Interrupt",
+ "Quit",
+ "Illegal instruction",
+ "Trace/breakpoint trap",
+ "IOT trap",
+ "EMT trap",
+ "Floating point exception",
+ "Killed",
+ "Bus error",
+ "Segmentation fault",
+ "Bad system call",
+ "Broken pipe",
+ "Alarm clock",
+ "Terminated",
+ "Urgent I/O condition",
+ "Stopped (signal)",
+ "Stopped",
+ "Continued",
+ "Child exited",
+ "Stopped (tty input)",
+ "Stopped (tty output)",
+ "I/O possible",
+ "CPU time limit exceeded",
+ "File size limit exceeded",
+ "Virtual timer expired",
+ "Profiling timer expired",
+ "Window changed",
+ "Resource lost",
+ "User defined signal 1",
+ "User defined signal 2"
+ };
+
+char *
+strsignal (int sig)
+{
+ if (sig < 0 || sig >= __SIGRTMIN)
+ {
+ char *buffer;
+ struct _reent *ptr;
+
+ ptr = _REENT;
+
+ _REENT_CHECK_SIGNAL_BUF(ptr);
+ buffer = _REENT_SIGNAL_BUF(ptr);
+
+ if (sig < 0 || sig > __SIGRTMAX)
+ siprintf (buffer, "Unknown signal %d", sig);
+ else
+ siprintf (buffer, "Real-time signal %d", sig - __SIGRTMIN);
+ return buffer;
+ }
+ else
+ return sigstring[sig];
+}