xref: /haiku/headers/posix/setjmp.h (revision 2c69b5b6c0e7b481a0c43366a1942a6055cbb864)
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 #elif __MIPSEL__
18 	#include <arch/mipsel/arch_setjmp.h>
19 #elif __ARM__
20 	#include <arch/arm/arch_setjmp.h>
21 #else
22 	#error #include <arch/<cpu>/arch_setjmp.h>
23 #endif
24 
25 typedef struct __jmp_buf_tag {
26 	__jmp_buf	regs;		/* saved registers, stack & program pointer */
27 	int			mask_was_saved;
28 	sigset_t	saved_mask;
29 } jmp_buf[1];
30 
31 typedef jmp_buf sigjmp_buf;
32 
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 extern int	_setjmp(jmp_buf jumpBuffer);
39 extern int	setjmp(jmp_buf jumpBuffer);
40 extern int	sigsetjmp(jmp_buf jumpBuffer, int saveMask);
41 
42 extern void	_longjmp(jmp_buf jumpBuffer, int value);
43 extern void	longjmp(jmp_buf jumpBuffer, int value);
44 extern void	siglongjmp(sigjmp_buf jumpBuffer, int value);
45 
46 #ifdef __cplusplus
47 }
48 #endif
49 
50 #endif /* _SETJMP_H_ */
51