Blame setjmp/setjmp.h

Packit 6c4009
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 *	ISO C99 Standard: 7.13 Nonlocal jumps	<setjmp.h>
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#ifndef	_SETJMP_H
Packit 6c4009
#define	_SETJMP_H	1
Packit 6c4009
Packit 6c4009
#include <features.h>
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
#include <bits/setjmp.h>		/* Get `__jmp_buf'.  */
Packit 6c4009
#include <bits/types/__sigset_t.h>
Packit 6c4009
Packit 6c4009
/* Calling environment, plus possibly a saved signal mask.  */
Packit 6c4009
struct __jmp_buf_tag
Packit 6c4009
  {
Packit 6c4009
    /* NOTE: The machine-dependent definitions of `__sigsetjmp'
Packit 6c4009
       assume that a `jmp_buf' begins with a `__jmp_buf' and that
Packit 6c4009
       `__mask_was_saved' follows it.  Do not move these members
Packit 6c4009
       or add others before it.  */
Packit 6c4009
    __jmp_buf __jmpbuf;		/* Calling environment.  */
Packit 6c4009
    int __mask_was_saved;	/* Saved the signal mask?  */
Packit 6c4009
    __sigset_t __saved_mask;	/* Saved signal mask.  */
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
Packit 6c4009
typedef struct __jmp_buf_tag jmp_buf[1];
Packit 6c4009
Packit 6c4009
/* Store the calling environment in ENV, also saving the signal mask.
Packit 6c4009
   Return 0.  */
Packit 6c4009
extern int setjmp (jmp_buf __env) __THROWNL;
Packit 6c4009
Packit 6c4009
/* Store the calling environment in ENV, also saving the
Packit 6c4009
   signal mask if SAVEMASK is nonzero.  Return 0.
Packit 6c4009
   This is the internal name for `sigsetjmp'.  */
Packit 6c4009
extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROWNL;
Packit 6c4009
Packit 6c4009
/* Store the calling environment in ENV, not saving the signal mask.
Packit 6c4009
   Return 0.  */
Packit 6c4009
extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL;
Packit 6c4009
Packit 6c4009
/* Do not save the signal mask.  This is equivalent to the `_setjmp'
Packit 6c4009
   BSD function.  */
Packit 6c4009
#define setjmp(env)	_setjmp (env)
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Jump to the environment saved in ENV, making the
Packit 6c4009
   `setjmp' call there return VAL, or 1 if VAL is 0.  */
Packit 6c4009
extern void longjmp (struct __jmp_buf_tag __env[1], int __val)
Packit 6c4009
     __THROWNL __attribute__ ((__noreturn__));
Packit 6c4009
Packit 6c4009
#if defined __USE_MISC || defined __USE_XOPEN
Packit 6c4009
/* Same.  Usually `_longjmp' is used with `_setjmp', which does not save
Packit 6c4009
   the signal mask.  But it is how ENV was saved that determines whether
Packit 6c4009
   `longjmp' restores the mask; `_longjmp' is just an alias.  */
Packit 6c4009
extern void _longjmp (struct __jmp_buf_tag __env[1], int __val)
Packit 6c4009
     __THROWNL __attribute__ ((__noreturn__));
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
Packit 6c4009
#ifdef	__USE_POSIX
Packit 6c4009
/* Use the same type for `jmp_buf' and `sigjmp_buf'.
Packit 6c4009
   The `__mask_was_saved' flag determines whether
Packit 6c4009
   or not `longjmp' will restore the signal mask.  */
Packit 6c4009
typedef struct __jmp_buf_tag sigjmp_buf[1];
Packit 6c4009
Packit 6c4009
/* Store the calling environment in ENV, also saving the
Packit 6c4009
   signal mask if SAVEMASK is nonzero.  Return 0.  */
Packit 6c4009
# define sigsetjmp(env, savemask)	__sigsetjmp (env, savemask)
Packit 6c4009
Packit 6c4009
/* Jump to the environment saved in ENV, making the
Packit 6c4009
   sigsetjmp call there return VAL, or 1 if VAL is 0.
Packit 6c4009
   Restore the signal mask if that sigsetjmp call saved it.
Packit 6c4009
   This is just an alias `longjmp'.  */
Packit 6c4009
extern void siglongjmp (sigjmp_buf __env, int __val)
Packit 6c4009
     __THROWNL __attribute__ ((__noreturn__));
Packit 6c4009
#endif /* Use POSIX.  */
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Define helper functions to catch unsafe code.  */
Packit 6c4009
#if __USE_FORTIFY_LEVEL > 0
Packit 6c4009
# include <bits/setjmp2.h>
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* setjmp.h  */