aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/options/ansi/include/setjmp.h
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-07 17:28:00 -0500
committerIan Moffett <ian@osmora.org>2024-03-07 17:28:32 -0500
commitbd5969fc876a10b18613302db7087ef3c40f18e1 (patch)
tree7c2b8619afe902abf99570df2873fbdf40a4d1a1 /lib/mlibc/options/ansi/include/setjmp.h
parenta95b38b1b92b172e6cc4e8e56a88a30cc65907b0 (diff)
lib: Add mlibc
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib/mlibc/options/ansi/include/setjmp.h')
-rw-r--r--lib/mlibc/options/ansi/include/setjmp.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/mlibc/options/ansi/include/setjmp.h b/lib/mlibc/options/ansi/include/setjmp.h
new file mode 100644
index 0000000..30346f0
--- /dev/null
+++ b/lib/mlibc/options/ansi/include/setjmp.h
@@ -0,0 +1,48 @@
+
+#ifndef _SETJMP_H
+#define _SETJMP_H
+
+#include <mlibc-config.h>
+#include <bits/machine.h>
+#include <abi-bits/signal.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// [C11/7.13] Non-local jumps
+
+typedef struct __jmp_buf {
+ struct __mlibc_jmpbuf_register_state reg_state;
+} jmp_buf[1];
+
+#ifndef __MLIBC_ABI_ONLY
+
+__attribute__((__returns_twice__)) int setjmp(jmp_buf buffer);
+__attribute__((__noreturn__)) void longjmp(jmp_buf buffer, int value);
+
+#endif /* !__MLIBC_ABI_ONLY */
+
+// POSIX Non-local jumps signal extensions
+
+typedef struct __sigjmp_buf {
+ struct __mlibc_jmpbuf_register_state reg_state;
+ int savesigs;
+ sigset_t sigset;
+} sigjmp_buf[1];
+
+#ifndef __MLIBC_ABI_ONLY
+
+#if __MLIBC_POSIX_OPTION
+__attribute__((__returns_twice__)) int sigsetjmp(sigjmp_buf buffer, int savesigs);
+__attribute__((__noreturn__)) void siglongjmp(sigjmp_buf buffer, int value);
+#endif // __MLIBC_POSIX_OPTION
+
+#endif /* !__MLIBC_ABI_ONLY */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _SETJMP_H
+