Adding upstream version 3.31.
[syslinux-debian/hramrach.git] / com32 / include / setjmp.h
blobb504eb6d08c5c2197795278f9560b16d4f6f288e
1 /*
2 * setjmp.h
3 */
5 #ifndef _SETJMP_H
6 #define _SETJMP_H
8 #include <klibc/extern.h>
9 #include <klibc/compiler.h>
10 #include <stddef.h>
11 #include <signal.h>
13 #include <klibc/archsetjmp.h>
15 __extern int setjmp(jmp_buf);
16 __extern __noreturn longjmp(jmp_buf, int);
19 Whose bright idea was it to add unrelated functionality to just about
20 the only function in the standard C library (setjmp) which cannot be
21 wrapped by an ordinary function wrapper? Anyway, the damage is done,
22 and therefore, this wrapper *must* be inline. However, gcc will
23 complain if this is an inline function for unknown reason, and
24 therefore sigsetjmp() needs to be a macro.
27 struct __sigjmp_buf {
28 jmp_buf __jmpbuf;
29 sigset_t __sigs;
32 typedef struct __sigjmp_buf sigjmp_buf[1];
34 #define sigsetjmp(__env, __save) \
35 ({ \
36 struct __sigjmp_buf *__e = (__env); \
37 sigprocmask(0, NULL, &__e->__sigs); \
38 setjmp(__e->__jmpbuf); \
41 __extern __noreturn siglongjmp(sigjmp_buf, int);
43 #endif /* _SETJMP_H */