5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2012 by Delphix. All rights reserved.
24 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 #include <sys/param.h>
28 #include <sys/types.h>
29 #include <sys/varargs.h>
30 #include <sys/systm.h>
31 #include <sys/cmn_err.h>
32 #include <sys/log.h>
33
34 #include <fakekernel.h>
35
36 void abort(void) __NORETURN;
37
38 char *volatile panicstr;
39 va_list panicargs;
40 char panicbuf[512];
41
42 volatile int aok;
43
44 static const int
106 {
107 va_list tmpargs;
108
109 panicstr = (char *)fmt;
110 va_copy(panicargs, adx);
111
112 va_copy(tmpargs, adx);
113 fakekernel_cprintf(fmt, tmpargs, SL_FATAL, "fatal: ", "\n");
114
115 /* Call libc`assfail() so that mdb ::status works */
116 (void) vsnprintf(panicbuf, sizeof (panicbuf), fmt, adx);
117 assfail(panicbuf, "(panic)", 0);
118
119 abort(); /* avoid "noreturn" warnings */
120 }
121
122 void
123 panic(const char *fmt, ...)
124 {
125 va_list adx;
126
127 va_start(adx, fmt);
128 vpanic(fmt, adx);
129 va_end(adx);
130 }
131
132 void
133 vcmn_err(int ce, const char *fmt, va_list adx)
134 {
135
136 if (ce == CE_PANIC)
137 vpanic(fmt, adx);
138 if (ce >= CE_IGNORE)
139 return;
140
141 fakekernel_cprintf(fmt, adx, ce_flags[ce] | SL_CONSOLE,
142 ce_prefix[ce], ce_suffix[ce]);
143 }
144
145 /*PRINTFLIKE2*/
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright (c) 2012 by Delphix. All rights reserved.
24 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
25 * Copyright 2017 RackTop Systems.
26 */
27
28 #include <sys/param.h>
29 #include <sys/types.h>
30 #include <sys/varargs.h>
31 #include <sys/systm.h>
32 #include <sys/cmn_err.h>
33 #include <sys/log.h>
34
35 #include <fakekernel.h>
36
37 void abort(void) __NORETURN;
38
39 char *volatile panicstr;
40 va_list panicargs;
41 char panicbuf[512];
42
43 volatile int aok;
44
45 static const int
107 {
108 va_list tmpargs;
109
110 panicstr = (char *)fmt;
111 va_copy(panicargs, adx);
112
113 va_copy(tmpargs, adx);
114 fakekernel_cprintf(fmt, tmpargs, SL_FATAL, "fatal: ", "\n");
115
116 /* Call libc`assfail() so that mdb ::status works */
117 (void) vsnprintf(panicbuf, sizeof (panicbuf), fmt, adx);
118 assfail(panicbuf, "(panic)", 0);
119
120 abort(); /* avoid "noreturn" warnings */
121 }
122
123 void
124 panic(const char *fmt, ...)
125 {
126 va_list adx;
127
128 va_start(adx, fmt);
129 vpanic(fmt, adx);
130 va_end(adx);
131 }
132
133 void
134 fm_panic(const char *fmt, ...)
135 {
136 va_list adx;
137
138 va_start(adx, fmt);
139 vpanic(fmt, adx);
140 va_end(adx);
141 }
142
143 void
144 vcmn_err(int ce, const char *fmt, va_list adx)
145 {
146
147 if (ce == CE_PANIC)
148 vpanic(fmt, adx);
149 if (ce >= CE_IGNORE)
150 return;
151
152 fakekernel_cprintf(fmt, adx, ce_flags[ce] | SL_CONSOLE,
153 ce_prefix[ce], ce_suffix[ce]);
154 }
155
156 /*PRINTFLIKE2*/
|