summaryrefslogtreecommitdiffstats
path: root/usr/klibc/strsignal.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/strsignal.c')
-rw-r--r--usr/klibc/strsignal.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/usr/klibc/strsignal.c b/usr/klibc/strsignal.c
new file mode 100644
index 0000000..e345e9c
--- /dev/null
+++ b/usr/klibc/strsignal.c
@@ -0,0 +1,26 @@
+/*
+ * strsignal.c
+ */
+
+#include <string.h>
+#include <signal.h>
+#include <stdio.h>
+
+char *strsignal(int sig)
+{
+ static char buf[64];
+
+ if ((unsigned)sig < _NSIG && sys_siglist[sig])
+ return (char *)sys_siglist[sig];
+
+#ifdef SIGRTMIN
+ if (sig >= SIGRTMIN && sig <= SIGRTMAX) {
+ snprintf(buf, sizeof buf, "Real-time signal %d",
+ sig - SIGRTMIN);
+ return buf;
+ }
+#endif
+
+ snprintf(buf, sizeof buf, "Signal %d", sig);
+ return buf;
+}