summaryrefslogtreecommitdiffstats
path: root/usr/klibc/siglongjmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/siglongjmp.c')
-rw-r--r--usr/klibc/siglongjmp.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/usr/klibc/siglongjmp.c b/usr/klibc/siglongjmp.c
new file mode 100644
index 0000000..45f4e40
--- /dev/null
+++ b/usr/klibc/siglongjmp.c
@@ -0,0 +1,16 @@
+/*
+ * siglongjmp.c
+ *
+ * sigsetjmp() is a macro, by necessity (it's either that or write
+ * it in assembly), but siglongjmp() is a normal function.
+ */
+
+#include <setjmp.h>
+#include <signal.h>
+
+__noreturn siglongjmp(sigjmp_buf buf, int retval)
+{
+ if (buf->__sigs_saved)
+ sigprocmask(SIG_SETMASK, &buf->__sigs, NULL);
+ longjmp(buf->__jmpbuf, retval);
+}