5155 NIGHTLY_OPTIONS last argument should be unquoted
[illumos-gate.git] / usr / src / ucbhead / setjmp.h
bloba5d5a704786131dc1fdd5bc81f5028bd3a640d3f
1 /*
2 * CDDL HEADER START
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
7 * with the License.
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]
20 * CDDL HEADER END
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
33 * All Rights Reserved
35 * University Acknowledgment- Portions of this document are derived from
36 * software developed by the University of California, Berkeley, and its
37 * contributors.
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
47 #ifndef _SETJMP_H
48 #define _SETJMP_H
50 #include <sys/types.h>
51 #include <sys/signal.h>
52 #include <sys/ucontext.h>
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
59 * The sizes of the jump-buffer (_JBLEN) and the sigjump-buffer
60 * (_SIGJBLEN) are defined by the appropriate, processor specific, ABI.
62 #if defined(__amd64)
63 #define _JBLEN 128 /* must be the same as _SIGJBLEN for libucb */
64 #define _SIGJBLEN 128 /* ABI value */
65 #elif defined(__i386)
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 */
74 #else
75 #error "ISA not supported"
76 #endif
78 #if defined(__i386) || defined(__amd64) || \
79 defined(__sparc) || defined(__sparcv9)
81 #if !defined(_LP64) && defined(__cplusplus)
82 typedef int jmp_buf[_JBLEN];
83 #else
84 typedef long jmp_buf[_JBLEN];
85 #endif
87 #else
88 #error "ISA not supported"
89 #endif
91 #if defined(__i386) || defined(__amd64) || \
92 defined(__sparc) || defined(__sparcv9)
94 #if !defined(_LP64) && defined(__cplusplus)
95 typedef int sigjmp_buf[_SIGJBLEN];
96 #else
97 typedef long sigjmp_buf[_SIGJBLEN];
98 #endif
100 #else
101 #error "ISA not supported"
102 #endif
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;
119 #else
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__ */
131 #ifdef __cplusplus
133 #endif
135 #endif /* _SETJMP_H */