1
/* $Id: setjmp.h 3553 2011-05-05 06:14:19Z nanang $ */
3
* Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
#ifndef __PJ_COMPAT_SETJMP_H__
21
#define __PJ_COMPAT_SETJMP_H__
25
* @brief Provides setjmp.h functionality.
28
#if defined(PJ_HAS_SETJMP_H) && PJ_HAS_SETJMP_H != 0
30
typedef jmp_buf pj_jmp_buf;
32
# define pj_setjmp(buf) setjmp(buf)
35
# define pj_longjmp(buf,d) longjmp(buf,d)
38
#elif defined(PJ_LINUX_KERNEL) && PJ_LINUX_KERNEL != 0 && \
39
defined(PJ_M_I386) && PJ_M_I386 != 0
42
* These are taken from uClibc.
43
* Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
45
# if defined __USE_MISC || defined _ASM
56
typedef int __jmp_buf[6];
58
/* A `sigset_t' has a bit for each signal. */
59
# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
60
typedef struct __sigset_t_tag
62
unsigned long int __val[_SIGSET_NWORDS];
65
/* Calling environment, plus possibly a saved signal mask. */
66
typedef struct __jmp_buf_tag /* C++ doesn't like tagless structs. */
68
/* NOTE: The machine-dependent definitions of `__sigsetjmp'
69
assume that a `jmp_buf' begins with a `__jmp_buf' and that
70
`__mask_was_saved' follows it. Do not move these members
71
or add others before it. */
72
__jmp_buf __jmpbuf; /* Calling environment. */
73
int __mask_was_saved; /* Saved the signal mask? */
74
// we never saved the mask.
75
__sigset_t __saved_mask; /* Saved signal mask. */
78
typedef jmp_buf sigjmp_buf;
79
typedef jmp_buf pj_jmp_buf;
81
PJ_DECL(int) pj_setjmp(pj_jmp_buf env);
82
PJ_DECL(void) pj_longjmp(pj_jmp_buf env, int val) __attribute__((noreturn));
86
#elif defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0
87
/* Symbian framework don't use setjmp/longjmp */
90
# warning "setjmp()/longjmp() is not implemented"
91
typedef int pj_jmp_buf[1];
92
# define pj_setjmp(buf) 0
93
# define pj_longjmp(buf,d) 0
97
#endif /* __PJ_COMPAT_SETJMP_H__ */