April 2024 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 |
001: /* Copyright (C) 1991-1999,2001,2002,2007,2009,2011 Free Software Foundation, Inc. 002: This file is part of the GNU C Library. 003: 004: The GNU C Library is free software; you can redistribute it and/or 005: modify it under the terms of the GNU Lesser General Public 006: License as published by the Free Software Foundation; either 007: version 2.1 of the License, or (at your option) any later version. 008: 009: The GNU C Library is distributed in the hope that it will be useful, 010: but WITHOUT ANY WARRANTY; without even the implied warranty of 011: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012: Lesser General Public License for more details. 013: 014: You should have received a copy of the GNU Lesser General Public 015: License along with the GNU C Library; if not, write to the Free 016: Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 017: 02111-1307 USA. */ 018: 019: /* 020: * ISO C99 Standard: 7.13 Nonlocal jumps <setjmp.h> 021: */ 022: 023: #ifndef _SETJMP_H 024: #define _SETJMP_H 1 025: 026: #include <features.h> 027: 028: __BEGIN_DECLS 029: 030: #include <bits/setjmp.h> /* Get `__jmp_buf'. */ 031: #include <bits/sigset.h> /* Get `__sigset_t'. */ 032: 033: 034: /* Calling environment, plus possibly a saved signal mask. */ 035: struct __jmp_buf_tag 036: { 037: /* NOTE: The machine-dependent definitions of `__sigsetjmp' 038: assume that a `jmp_buf' begins with a `__jmp_buf' and that 039: `__mask_was_saved' follows it. Do not move these members 040: or add others before it. */ 041: __jmp_buf __jmpbuf; /* Calling environment. */ 042: int __mask_was_saved; /* Saved the signal mask? */ 043: __sigset_t __saved_mask; /* Saved signal mask. */ 044: }; 045: 046: 047: __BEGIN_NAMESPACE_STD 048: 049: typedef struct __jmp_buf_tag jmp_buf[1]; 050: 051: /* Store the calling environment in ENV, also saving the signal mask. 052: Return 0. */ 053: extern int setjmp (jmp_buf __env) __THROWNL; 054: 055: __END_NAMESPACE_STD 056: 057: /* Store the calling environment in ENV, also saving the 058: signal mask if SAVEMASK is nonzero. Return 0. 059: This is the internal name for `sigsetjmp'. */ 060: extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROWNL; 061: 062: #ifndef __FAVOR_BSD 063: /* Store the calling environment in ENV, not saving the signal mask. 064: Return 0. */ 065: extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL; 066: 067: /* Do not save the signal mask. This is equivalent to the `_setjmp' 068: BSD function. */ 069: # define setjmp(env) _setjmp (env) 070: #else 071: /* We are in 4.3 BSD-compatibility mode in which `setjmp' 072: saves the signal mask like `sigsetjmp (ENV, 1)'. We have to 073: define a macro since ISO C says `setjmp' is one. */ 074: # define setjmp(env) setjmp (env) 075: #endif /* Favor BSD. */ 076: 077: 078: __BEGIN_NAMESPACE_STD 079: 080: /* Jump to the environment saved in ENV, making the 081: `setjmp' call there return VAL, or 1 if VAL is 0. */ 082: extern void longjmp (struct __jmp_buf_tag __env[1], int __val) 083: __THROWNL __attribute__ ((__noreturn__)); 084: 085: __END_NAMESPACE_STD 086: 087: #if defined __USE_BSD || defined __USE_XOPEN 088: /* Same. Usually `_longjmp' is used with `_setjmp', which does not save 089: the signal mask. But it is how ENV was saved that determines whether 090: `longjmp' restores the mask; `_longjmp' is just an alias. */ 091: extern void _longjmp (struct __jmp_buf_tag __env[1], int __val) 092: __THROWNL __attribute__ ((__noreturn__)); 093: #endif 094: 095: 096: #ifdef __USE_POSIX 097: /* Use the same type for `jmp_buf' and `sigjmp_buf'. 098: The `__mask_was_saved' flag determines whether 099: or not `longjmp' will restore the signal mask. */ 100: typedef struct __jmp_buf_tag sigjmp_buf[1]; 101: 102: /* Store the calling environment in ENV, also saving the 103: signal mask if SAVEMASK is nonzero. Return 0. */ 104: # define sigsetjmp(env, savemask) __sigsetjmp (env, savemask) 105: 106: /* Jump to the environment saved in ENV, making the 107: sigsetjmp call there return VAL, or 1 if VAL is 0. 108: Restore the signal mask if that sigsetjmp call saved it. 109: This is just an alias `longjmp'. */ 110: extern void siglongjmp (sigjmp_buf __env, int __val) 111: __THROWNL __attribute__ ((__noreturn__)); 112: #endif /* Use POSIX. */ 113: 114: 115: /* Define helper functions to catch unsafe code. */ 116: #if __USE_FORTIFY_LEVEL > 0 117: # include <bits/setjmp2.h> 118: #endif 119: 120: __END_DECLS 121: 122: #endif /* setjmp.h */ 123: