summaryrefslogtreecommitdiff
path: root/src/signal
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-06-08 16:41:44 -0400
committerRich Felker <dalias@aerifal.cx>2011-06-08 16:41:44 -0400
commitecc0f5138dd784eadea66f5b244515a98b381d39 (patch)
tree7449ef7c98b7b3a42dd406facc846ac85719ae86 /src/signal
parente0037efc1253e190c7c75f74e5a05333fdd807bb (diff)
downloadmusl-ecc0f5138dd784eadea66f5b244515a98b381d39.tar.gz
implement psignal and psiginfo
Diffstat (limited to 'src/signal')
-rw-r--r--src/signal/psiginfo.c10
-rw-r--r--src/signal/psignal.c10
2 files changed, 20 insertions, 0 deletions
diff --git a/src/signal/psiginfo.c b/src/signal/psiginfo.c
new file mode 100644
index 00000000..fa46d2bf
--- /dev/null
+++ b/src/signal/psiginfo.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+
+void psiginfo(siginfo_t *si, const char *msg)
+{
+ char *s = strsignal(si->si_signo);
+ if (msg) fprintf(stderr, "%s: %s\n", msg, s);
+ else fprintf(stderr, "%s\n", s);
+}
diff --git a/src/signal/psignal.c b/src/signal/psignal.c
new file mode 100644
index 00000000..02f1c760
--- /dev/null
+++ b/src/signal/psignal.c
@@ -0,0 +1,10 @@
+#include <stdio.h>
+#include <string.h>
+#include <signal.h>
+
+void psignal(int sig, const char *msg)
+{
+ char *s = strsignal(sig);
+ if (msg) fprintf(stderr, "%s: %s\n", msg, s);
+ else fprintf(stderr, "%s\n", s);
+}