1 | #ifndef _SETJMP_H |
2 | #include <setjmp/setjmp.h> |
3 | |
4 | #ifndef _ISOMAC |
5 | /* Now define the internal interfaces. */ |
6 | |
7 | /* Internal machine-dependent function to restore context sans signal mask. */ |
8 | extern void __longjmp (__jmp_buf __env, int __val) |
9 | __attribute__ ((__noreturn__)) attribute_hidden; |
10 | |
11 | extern void ____longjmp_chk (__jmp_buf __env, int __val) |
12 | __attribute__ ((__noreturn__)) attribute_hidden; |
13 | |
14 | /* Internal function to possibly save the current mask of blocked signals |
15 | in ENV, and always set the flag saying whether or not it was saved. |
16 | This is used by the machine-dependent definition of `__sigsetjmp'. |
17 | Always returns zero, for convenience. */ |
18 | extern int __sigjmp_save (jmp_buf __env, int __savemask); |
19 | |
20 | extern void _longjmp_unwind (jmp_buf env, int val); |
21 | |
22 | extern void __libc_siglongjmp (sigjmp_buf env, int val) |
23 | __attribute__ ((noreturn)); |
24 | extern void __libc_longjmp (sigjmp_buf env, int val) |
25 | __attribute__ ((noreturn)); |
26 | libc_hidden_proto (__libc_longjmp) |
27 | |
28 | libc_hidden_proto (_setjmp) |
29 | libc_hidden_proto (__sigsetjmp) |
30 | |
31 | # if IS_IN (rtld) && !defined NO_RTLD_HIDDEN |
32 | extern __typeof (__sigsetjmp) __sigsetjmp attribute_hidden; |
33 | # endif |
34 | |
35 | /* Check jmp_buf sizes, alignments and offsets. */ |
36 | # include <stddef.h> |
37 | # include <jmp_buf-macros.h> |
38 | |
39 | # define STR_HELPER(x) #x |
40 | # define STR(x) STR_HELPER(x) |
41 | |
42 | # define TEST_SIZE(type, size) \ |
43 | _Static_assert (sizeof (type) == size, \ |
44 | "size of " #type " != " \ |
45 | STR (size)) |
46 | # define TEST_ALIGN(type, align) \ |
47 | _Static_assert (__alignof__ (type) == align , \ |
48 | "align of " #type " != " \ |
49 | STR (align)) |
50 | # define TEST_OFFSET(type, member, offset) \ |
51 | _Static_assert (offsetof (type, member) == offset, \ |
52 | "offset of " #member " field of " #type " != " \ |
53 | STR (offset)) |
54 | |
55 | /* Check if jmp_buf have the expected sizes. */ |
56 | TEST_SIZE (jmp_buf, JMP_BUF_SIZE); |
57 | TEST_SIZE (sigjmp_buf, SIGJMP_BUF_SIZE); |
58 | |
59 | /* Check if jmp_buf have the expected alignments. */ |
60 | TEST_ALIGN (jmp_buf, JMP_BUF_ALIGN); |
61 | TEST_ALIGN (sigjmp_buf, SIGJMP_BUF_ALIGN); |
62 | |
63 | /* Check if internal fields in jmp_buf have the expected offsets. */ |
64 | TEST_OFFSET (struct __jmp_buf_tag, __mask_was_saved, |
65 | MASK_WAS_SAVED_OFFSET); |
66 | TEST_OFFSET (struct __jmp_buf_tag, __saved_mask, |
67 | SAVED_MASK_OFFSET); |
68 | #endif |
69 | |
70 | #endif |
71 | |