1 /* 2 ** Distributed under the terms of the Haiku License. 3 */ 4 #ifndef _SETJMP_H_ 5 #define _SETJMP_H_ 6 7 8 #include <signal.h> 9 10 11 typedef struct __jmp_buf { 12 int regs[6]; /* saved registers, stack & program pointer */ 13 int mask_was_saved; 14 sigset_t saved_mask; 15 } jmp_buf[1]; 16 17 typedef jmp_buf sigjmp_buf; 18 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 extern int _setjmp(jmp_buf jumpBuffer); 25 extern int setjmp(jmp_buf jumpBuffer); 26 extern int sigsetjmp(jmp_buf jumpBuffer, int saveMask); 27 28 extern void _longjmp(jmp_buf jumpBuffer, int value); 29 extern void longjmp(jmp_buf jumpBuffer, int value); 30 extern void siglongjmp(sigjmp_buf jumpBuffer, int value); 31 32 // ToDo: this is a temporary workaround for a bug in BeOS 33 // (it exports setjmp/sigsetjmp functions that do not work) 34 #ifdef COMPILE_FOR_R5 35 # define setjmp(buffer) __sigsetjmp((buffer), 0) 36 # define sigsetjmp(buffer, mask) __sigsetjmp((buffer), (mask)) 37 extern int __sigsetjmp(jmp_buf buffer, int saveMask); 38 #endif 39 40 #ifdef __cplusplus 41 } 42 #endif 43 44 #endif /* _SETJMP_H_ */ 45