]>
Commit | Line | Data |
---|---|---|
6796bc80 | 1 | #ifndef _SETJMP_H |
28f540f4 | 2 | #include <setjmp/setjmp.h> |
bdbf022d | 3 | |
31341567 | 4 | #ifndef _ISOMAC |
bdbf022d UD |
5 | /* Now define the internal interfaces. */ |
6 | ||
7 | /* Internal machine-dependent function to restore context sans signal mask. */ | |
aaa8d85c | 8 | extern void __longjmp (__jmp_buf __env, int __val) |
661462d5 | 9 | __attribute__ ((__noreturn__)) attribute_hidden; |
bdbf022d | 10 | |
94e6ba15 L |
11 | extern void ____longjmp_chk (__jmp_buf __env, int __val) |
12 | __attribute__ ((__noreturn__)) attribute_hidden; | |
13 | ||
bdbf022d UD |
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. */ | |
aaa8d85c | 18 | extern int __sigjmp_save (jmp_buf __env, int __savemask); |
48896b9d AJ |
19 | |
20 | extern void _longjmp_unwind (jmp_buf env, int val); | |
21 | ||
92d70263 | 22 | extern void __libc_siglongjmp (sigjmp_buf env, int val) |
31341567 | 23 | __attribute__ ((noreturn)); |
92d70263 UD |
24 | extern void __libc_longjmp (sigjmp_buf env, int val) |
25 | __attribute__ ((noreturn)); | |
784d802e | 26 | |
9b4289aa | 27 | libc_hidden_proto (_setjmp) |
cd2fbe58 | 28 | libc_hidden_proto (__sigsetjmp) |
661462d5 | 29 | |
3d1870fa | 30 | # if IS_IN (rtld) && !defined NO_RTLD_HIDDEN |
661462d5 L |
31 | extern __typeof (__sigsetjmp) __sigsetjmp attribute_hidden; |
32 | # endif | |
8cb5295d L |
33 | |
34 | /* Check jmp_buf sizes, alignments and offsets. */ | |
35 | # include <stddef.h> | |
36 | # include <jmp_buf-macros.h> | |
37 | ||
38 | # define STR_HELPER(x) #x | |
39 | # define STR(x) STR_HELPER(x) | |
40 | ||
41 | # define TEST_SIZE(type, size) \ | |
42 | _Static_assert (sizeof (type) == size, \ | |
43 | "size of " #type " != " \ | |
44 | STR (size)) | |
45 | # define TEST_ALIGN(type, align) \ | |
46 | _Static_assert (__alignof__ (type) == align , \ | |
47 | "align of " #type " != " \ | |
48 | STR (align)) | |
49 | # define TEST_OFFSET(type, member, offset) \ | |
50 | _Static_assert (offsetof (type, member) == offset, \ | |
51 | "offset of " #member " field of " #type " != " \ | |
52 | STR (offset)) | |
53 | ||
54 | /* Check if jmp_buf have the expected sizes. */ | |
55 | TEST_SIZE (jmp_buf, JMP_BUF_SIZE); | |
56 | TEST_SIZE (sigjmp_buf, SIGJMP_BUF_SIZE); | |
57 | ||
58 | /* Check if jmp_buf have the expected alignments. */ | |
59 | TEST_ALIGN (jmp_buf, JMP_BUF_ALIGN); | |
60 | TEST_ALIGN (sigjmp_buf, SIGJMP_BUF_ALIGN); | |
61 | ||
62 | /* Check if internal fields in jmp_buf have the expected offsets. */ | |
63 | TEST_OFFSET (struct __jmp_buf_tag, __mask_was_saved, | |
64 | MASK_WAS_SAVED_OFFSET); | |
65 | TEST_OFFSET (struct __jmp_buf_tag, __saved_mask, | |
66 | SAVED_MASK_OFFSET); | |
31341567 | 67 | #endif |
9b4289aa | 68 | |
6796bc80 | 69 | #endif |