xref: /haiku/headers/posix/setjmp.h (revision 679518f417b85aa6bea3407877f36cbb1414beb2)
1b5c6c8b6SAxel Dörfler /*
2*679518f4SJérôme Duval  * Copyright 2004-2018 Haiku, Inc.
3d2f25ec7SAxel Dörfler  * Distributed under the terms of the MIT License.
4b5c6c8b6SAxel Dörfler  */
5b5c6c8b6SAxel Dörfler #ifndef _SETJMP_H_
6b5c6c8b6SAxel Dörfler #define _SETJMP_H_
7b5c6c8b6SAxel Dörfler 
82222d055SIngo Weinhold 
92222d055SIngo Weinhold #include <config/HaikuConfig.h>
102222d055SIngo Weinhold 
11b5c6c8b6SAxel Dörfler #include <signal.h>
12b5c6c8b6SAxel Dörfler 
13b9320128SIngo Weinhold /* include architecture specific definitions */
142222d055SIngo Weinhold #include __HAIKU_ARCH_HEADER(arch_setjmp.h)
15b5c6c8b6SAxel Dörfler 
16fe14a904SIngo Weinhold typedef struct __jmp_buf_tag {
17fe14a904SIngo Weinhold 	__jmp_buf	regs;		/* saved registers, stack & program pointer */
1824df6592SIngo Weinhold 	sigset_t	inverted_signal_mask;
19b5c6c8b6SAxel Dörfler } jmp_buf[1];
20b5c6c8b6SAxel Dörfler 
21b5c6c8b6SAxel Dörfler typedef jmp_buf sigjmp_buf;
22b5c6c8b6SAxel Dörfler 
23b5c6c8b6SAxel Dörfler 
24b5c6c8b6SAxel Dörfler #ifdef __cplusplus
25b5c6c8b6SAxel Dörfler extern "C" {
26b5c6c8b6SAxel Dörfler #endif
27b5c6c8b6SAxel Dörfler 
28b5c6c8b6SAxel Dörfler extern int	_setjmp(jmp_buf jumpBuffer);
29b5c6c8b6SAxel Dörfler extern int	setjmp(jmp_buf jumpBuffer);
30b5c6c8b6SAxel Dörfler extern int	sigsetjmp(jmp_buf jumpBuffer, int saveMask);
31b5c6c8b6SAxel Dörfler 
32*679518f4SJérôme Duval extern void	_longjmp(jmp_buf jumpBuffer, int value)
33*679518f4SJérôme Duval 	__attribute__ ((noreturn));
34*679518f4SJérôme Duval extern void	longjmp(jmp_buf jumpBuffer, int value)
35*679518f4SJérôme Duval 	__attribute__ ((noreturn));
36*679518f4SJérôme Duval extern void	siglongjmp(sigjmp_buf jumpBuffer, int value)
37*679518f4SJérôme Duval 	__attribute__ ((noreturn));
38b5c6c8b6SAxel Dörfler 
39b5c6c8b6SAxel Dörfler #ifdef __cplusplus
40b5c6c8b6SAxel Dörfler }
41b5c6c8b6SAxel Dörfler #endif
42b5c6c8b6SAxel Dörfler 
43b5c6c8b6SAxel Dörfler #endif /* _SETJMP_H_ */
44