summaryrefslogtreecommitdiff
path: root/klibc/include/setjmp.h
diff options
context:
space:
mode:
authorgreg@kroah.com <greg@kroah.com>2004-10-05 18:51:53 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:37:02 -0700
commit60d1e263f0da2976938fa54efec88ab777a6b3c3 (patch)
tree94bfcc4279827a68f90f8b63c0d458ddc753c69b /klibc/include/setjmp.h
parenta0622777688ad84ef3d789e0171cfb0ca3dc21d2 (diff)
[PATCH] oops forgot to add the new klibc/include directory
Diffstat (limited to 'klibc/include/setjmp.h')
-rw-r--r--klibc/include/setjmp.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/klibc/include/setjmp.h b/klibc/include/setjmp.h
new file mode 100644
index 0000000000..b504eb6d08
--- /dev/null
+++ b/klibc/include/setjmp.h
@@ -0,0 +1,43 @@
+/*
+ * setjmp.h
+ */
+
+#ifndef _SETJMP_H
+#define _SETJMP_H
+
+#include <klibc/extern.h>
+#include <klibc/compiler.h>
+#include <stddef.h>
+#include <signal.h>
+
+#include <klibc/archsetjmp.h>
+
+__extern int setjmp(jmp_buf);
+__extern __noreturn longjmp(jmp_buf, int);
+
+/*
+ Whose bright idea was it to add unrelated functionality to just about
+ the only function in the standard C library (setjmp) which cannot be
+ wrapped by an ordinary function wrapper? Anyway, the damage is done,
+ and therefore, this wrapper *must* be inline. However, gcc will
+ complain if this is an inline function for unknown reason, and
+ therefore sigsetjmp() needs to be a macro.
+*/
+
+struct __sigjmp_buf {
+ jmp_buf __jmpbuf;
+ sigset_t __sigs;
+};
+
+typedef struct __sigjmp_buf sigjmp_buf[1];
+
+#define sigsetjmp(__env, __save) \
+({ \
+ struct __sigjmp_buf *__e = (__env); \
+ sigprocmask(0, NULL, &__e->__sigs); \
+ setjmp(__e->__jmpbuf); \
+})
+
+__extern __noreturn siglongjmp(sigjmp_buf, int);
+
+#endif /* _SETJMP_H */