4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 * University Copyright- Copyright (c) 1982, 1986, 1988
32 * The Regents of the University of California
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
41 * 4.3BSD setjmp compatibility header
43 * 4.3BSD setjmp/longjmp is equivalent to SVR4 sigsetjmp/siglongjmp -
44 * 4.3BSD _setjmp/_longjmp is equivalent to SVR4 setjmp/longjmp
50 #include <sys/types.h>
51 #include <sys/signal.h>
52 #include <sys/ucontext.h>
59 * The sizes of the jump-buffer (_JBLEN) and the sigjump-buffer
60 * (_SIGJBLEN) are defined by the appropriate, processor specific, ABI.
63 #define _JBLEN 128 /* must be the same as _SIGJBLEN for libucb */
64 #define _SIGJBLEN 128 /* ABI value */
66 #define _JBLEN 128 /* must be the same as _SIGJBLEN for libucb */
67 #define _SIGJBLEN 128 /* ABI value */
68 #elif defined(__sparcv9)
69 #define _JBLEN 19 /* ABI value */
70 #define _SIGJBLEN 19 /* ABI value */
71 #elif defined(__sparc)
72 #define _JBLEN 19 /* _SIGJBLEN */
73 #define _SIGJBLEN 19 /* ABI value */
75 #error "ISA not supported"
78 #if defined(__i386) || defined(__amd64) || \
79 defined(__sparc) || defined(__sparcv9)
81 #if !defined(_LP64) && defined(__cplusplus)
82 typedef int jmp_buf[_JBLEN
];
84 typedef long jmp_buf[_JBLEN
];
88 #error "ISA not supported"
91 #if defined(__i386) || defined(__amd64) || \
92 defined(__sparc) || defined(__sparcv9)
94 #if !defined(_LP64) && defined(__cplusplus)
95 typedef int sigjmp_buf
[_SIGJBLEN
];
97 typedef long sigjmp_buf
[_SIGJBLEN
];
101 #error "ISA not supported"
104 #define setjmp(env) _sigsetjmp((env), 1)
105 #define longjmp(env, val) _siglongjmp((env), (val))
106 #define _setjmp(env) _sigsetjmp((env), 0)
107 #define _longjmp(env, val) _siglongjmp((env), (val))
109 #if defined(__STDC__)
111 extern int _sigsetjmp(sigjmp_buf
, int) __RETURNS_TWICE
;
112 #pragma unknown_control_flow(_sigsetjmp)
113 extern void _siglongjmp(sigjmp_buf
, int) __NORETURN
;
115 extern int sigsetjmp(sigjmp_buf
, int) __RETURNS_TWICE
;
116 #pragma unknown_control_flow(sigsetjmp)
117 extern void siglongjmp(sigjmp_buf
, int) __NORETURN
;
121 extern int _sigsetjmp() __RETURNS_TWICE
;
122 #pragma unknown_control_flow(_sigsetjmp)
123 extern void _siglongjmp();
125 extern int sigsetjmp() __RETURNS_TWICE
;
126 #pragma unknown_control_flow(sigsetjmp)
127 extern void siglongjmp();
129 #endif /* __STDC__ */
135 #endif /* _SETJMP_H */