]>
Commit | Line | Data |
---|---|---|
c1422e5b | 1 | /* Copyright (C) 1991,92,93,94,95,96,97,98,99 Free Software Foundation, Inc. |
ba1ffaa1 | 2 | This file is part of the GNU C Library. |
28f540f4 | 3 | |
ba1ffaa1 UD |
4 | The GNU C Library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public License as | |
6 | published by the Free Software Foundation; either version 2 of the | |
7 | License, or (at your option) any later version. | |
28f540f4 | 8 | |
ba1ffaa1 UD |
9 | The GNU C Library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Library General Public License for more details. | |
28f540f4 | 13 | |
ba1ffaa1 UD |
14 | You should have received a copy of the GNU Library General Public |
15 | License along with the GNU C Library; see the file COPYING.LIB. If not, | |
16 | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
17 | Boston, MA 02111-1307, USA. */ | |
28f540f4 RM |
18 | |
19 | /* | |
d1646309 | 20 | * ISO C99 Standard: 7.13 Nonlocal jumps <setjmp.h> |
28f540f4 RM |
21 | */ |
22 | ||
23 | #ifndef _SETJMP_H | |
28f540f4 | 24 | #define _SETJMP_H 1 |
5107cf1d | 25 | |
28f540f4 RM |
26 | #include <features.h> |
27 | ||
28 | __BEGIN_DECLS | |
29 | ||
5107cf1d UD |
30 | #include <bits/setjmp.h> /* Get `__jmp_buf'. */ |
31 | #include <bits/sigset.h> /* Get `__sigset_t'. */ | |
28f540f4 RM |
32 | |
33 | /* Calling environment, plus possibly a saved signal mask. */ | |
299a95b9 | 34 | typedef struct __jmp_buf_tag /* C++ doesn't like tagless structs. */ |
28f540f4 RM |
35 | { |
36 | /* NOTE: The machine-dependent definitions of `__sigsetjmp' | |
37 | assume that a `jmp_buf' begins with a `__jmp_buf'. | |
38 | Do not move this member or add others before it. */ | |
39 | __jmp_buf __jmpbuf; /* Calling environment. */ | |
40 | int __mask_was_saved; /* Saved the signal mask? */ | |
41 | __sigset_t __saved_mask; /* Saved signal mask. */ | |
42 | } jmp_buf[1]; | |
43 | ||
44 | ||
45 | /* Store the calling environment in ENV, also saving the | |
46 | signal mask if SAVEMASK is nonzero. Return 0. | |
47 | This is the internal name for `sigsetjmp'. */ | |
c1422e5b | 48 | extern int __sigsetjmp (jmp_buf __env, int __savemask) __THROW; |
28f540f4 RM |
49 | |
50 | #ifndef __FAVOR_BSD | |
51 | /* Set ENV to the current position and return 0, not saving the signal mask. | |
52 | This is just like `sigsetjmp (ENV, 0)'. | |
c57abfa7 | 53 | The ISO C standard says `setjmp' is a macro. */ |
f21acc89 | 54 | # define setjmp(env) __sigsetjmp ((env), 0) |
28f540f4 | 55 | #else |
dc825f85 | 56 | /* We are in 4.3 BSD-compatibility mode in which `setjmp' |
28f540f4 | 57 | saves the signal mask like `sigsetjmp (ENV, 1)'. */ |
f21acc89 | 58 | # define setjmp(env) __sigsetjmp ((env), 1) |
28f540f4 RM |
59 | #endif /* Favor BSD. */ |
60 | ||
f21acc89 | 61 | #if defined __USE_BSD || defined __USE_XOPEN |
28f540f4 | 62 | /* Set ENV to the current position and return 0, not saving the signal mask. |
c57abfa7 | 63 | This is the 4.3 BSD name for ISO `setjmp'. */ |
f21acc89 | 64 | # define _setjmp(env) __sigsetjmp ((env), 0) |
28f540f4 RM |
65 | #endif |
66 | ||
67 | ||
68 | /* Jump to the environment saved in ENV, making the | |
69 | `setjmp' call there return VAL, or 1 if VAL is 0. */ | |
c1422e5b UD |
70 | extern void longjmp (jmp_buf __env, int __val) |
71 | __THROW __attribute__ ((__noreturn__)); | |
f21acc89 | 72 | #if defined __USE_BSD || defined __USE_XOPEN |
28f540f4 RM |
73 | /* Same. Usually `_longjmp' is used with `_setjmp', which does not save |
74 | the signal mask. But it is how ENV was saved that determines whether | |
75 | `longjmp' restores the mask; `_longjmp' is just an alias. */ | |
c1422e5b UD |
76 | extern void _longjmp (jmp_buf __env, int __val) |
77 | __THROW __attribute__ ((__noreturn__)); | |
f21acc89 | 78 | #endif |
28f540f4 | 79 | |
28f540f4 RM |
80 | |
81 | #ifdef __USE_POSIX | |
82 | /* Use the same type for `jmp_buf' and `sigjmp_buf'. | |
83 | The `__mask_was_saved' flag determines whether | |
84 | or not `longjmp' will restore the signal mask. */ | |
85 | typedef jmp_buf sigjmp_buf; | |
86 | ||
87 | /* Store the calling environment in ENV, also saving the | |
88 | signal mask if SAVEMASK is nonzero. Return 0. */ | |
f21acc89 | 89 | # define sigsetjmp(env, savemask) __sigsetjmp ((env), (savemask)) |
28f540f4 RM |
90 | |
91 | /* Jump to the environment saved in ENV, making the | |
92 | sigsetjmp call there return VAL, or 1 if VAL is 0. | |
93 | Restore the signal mask if that sigsetjmp call saved it. | |
94 | This is just an alias `longjmp'. */ | |
c1422e5b UD |
95 | extern void siglongjmp (sigjmp_buf __env, int __val) |
96 | __THROW __attribute__ ((__noreturn__)); | |
28f540f4 RM |
97 | #endif /* Use POSIX. */ |
98 | ||
99 | __END_DECLS | |
100 | ||
101 | #endif /* setjmp.h */ |