xref: /titanic_50/usr/src/uts/common/os/printf.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate #include <sys/param.h>
30*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
31*7c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h>
32*7c478bd9Sstevel@tonic-gate #include <sys/inline.h>
33*7c478bd9Sstevel@tonic-gate #include <sys/varargs.h>
34*7c478bd9Sstevel@tonic-gate #include <sys/systm.h>
35*7c478bd9Sstevel@tonic-gate #include <sys/conf.h>
36*7c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h>
37*7c478bd9Sstevel@tonic-gate #include <sys/syslog.h>
38*7c478bd9Sstevel@tonic-gate #include <sys/log.h>
39*7c478bd9Sstevel@tonic-gate #include <sys/proc.h>
40*7c478bd9Sstevel@tonic-gate #include <sys/vnode.h>
41*7c478bd9Sstevel@tonic-gate #include <sys/session.h>
42*7c478bd9Sstevel@tonic-gate #include <sys/stream.h>
43*7c478bd9Sstevel@tonic-gate #include <sys/kmem.h>
44*7c478bd9Sstevel@tonic-gate #include <sys/kobj.h>
45*7c478bd9Sstevel@tonic-gate #include <sys/atomic.h>
46*7c478bd9Sstevel@tonic-gate #include <sys/console.h>
47*7c478bd9Sstevel@tonic-gate #include <sys/cpuvar.h>
48*7c478bd9Sstevel@tonic-gate #include <sys/modctl.h>
49*7c478bd9Sstevel@tonic-gate #include <sys/reboot.h>
50*7c478bd9Sstevel@tonic-gate #include <sys/debug.h>
51*7c478bd9Sstevel@tonic-gate #include <sys/panic.h>
52*7c478bd9Sstevel@tonic-gate #include <sys/spl.h>
53*7c478bd9Sstevel@tonic-gate #include <sys/zone.h>
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate /*
56*7c478bd9Sstevel@tonic-gate  * In some debugging situations it's useful to log all messages to panicbuf,
57*7c478bd9Sstevel@tonic-gate  * which is persistent across reboots (on most platforms).  The range
58*7c478bd9Sstevel@tonic-gate  * panicbuf[panicbuf_log..PANICBUFSIZE-1] may be used for this purpose.
59*7c478bd9Sstevel@tonic-gate  * By default, panicbuf_log == PANICBUFSIZE and no messages are logged.
60*7c478bd9Sstevel@tonic-gate  * To enable panicbuf logging, set panicbuf_log to a small value, say 1K;
61*7c478bd9Sstevel@tonic-gate  * this will reserve 1K for panic information and 7K for message logging.
62*7c478bd9Sstevel@tonic-gate  */
63*7c478bd9Sstevel@tonic-gate uint32_t panicbuf_log = PANICBUFSIZE;
64*7c478bd9Sstevel@tonic-gate uint32_t panicbuf_index = PANICBUFSIZE;
65*7c478bd9Sstevel@tonic-gate 
66*7c478bd9Sstevel@tonic-gate static int aask, aok;
67*7c478bd9Sstevel@tonic-gate static int ce_to_sl[CE_IGNORE] = { SL_NOTE, SL_NOTE, SL_WARN, SL_FATAL };
68*7c478bd9Sstevel@tonic-gate static char ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" };
69*7c478bd9Sstevel@tonic-gate static char ce_suffix[CE_IGNORE][2] = { "", "\n", "\n", "" };
70*7c478bd9Sstevel@tonic-gate 
71*7c478bd9Sstevel@tonic-gate static void
72*7c478bd9Sstevel@tonic-gate cprintf(const char *fmt, va_list adx, int sl, const char *prefix,
73*7c478bd9Sstevel@tonic-gate 	const char *suffix, void *site, int mid, int sid, int level,
74*7c478bd9Sstevel@tonic-gate 	zoneid_t zoneid)
75*7c478bd9Sstevel@tonic-gate {
76*7c478bd9Sstevel@tonic-gate 	uint32_t msgid;
77*7c478bd9Sstevel@tonic-gate 	size_t bufsize = LOG_MSGSIZE;
78*7c478bd9Sstevel@tonic-gate 	char buf[LOG_MSGSIZE];
79*7c478bd9Sstevel@tonic-gate 	char *bufp = buf;
80*7c478bd9Sstevel@tonic-gate 	char *body, *msgp, *bufend;
81*7c478bd9Sstevel@tonic-gate 	mblk_t *mp;
82*7c478bd9Sstevel@tonic-gate 	int s, on_intr;
83*7c478bd9Sstevel@tonic-gate 	size_t len;
84*7c478bd9Sstevel@tonic-gate 
85*7c478bd9Sstevel@tonic-gate 	s = splhi();
86*7c478bd9Sstevel@tonic-gate 	on_intr = CPU_ON_INTR(CPU) ||
87*7c478bd9Sstevel@tonic-gate 	    (interrupts_unleashed && (spltoipl(s) > LOCK_LEVEL));
88*7c478bd9Sstevel@tonic-gate 	splx(s);
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate 	ASSERT(zoneid == GLOBAL_ZONEID || !on_intr);
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate 	STRLOG_MAKE_MSGID(fmt, msgid);
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate 	if (strchr("^!?", fmt[0]) != NULL) {
95*7c478bd9Sstevel@tonic-gate 		if (fmt[0] == '^')
96*7c478bd9Sstevel@tonic-gate 			sl |= SL_CONSONLY;
97*7c478bd9Sstevel@tonic-gate 		else if (fmt[0] == '!' ||
98*7c478bd9Sstevel@tonic-gate 		    (prefix[0] == '\0' && !(boothowto & RB_VERBOSE)))
99*7c478bd9Sstevel@tonic-gate 			sl = (sl & ~(SL_USER | SL_NOTE)) | SL_LOGONLY;
100*7c478bd9Sstevel@tonic-gate 		fmt++;
101*7c478bd9Sstevel@tonic-gate 	}
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate 	if ((sl & SL_USER) && (MUTEX_HELD(&pidlock) || on_intr)) {
104*7c478bd9Sstevel@tonic-gate 		zoneid = getzoneid();
105*7c478bd9Sstevel@tonic-gate 		sl = sl & ~(SL_USER | SL_LOGONLY) | SL_CONSOLE;
106*7c478bd9Sstevel@tonic-gate 	}
107*7c478bd9Sstevel@tonic-gate 
108*7c478bd9Sstevel@tonic-gate retry:
109*7c478bd9Sstevel@tonic-gate 	bufend = bufp + bufsize;
110*7c478bd9Sstevel@tonic-gate 	msgp = bufp;
111*7c478bd9Sstevel@tonic-gate 	body = msgp += snprintf(msgp, bufend - msgp,
112*7c478bd9Sstevel@tonic-gate 	    "%s: [ID %u FACILITY_AND_PRIORITY] ",
113*7c478bd9Sstevel@tonic-gate 	    mod_containing_pc(site), msgid);
114*7c478bd9Sstevel@tonic-gate 	msgp += snprintf(msgp, bufend - msgp, prefix);
115*7c478bd9Sstevel@tonic-gate 	msgp += vsnprintf(msgp, bufend - msgp, fmt, adx);
116*7c478bd9Sstevel@tonic-gate 	msgp += snprintf(msgp, bufend - msgp, suffix);
117*7c478bd9Sstevel@tonic-gate 	len = strlen(body);
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate 	if (((sl & SL_CONSONLY) && panicstr) ||
120*7c478bd9Sstevel@tonic-gate 	    (zoneid == GLOBAL_ZONEID && log_global.lz_active == 0)) {
121*7c478bd9Sstevel@tonic-gate 		console_printf("%s", body);
122*7c478bd9Sstevel@tonic-gate 		goto out;
123*7c478bd9Sstevel@tonic-gate 	}
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate 	if (msgp - bufp >= bufsize && !on_intr) {
126*7c478bd9Sstevel@tonic-gate 		ASSERT(bufp == buf);
127*7c478bd9Sstevel@tonic-gate 		bufsize = msgp - bufp + 1;
128*7c478bd9Sstevel@tonic-gate 		bufp = kmem_alloc(bufsize, KM_NOSLEEP);
129*7c478bd9Sstevel@tonic-gate 		if (bufp != NULL)
130*7c478bd9Sstevel@tonic-gate 			goto retry;
131*7c478bd9Sstevel@tonic-gate 		bufsize = LOG_MSGSIZE;
132*7c478bd9Sstevel@tonic-gate 		bufp = buf;
133*7c478bd9Sstevel@tonic-gate 	}
134*7c478bd9Sstevel@tonic-gate 
135*7c478bd9Sstevel@tonic-gate 	mp = log_makemsg(mid, sid, level, sl, LOG_KERN, bufp,
136*7c478bd9Sstevel@tonic-gate 	    MIN(bufsize, msgp - bufp + 1), on_intr);
137*7c478bd9Sstevel@tonic-gate 	if (mp == NULL) {
138*7c478bd9Sstevel@tonic-gate 		if ((sl & (SL_CONSOLE | SL_LOGONLY)) == SL_CONSOLE && !on_intr)
139*7c478bd9Sstevel@tonic-gate 			console_printf("%s", body);
140*7c478bd9Sstevel@tonic-gate 		goto out;
141*7c478bd9Sstevel@tonic-gate 	}
142*7c478bd9Sstevel@tonic-gate 
143*7c478bd9Sstevel@tonic-gate 	if (sl & SL_USER) {
144*7c478bd9Sstevel@tonic-gate 		ssize_t resid;
145*7c478bd9Sstevel@tonic-gate 		sess_t *sessp;
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate 		mutex_enter(&pidlock);
148*7c478bd9Sstevel@tonic-gate 		sessp = curproc->p_sessp;
149*7c478bd9Sstevel@tonic-gate 		SESS_HOLD(sessp);
150*7c478bd9Sstevel@tonic-gate 		TTY_HOLD(sessp);
151*7c478bd9Sstevel@tonic-gate 		mutex_exit(&pidlock);
152*7c478bd9Sstevel@tonic-gate 		if (sessp->s_vp)
153*7c478bd9Sstevel@tonic-gate 			(void) vn_rdwr(UIO_WRITE, sessp->s_vp,
154*7c478bd9Sstevel@tonic-gate 			    body, len, 0LL, UIO_SYSSPACE,
155*7c478bd9Sstevel@tonic-gate 			    FAPPEND, (rlim64_t)LOG_HIWAT, kcred, &resid);
156*7c478bd9Sstevel@tonic-gate 		mutex_enter(&pidlock);
157*7c478bd9Sstevel@tonic-gate 		TTY_RELE(sessp);
158*7c478bd9Sstevel@tonic-gate 		SESS_RELE(sessp);
159*7c478bd9Sstevel@tonic-gate 		mutex_exit(&pidlock);
160*7c478bd9Sstevel@tonic-gate 	}
161*7c478bd9Sstevel@tonic-gate 
162*7c478bd9Sstevel@tonic-gate 	if (on_intr && !panicstr) {
163*7c478bd9Sstevel@tonic-gate 		(void) putq(log_intrq, mp);
164*7c478bd9Sstevel@tonic-gate 		softcall((void (*)(void *))log_flushq, log_intrq);
165*7c478bd9Sstevel@tonic-gate 	} else {
166*7c478bd9Sstevel@tonic-gate 		log_sendmsg(mp, zoneid);
167*7c478bd9Sstevel@tonic-gate 	}
168*7c478bd9Sstevel@tonic-gate out:
169*7c478bd9Sstevel@tonic-gate 	if (panicbuf_log + len < PANICBUFSIZE) {
170*7c478bd9Sstevel@tonic-gate 		uint32_t old, new;
171*7c478bd9Sstevel@tonic-gate 		do {
172*7c478bd9Sstevel@tonic-gate 			old = panicbuf_index;
173*7c478bd9Sstevel@tonic-gate 			new = old + len;
174*7c478bd9Sstevel@tonic-gate 			if (new >= PANICBUFSIZE)
175*7c478bd9Sstevel@tonic-gate 				new = panicbuf_log + len;
176*7c478bd9Sstevel@tonic-gate 		} while (cas32(&panicbuf_index, old, new) != old);
177*7c478bd9Sstevel@tonic-gate 		bcopy(body, &panicbuf[new - len], len);
178*7c478bd9Sstevel@tonic-gate 	}
179*7c478bd9Sstevel@tonic-gate 	if (bufp != buf)
180*7c478bd9Sstevel@tonic-gate 		kmem_free(bufp, bufsize);
181*7c478bd9Sstevel@tonic-gate }
182*7c478bd9Sstevel@tonic-gate 
183*7c478bd9Sstevel@tonic-gate void
184*7c478bd9Sstevel@tonic-gate vzprintf(zoneid_t zoneid, const char *fmt, va_list adx)
185*7c478bd9Sstevel@tonic-gate {
186*7c478bd9Sstevel@tonic-gate 	cprintf(fmt, adx, SL_CONSOLE | SL_NOTE, "", "", caller(), 0, 0, 0,
187*7c478bd9Sstevel@tonic-gate 	    zoneid);
188*7c478bd9Sstevel@tonic-gate }
189*7c478bd9Sstevel@tonic-gate 
190*7c478bd9Sstevel@tonic-gate void
191*7c478bd9Sstevel@tonic-gate vprintf(const char *fmt, va_list adx)
192*7c478bd9Sstevel@tonic-gate {
193*7c478bd9Sstevel@tonic-gate 	vzprintf(GLOBAL_ZONEID, fmt, adx);
194*7c478bd9Sstevel@tonic-gate }
195*7c478bd9Sstevel@tonic-gate 
196*7c478bd9Sstevel@tonic-gate /*PRINTFLIKE1*/
197*7c478bd9Sstevel@tonic-gate void
198*7c478bd9Sstevel@tonic-gate printf(const char *fmt, ...)
199*7c478bd9Sstevel@tonic-gate {
200*7c478bd9Sstevel@tonic-gate 	va_list adx;
201*7c478bd9Sstevel@tonic-gate 
202*7c478bd9Sstevel@tonic-gate 	va_start(adx, fmt);
203*7c478bd9Sstevel@tonic-gate 	cprintf(fmt, adx, SL_CONSOLE | SL_NOTE, "", "", caller(), 0, 0, 0,
204*7c478bd9Sstevel@tonic-gate 	    GLOBAL_ZONEID);
205*7c478bd9Sstevel@tonic-gate 	va_end(adx);
206*7c478bd9Sstevel@tonic-gate }
207*7c478bd9Sstevel@tonic-gate 
208*7c478bd9Sstevel@tonic-gate /*PRINTFLIKE2*/
209*7c478bd9Sstevel@tonic-gate void
210*7c478bd9Sstevel@tonic-gate zprintf(zoneid_t zoneid, const char *fmt, ...)
211*7c478bd9Sstevel@tonic-gate {
212*7c478bd9Sstevel@tonic-gate 	va_list adx;
213*7c478bd9Sstevel@tonic-gate 
214*7c478bd9Sstevel@tonic-gate 	va_start(adx, fmt);
215*7c478bd9Sstevel@tonic-gate 	cprintf(fmt, adx, SL_CONSOLE | SL_NOTE, "", "", caller(), 0, 0, 0,
216*7c478bd9Sstevel@tonic-gate 	    zoneid);
217*7c478bd9Sstevel@tonic-gate 	va_end(adx);
218*7c478bd9Sstevel@tonic-gate }
219*7c478bd9Sstevel@tonic-gate 
220*7c478bd9Sstevel@tonic-gate void
221*7c478bd9Sstevel@tonic-gate vuprintf(const char *fmt, va_list adx)
222*7c478bd9Sstevel@tonic-gate {
223*7c478bd9Sstevel@tonic-gate 	cprintf(fmt, adx, SL_CONSOLE | SL_LOGONLY | SL_USER | SL_NOTE,
224*7c478bd9Sstevel@tonic-gate 	    "", "", caller(), 0, 0, 0, GLOBAL_ZONEID);
225*7c478bd9Sstevel@tonic-gate }
226*7c478bd9Sstevel@tonic-gate 
227*7c478bd9Sstevel@tonic-gate /*PRINTFLIKE1*/
228*7c478bd9Sstevel@tonic-gate void
229*7c478bd9Sstevel@tonic-gate uprintf(const char *fmt, ...)
230*7c478bd9Sstevel@tonic-gate {
231*7c478bd9Sstevel@tonic-gate 	va_list adx;
232*7c478bd9Sstevel@tonic-gate 
233*7c478bd9Sstevel@tonic-gate 	va_start(adx, fmt);
234*7c478bd9Sstevel@tonic-gate 	cprintf(fmt, adx, SL_CONSOLE | SL_LOGONLY | SL_USER | SL_NOTE,
235*7c478bd9Sstevel@tonic-gate 	    "", "", caller(), 0, 0, 0, GLOBAL_ZONEID);
236*7c478bd9Sstevel@tonic-gate 	va_end(adx);
237*7c478bd9Sstevel@tonic-gate }
238*7c478bd9Sstevel@tonic-gate 
239*7c478bd9Sstevel@tonic-gate void
240*7c478bd9Sstevel@tonic-gate vzcmn_err(zoneid_t zoneid, int ce, const char *fmt, va_list adx)
241*7c478bd9Sstevel@tonic-gate {
242*7c478bd9Sstevel@tonic-gate 	if (ce == CE_PANIC)
243*7c478bd9Sstevel@tonic-gate 		vpanic(fmt, adx);
244*7c478bd9Sstevel@tonic-gate 	if ((uint_t)ce < CE_IGNORE)
245*7c478bd9Sstevel@tonic-gate 		cprintf(fmt, adx, ce_to_sl[ce] | SL_CONSOLE,
246*7c478bd9Sstevel@tonic-gate 		    ce_prefix[ce], ce_suffix[ce], caller(), 0, 0, 0,
247*7c478bd9Sstevel@tonic-gate 		    zoneid);
248*7c478bd9Sstevel@tonic-gate }
249*7c478bd9Sstevel@tonic-gate 
250*7c478bd9Sstevel@tonic-gate void
251*7c478bd9Sstevel@tonic-gate vcmn_err(int ce, const char *fmt, va_list adx)
252*7c478bd9Sstevel@tonic-gate {
253*7c478bd9Sstevel@tonic-gate 	vzcmn_err(GLOBAL_ZONEID, ce, fmt, adx);
254*7c478bd9Sstevel@tonic-gate }
255*7c478bd9Sstevel@tonic-gate 
256*7c478bd9Sstevel@tonic-gate /*PRINTFLIKE2*/
257*7c478bd9Sstevel@tonic-gate void
258*7c478bd9Sstevel@tonic-gate cmn_err(int ce, const char *fmt, ...)
259*7c478bd9Sstevel@tonic-gate {
260*7c478bd9Sstevel@tonic-gate 	va_list adx;
261*7c478bd9Sstevel@tonic-gate 
262*7c478bd9Sstevel@tonic-gate 	va_start(adx, fmt);
263*7c478bd9Sstevel@tonic-gate 	if (ce == CE_PANIC)
264*7c478bd9Sstevel@tonic-gate 		vpanic(fmt, adx);
265*7c478bd9Sstevel@tonic-gate 	if ((uint_t)ce < CE_IGNORE)
266*7c478bd9Sstevel@tonic-gate 		cprintf(fmt, adx, ce_to_sl[ce] | SL_CONSOLE,
267*7c478bd9Sstevel@tonic-gate 		    ce_prefix[ce], ce_suffix[ce], caller(), 0, 0, 0,
268*7c478bd9Sstevel@tonic-gate 		    GLOBAL_ZONEID);
269*7c478bd9Sstevel@tonic-gate 	va_end(adx);
270*7c478bd9Sstevel@tonic-gate }
271*7c478bd9Sstevel@tonic-gate 
272*7c478bd9Sstevel@tonic-gate /*PRINTFLIKE3*/
273*7c478bd9Sstevel@tonic-gate void
274*7c478bd9Sstevel@tonic-gate zcmn_err(zoneid_t zoneid, int ce, const char *fmt, ...)
275*7c478bd9Sstevel@tonic-gate {
276*7c478bd9Sstevel@tonic-gate 	va_list adx;
277*7c478bd9Sstevel@tonic-gate 
278*7c478bd9Sstevel@tonic-gate 	va_start(adx, fmt);
279*7c478bd9Sstevel@tonic-gate 	if (ce == CE_PANIC)
280*7c478bd9Sstevel@tonic-gate 		vpanic(fmt, adx);
281*7c478bd9Sstevel@tonic-gate 	if ((uint_t)ce < CE_IGNORE)
282*7c478bd9Sstevel@tonic-gate 		cprintf(fmt, adx, ce_to_sl[ce] | SL_CONSOLE, ce_prefix[ce],
283*7c478bd9Sstevel@tonic-gate 		    ce_suffix[ce], caller(), 0, 0, 0, zoneid);
284*7c478bd9Sstevel@tonic-gate 	va_end(adx);
285*7c478bd9Sstevel@tonic-gate }
286*7c478bd9Sstevel@tonic-gate 
287*7c478bd9Sstevel@tonic-gate int
288*7c478bd9Sstevel@tonic-gate assfail(const char *a, const char *f, int l)
289*7c478bd9Sstevel@tonic-gate {
290*7c478bd9Sstevel@tonic-gate 	if (aask)  {
291*7c478bd9Sstevel@tonic-gate 		printf("ASSERTION CAUGHT: %s, file: %s, line: %d", a, f, l);
292*7c478bd9Sstevel@tonic-gate 		debug_enter(NULL);
293*7c478bd9Sstevel@tonic-gate 	}
294*7c478bd9Sstevel@tonic-gate 
295*7c478bd9Sstevel@tonic-gate 	if (!aok && !panicstr)
296*7c478bd9Sstevel@tonic-gate 		panic("assertion failed: %s, file: %s, line: %d", a, f, l);
297*7c478bd9Sstevel@tonic-gate 
298*7c478bd9Sstevel@tonic-gate 	return (0);
299*7c478bd9Sstevel@tonic-gate }
300*7c478bd9Sstevel@tonic-gate 
301*7c478bd9Sstevel@tonic-gate int
302*7c478bd9Sstevel@tonic-gate strlog(short mid, short sid, char level, ushort_t sl, char *fmt, ...)
303*7c478bd9Sstevel@tonic-gate {
304*7c478bd9Sstevel@tonic-gate 	if (sl & log_global.lz_active) {
305*7c478bd9Sstevel@tonic-gate 		va_list adx;
306*7c478bd9Sstevel@tonic-gate 		va_start(adx, fmt);
307*7c478bd9Sstevel@tonic-gate 		cprintf(fmt, adx, sl, "", "", caller(), mid, sid, level,
308*7c478bd9Sstevel@tonic-gate 		    GLOBAL_ZONEID);
309*7c478bd9Sstevel@tonic-gate 		va_end(adx);
310*7c478bd9Sstevel@tonic-gate 	}
311*7c478bd9Sstevel@tonic-gate 	return (1);
312*7c478bd9Sstevel@tonic-gate }
313*7c478bd9Sstevel@tonic-gate 
314*7c478bd9Sstevel@tonic-gate int
315*7c478bd9Sstevel@tonic-gate vstrlog(short mid, short sid, char level, ushort_t sl, char *fmt, va_list adx)
316*7c478bd9Sstevel@tonic-gate {
317*7c478bd9Sstevel@tonic-gate 	if (sl & log_global.lz_active)
318*7c478bd9Sstevel@tonic-gate 		cprintf(fmt, adx, sl, "", "", caller(), mid, sid, level,
319*7c478bd9Sstevel@tonic-gate 		    GLOBAL_ZONEID);
320*7c478bd9Sstevel@tonic-gate 	return (1);
321*7c478bd9Sstevel@tonic-gate }
322