summaryrefslogtreecommitdiff
path: root/libc/signal/signal.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-10-23 23:23:54 +0000
committerEric Andersen <andersen@codepoet.org>2000-10-23 23:23:54 +0000
commit5606e4d6f92c10af214b54a01db79cf561067e58 (patch)
treef50c5adf765ad7492736b3fb0e9ae669573e4e5e /libc/signal/signal.c
parent56c9a8402ff4c9004331efc77e5a5fe62aa65014 (diff)
More reorg. A place for everything and everything in its place...
Diffstat (limited to 'libc/signal/signal.c')
-rw-r--r--libc/signal/signal.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libc/signal/signal.c b/libc/signal/signal.c
new file mode 100644
index 000000000..62af55f38
--- /dev/null
+++ b/libc/signal/signal.c
@@ -0,0 +1,20 @@
+#include <string.h>
+#include <signal.h>
+
+__sighandler_t
+__signal (int sig, __sighandler_t handler, int flags)
+{
+ int ret;
+ struct sigaction action, oaction;
+ memset(&action, 0, sizeof(struct sigaction));
+ action.sa_handler = handler;
+ action.sa_flags = flags;
+ ret = sigaction (sig, &action, &oaction);
+ return (ret == -1) ? SIG_ERR : oaction.sa_handler;
+}
+
+__sighandler_t
+signal (int sig, __sighandler_t handler)
+{
+ return __signal(sig, handler, (SA_ONESHOT | SA_NOMASK | SA_INTERRUPT) & ~SA_RESTART);
+}