11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 *
24 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 /*
29 * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
30 * Copyright 2013 Saso Kiselkov. All rights reserved.
31 */
32
33 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
34 /* All Rights Reserved */
35
36 #ifndef _SYS_DEBUG_H
37 #define _SYS_DEBUG_H
38
39 #include <sys/isa_defs.h>
40 #include <sys/types.h>
41 #include <sys/note.h>
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46
47 /*
48 * ASSERT(ex) causes a panic or debugger entry if expression ex is not
49 * true. ASSERT() is included only for debugging, and is a no-op in
50 * production kernels. VERIFY(ex), on the other hand, behaves like
119 #define ASSERT3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t)
120 #define ASSERT3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t)
121 #define ASSERT3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t)
122 #define ASSERT0(x) VERIFY3_IMPL(x, ==, 0, uintmax_t)
123 #else
124 #define ASSERT3B(x, y, z) ((void)0)
125 #define ASSERT3S(x, y, z) ((void)0)
126 #define ASSERT3U(x, y, z) ((void)0)
127 #define ASSERT3P(x, y, z) ((void)0)
128 #define ASSERT0(x) ((void)0)
129 #endif
130
131 /*
132 * Compile-time assertion. The condition 'x' must be constant.
133 */
134 #define CTASSERT(x) _CTASSERT(x, __LINE__)
135 #define _CTASSERT(x, y) __CTASSERT(x, y)
136 #define __CTASSERT(x, y) \
137 typedef char __compile_time_assertion__ ## y [(x) ? 1 : -1] __unused
138
139 #ifdef _KERNEL
140
141 extern void abort_sequence_enter(char *);
142 extern void debug_enter(char *);
143
144 #endif /* _KERNEL */
145
146 #if defined(DEBUG) && !defined(__sun)
147 /* CSTYLED */
148 #define STATIC
149 #else
150 /* CSTYLED */
151 #define STATIC static
152 #endif
153
154 #ifdef __cplusplus
155 }
156 #endif
157
158 #endif /* _SYS_DEBUG_H */
|
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 *
24 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
25 * Use is subject to license terms.
26 */
27
28 /*
29 * Copyright (c) 2012, 2017 by Delphix. All rights reserved.
30 * Copyright 2013 Saso Kiselkov. All rights reserved.
31 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
32 */
33
34 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
35 /* All Rights Reserved */
36
37 #ifndef _SYS_DEBUG_H
38 #define _SYS_DEBUG_H
39
40 #include <sys/isa_defs.h>
41 #include <sys/types.h>
42 #include <sys/note.h>
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 /*
49 * ASSERT(ex) causes a panic or debugger entry if expression ex is not
50 * true. ASSERT() is included only for debugging, and is a no-op in
51 * production kernels. VERIFY(ex), on the other hand, behaves like
120 #define ASSERT3S(x, y, z) VERIFY3_IMPL(x, y, z, int64_t)
121 #define ASSERT3U(x, y, z) VERIFY3_IMPL(x, y, z, uint64_t)
122 #define ASSERT3P(x, y, z) VERIFY3_IMPL(x, y, z, uintptr_t)
123 #define ASSERT0(x) VERIFY3_IMPL(x, ==, 0, uintmax_t)
124 #else
125 #define ASSERT3B(x, y, z) ((void)0)
126 #define ASSERT3S(x, y, z) ((void)0)
127 #define ASSERT3U(x, y, z) ((void)0)
128 #define ASSERT3P(x, y, z) ((void)0)
129 #define ASSERT0(x) ((void)0)
130 #endif
131
132 /*
133 * Compile-time assertion. The condition 'x' must be constant.
134 */
135 #define CTASSERT(x) _CTASSERT(x, __LINE__)
136 #define _CTASSERT(x, y) __CTASSERT(x, y)
137 #define __CTASSERT(x, y) \
138 typedef char __compile_time_assertion__ ## y [(x) ? 1 : -1] __unused
139
140 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
141
142 extern void abort_sequence_enter(char *);
143 extern void debug_enter(char *);
144
145 #endif /* _KERNEL || _FAKE_KERNEL */
146
147 #if defined(DEBUG) && !defined(__sun)
148 /* CSTYLED */
149 #define STATIC
150 #else
151 /* CSTYLED */
152 #define STATIC static
153 #endif
154
155 #ifdef __cplusplus
156 }
157 #endif
158
159 #endif /* _SYS_DEBUG_H */
|