1 /* 2 * Copyright 2004-2005, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _SETJMP_H_ 6 #define _SETJMP_H_ 7 8 #include <signal.h> 9 10 // include architecture specific definitions 11 #ifdef __INTEL__ 12 #include <arch/x86/arch_setjmp.h> 13 #elif __POWERPC__ 14 #include <arch/ppc/arch_setjmp.h> 15 #elif __M68K__ 16 #include <arch/m68k/arch_setjmp.h> 17 #else 18 #error #include <arch/<cpu>/arch_setjmp.h> 19 #endif 20 21 typedef struct __jmp_buf_tag { 22 __jmp_buf regs; /* saved registers, stack & program pointer */ 23 int mask_was_saved; 24 sigset_t saved_mask; 25 } jmp_buf[1]; 26 27 typedef jmp_buf sigjmp_buf; 28 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 extern int _setjmp(jmp_buf jumpBuffer); 35 extern int setjmp(jmp_buf jumpBuffer); 36 extern int sigsetjmp(jmp_buf jumpBuffer, int saveMask); 37 38 extern void _longjmp(jmp_buf jumpBuffer, int value); 39 extern void longjmp(jmp_buf jumpBuffer, int value); 40 extern void siglongjmp(sigjmp_buf jumpBuffer, int value); 41 42 #ifdef __cplusplus 43 } 44 #endif 45 46 #endif /* _SETJMP_H_ */ 47