OrionLibC
Barry Updating libc for pipes and signals ad9b6af (3 years, 1 month ago)
diff --git a/signal/signal.c b/signal/signal.c
new file mode 100644
index 0000000..f2495e8
--- /dev/null
+++ b/signal/signal.c
@@ -0,0 +1,16 @@
+#include <sys/syscall.h>
+#include <signal.h>
+#include <errno.h>
+
+/* Send a signal to a process */
+sighandler_t
+signal(int signum, sighandler_t handler)
+{
+ sighandler_t ret;
+ asm volatile("int $0x80" : "=a" (ret) : "0" (SYSCALL_SIGNAL),
+ "c" (2), "S" (&signum));
+ if ((int) ret >= 0)
+ return ret;
+ errno = -((int) ret);
+ return SIG_ERR;
+}
diff --git a/signal/sigprocmask.c b/signal/sigprocmask.c
new file mode 100644
index 0000000..0522a36
--- /dev/null
+++ b/signal/sigprocmask.c
@@ -0,0 +1,16 @@
+#include <sys/syscall.h>
+#include <signal.h>
+#include <errno.h>
+
+/* Send a signal to a process */
+int
+sigprocmask(int how, const sigset_t *set, sigset_t *oldset)
+{
+ int ret;
+ asm volatile("int $0x80" : "=a" (ret) : "0" (SYSCALL_SIGPROCMASK),
+ "c" (3), "S" (&how));
+ if (ret >= 0)
+ return ret;
+ errno = -ret;
+ return -1;
+}