xref: /titanic_50/usr/src/uts/common/os/printf.c (revision 9acbbeaf2a1ffe5c14b244867d427714fab43c5c)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*9acbbeafSnn35248  * Common Development and Distribution License (the "License").
6*9acbbeafSnn35248  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*9acbbeafSnn35248  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate #include <sys/param.h>
297c478bd9Sstevel@tonic-gate #include <sys/types.h>
307c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h>
317c478bd9Sstevel@tonic-gate #include <sys/inline.h>
327c478bd9Sstevel@tonic-gate #include <sys/varargs.h>
337c478bd9Sstevel@tonic-gate #include <sys/systm.h>
347c478bd9Sstevel@tonic-gate #include <sys/conf.h>
357c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h>
367c478bd9Sstevel@tonic-gate #include <sys/syslog.h>
377c478bd9Sstevel@tonic-gate #include <sys/log.h>
387c478bd9Sstevel@tonic-gate #include <sys/proc.h>
397c478bd9Sstevel@tonic-gate #include <sys/vnode.h>
407c478bd9Sstevel@tonic-gate #include <sys/session.h>
417c478bd9Sstevel@tonic-gate #include <sys/stream.h>
427c478bd9Sstevel@tonic-gate #include <sys/kmem.h>
437c478bd9Sstevel@tonic-gate #include <sys/kobj.h>
447c478bd9Sstevel@tonic-gate #include <sys/atomic.h>
457c478bd9Sstevel@tonic-gate #include <sys/console.h>
467c478bd9Sstevel@tonic-gate #include <sys/cpuvar.h>
477c478bd9Sstevel@tonic-gate #include <sys/modctl.h>
487c478bd9Sstevel@tonic-gate #include <sys/reboot.h>
497c478bd9Sstevel@tonic-gate #include <sys/debug.h>
507c478bd9Sstevel@tonic-gate #include <sys/panic.h>
517c478bd9Sstevel@tonic-gate #include <sys/spl.h>
527c478bd9Sstevel@tonic-gate #include <sys/zone.h>
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * In some debugging situations it's useful to log all messages to panicbuf,
567c478bd9Sstevel@tonic-gate  * which is persistent across reboots (on most platforms).  The range
577c478bd9Sstevel@tonic-gate  * panicbuf[panicbuf_log..PANICBUFSIZE-1] may be used for this purpose.
587c478bd9Sstevel@tonic-gate  * By default, panicbuf_log == PANICBUFSIZE and no messages are logged.
597c478bd9Sstevel@tonic-gate  * To enable panicbuf logging, set panicbuf_log to a small value, say 1K;
607c478bd9Sstevel@tonic-gate  * this will reserve 1K for panic information and 7K for message logging.
617c478bd9Sstevel@tonic-gate  */
627c478bd9Sstevel@tonic-gate uint32_t panicbuf_log = PANICBUFSIZE;
637c478bd9Sstevel@tonic-gate uint32_t panicbuf_index = PANICBUFSIZE;
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate static int aask, aok;
667c478bd9Sstevel@tonic-gate static int ce_to_sl[CE_IGNORE] = { SL_NOTE, SL_NOTE, SL_WARN, SL_FATAL };
677c478bd9Sstevel@tonic-gate static char ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" };
687c478bd9Sstevel@tonic-gate static char ce_suffix[CE_IGNORE][2] = { "", "\n", "\n", "" };
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate static void
717c478bd9Sstevel@tonic-gate cprintf(const char *fmt, va_list adx, int sl, const char *prefix,
727c478bd9Sstevel@tonic-gate 	const char *suffix, void *site, int mid, int sid, int level,
737c478bd9Sstevel@tonic-gate 	zoneid_t zoneid)
747c478bd9Sstevel@tonic-gate {
757c478bd9Sstevel@tonic-gate 	uint32_t msgid;
767c478bd9Sstevel@tonic-gate 	size_t bufsize = LOG_MSGSIZE;
777c478bd9Sstevel@tonic-gate 	char buf[LOG_MSGSIZE];
787c478bd9Sstevel@tonic-gate 	char *bufp = buf;
797c478bd9Sstevel@tonic-gate 	char *body, *msgp, *bufend;
807c478bd9Sstevel@tonic-gate 	mblk_t *mp;
817c478bd9Sstevel@tonic-gate 	int s, on_intr;
827c478bd9Sstevel@tonic-gate 	size_t len;
837c478bd9Sstevel@tonic-gate 
847c478bd9Sstevel@tonic-gate 	s = splhi();
857c478bd9Sstevel@tonic-gate 	on_intr = CPU_ON_INTR(CPU) ||
867c478bd9Sstevel@tonic-gate 	    (interrupts_unleashed && (spltoipl(s) > LOCK_LEVEL));
877c478bd9Sstevel@tonic-gate 	splx(s);
887c478bd9Sstevel@tonic-gate 
897c478bd9Sstevel@tonic-gate 	ASSERT(zoneid == GLOBAL_ZONEID || !on_intr);
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate 	STRLOG_MAKE_MSGID(fmt, msgid);
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate 	if (strchr("^!?", fmt[0]) != NULL) {
947c478bd9Sstevel@tonic-gate 		if (fmt[0] == '^')
957c478bd9Sstevel@tonic-gate 			sl |= SL_CONSONLY;
967c478bd9Sstevel@tonic-gate 		else if (fmt[0] == '!' ||
977c478bd9Sstevel@tonic-gate 		    (prefix[0] == '\0' && !(boothowto & RB_VERBOSE)))
987c478bd9Sstevel@tonic-gate 			sl = (sl & ~(SL_USER | SL_NOTE)) | SL_LOGONLY;
997c478bd9Sstevel@tonic-gate 		fmt++;
1007c478bd9Sstevel@tonic-gate 	}
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate 	if ((sl & SL_USER) && (MUTEX_HELD(&pidlock) || on_intr)) {
1037c478bd9Sstevel@tonic-gate 		zoneid = getzoneid();
1047c478bd9Sstevel@tonic-gate 		sl = sl & ~(SL_USER | SL_LOGONLY) | SL_CONSOLE;
1057c478bd9Sstevel@tonic-gate 	}
1067c478bd9Sstevel@tonic-gate 
1077c478bd9Sstevel@tonic-gate retry:
1087c478bd9Sstevel@tonic-gate 	bufend = bufp + bufsize;
1097c478bd9Sstevel@tonic-gate 	msgp = bufp;
1107c478bd9Sstevel@tonic-gate 	body = msgp += snprintf(msgp, bufend - msgp,
1117c478bd9Sstevel@tonic-gate 	    "%s: [ID %u FACILITY_AND_PRIORITY] ",
1127c478bd9Sstevel@tonic-gate 	    mod_containing_pc(site), msgid);
1137c478bd9Sstevel@tonic-gate 	msgp += snprintf(msgp, bufend - msgp, prefix);
1147c478bd9Sstevel@tonic-gate 	msgp += vsnprintf(msgp, bufend - msgp, fmt, adx);
1157c478bd9Sstevel@tonic-gate 	msgp += snprintf(msgp, bufend - msgp, suffix);
1167c478bd9Sstevel@tonic-gate 	len = strlen(body);
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate 	if (((sl & SL_CONSONLY) && panicstr) ||
1197c478bd9Sstevel@tonic-gate 	    (zoneid == GLOBAL_ZONEID && log_global.lz_active == 0)) {
1207c478bd9Sstevel@tonic-gate 		console_printf("%s", body);
1217c478bd9Sstevel@tonic-gate 		goto out;
1227c478bd9Sstevel@tonic-gate 	}
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate 	if (msgp - bufp >= bufsize && !on_intr) {
1257c478bd9Sstevel@tonic-gate 		ASSERT(bufp == buf);
1267c478bd9Sstevel@tonic-gate 		bufsize = msgp - bufp + 1;
1277c478bd9Sstevel@tonic-gate 		bufp = kmem_alloc(bufsize, KM_NOSLEEP);
1287c478bd9Sstevel@tonic-gate 		if (bufp != NULL)
1297c478bd9Sstevel@tonic-gate 			goto retry;
1307c478bd9Sstevel@tonic-gate 		bufsize = LOG_MSGSIZE;
1317c478bd9Sstevel@tonic-gate 		bufp = buf;
1327c478bd9Sstevel@tonic-gate 	}
1337c478bd9Sstevel@tonic-gate 
1347c478bd9Sstevel@tonic-gate 	mp = log_makemsg(mid, sid, level, sl, LOG_KERN, bufp,
1357c478bd9Sstevel@tonic-gate 	    MIN(bufsize, msgp - bufp + 1), on_intr);
1367c478bd9Sstevel@tonic-gate 	if (mp == NULL) {
1377c478bd9Sstevel@tonic-gate 		if ((sl & (SL_CONSOLE | SL_LOGONLY)) == SL_CONSOLE && !on_intr)
1387c478bd9Sstevel@tonic-gate 			console_printf("%s", body);
1397c478bd9Sstevel@tonic-gate 		goto out;
1407c478bd9Sstevel@tonic-gate 	}
1417c478bd9Sstevel@tonic-gate 
1427c478bd9Sstevel@tonic-gate 	if (sl & SL_USER) {
1437c478bd9Sstevel@tonic-gate 		ssize_t resid;
144*9acbbeafSnn35248 		sess_t *sp;
1457c478bd9Sstevel@tonic-gate 
146*9acbbeafSnn35248 		if ((sp = tty_hold()) != NULL) {
147*9acbbeafSnn35248 			if (sp->s_vp != NULL)
148*9acbbeafSnn35248 				(void) vn_rdwr(UIO_WRITE, sp->s_vp, body,
149*9acbbeafSnn35248 				    len, 0LL, UIO_SYSSPACE, FAPPEND,
150*9acbbeafSnn35248 				    (rlim64_t)LOG_HIWAT, kcred, &resid);
151*9acbbeafSnn35248 			tty_rele(sp);
152*9acbbeafSnn35248 		}
1537c478bd9Sstevel@tonic-gate 	}
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate 	if (on_intr && !panicstr) {
1567c478bd9Sstevel@tonic-gate 		(void) putq(log_intrq, mp);
1577c478bd9Sstevel@tonic-gate 		softcall((void (*)(void *))log_flushq, log_intrq);
1587c478bd9Sstevel@tonic-gate 	} else {
1597c478bd9Sstevel@tonic-gate 		log_sendmsg(mp, zoneid);
1607c478bd9Sstevel@tonic-gate 	}
1617c478bd9Sstevel@tonic-gate out:
1627c478bd9Sstevel@tonic-gate 	if (panicbuf_log + len < PANICBUFSIZE) {
1637c478bd9Sstevel@tonic-gate 		uint32_t old, new;
1647c478bd9Sstevel@tonic-gate 		do {
1657c478bd9Sstevel@tonic-gate 			old = panicbuf_index;
1667c478bd9Sstevel@tonic-gate 			new = old + len;
1677c478bd9Sstevel@tonic-gate 			if (new >= PANICBUFSIZE)
1687c478bd9Sstevel@tonic-gate 				new = panicbuf_log + len;
1697c478bd9Sstevel@tonic-gate 		} while (cas32(&panicbuf_index, old, new) != old);
1707c478bd9Sstevel@tonic-gate 		bcopy(body, &panicbuf[new - len], len);
1717c478bd9Sstevel@tonic-gate 	}
1727c478bd9Sstevel@tonic-gate 	if (bufp != buf)
1737c478bd9Sstevel@tonic-gate 		kmem_free(bufp, bufsize);
1747c478bd9Sstevel@tonic-gate }
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate void
1777c478bd9Sstevel@tonic-gate vzprintf(zoneid_t zoneid, const char *fmt, va_list adx)
1787c478bd9Sstevel@tonic-gate {
1797c478bd9Sstevel@tonic-gate 	cprintf(fmt, adx, SL_CONSOLE | SL_NOTE, "", "", caller(), 0, 0, 0,
1807c478bd9Sstevel@tonic-gate 	    zoneid);
1817c478bd9Sstevel@tonic-gate }
1827c478bd9Sstevel@tonic-gate 
1837c478bd9Sstevel@tonic-gate void
1847c478bd9Sstevel@tonic-gate vprintf(const char *fmt, va_list adx)
1857c478bd9Sstevel@tonic-gate {
1867c478bd9Sstevel@tonic-gate 	vzprintf(GLOBAL_ZONEID, fmt, adx);
1877c478bd9Sstevel@tonic-gate }
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate /*PRINTFLIKE1*/
1907c478bd9Sstevel@tonic-gate void
1917c478bd9Sstevel@tonic-gate printf(const char *fmt, ...)
1927c478bd9Sstevel@tonic-gate {
1937c478bd9Sstevel@tonic-gate 	va_list adx;
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate 	va_start(adx, fmt);
1967c478bd9Sstevel@tonic-gate 	cprintf(fmt, adx, SL_CONSOLE | SL_NOTE, "", "", caller(), 0, 0, 0,
1977c478bd9Sstevel@tonic-gate 	    GLOBAL_ZONEID);
1987c478bd9Sstevel@tonic-gate 	va_end(adx);
1997c478bd9Sstevel@tonic-gate }
2007c478bd9Sstevel@tonic-gate 
2017c478bd9Sstevel@tonic-gate /*PRINTFLIKE2*/
2027c478bd9Sstevel@tonic-gate void
2037c478bd9Sstevel@tonic-gate zprintf(zoneid_t zoneid, const char *fmt, ...)
2047c478bd9Sstevel@tonic-gate {
2057c478bd9Sstevel@tonic-gate 	va_list adx;
2067c478bd9Sstevel@tonic-gate 
2077c478bd9Sstevel@tonic-gate 	va_start(adx, fmt);
2087c478bd9Sstevel@tonic-gate 	cprintf(fmt, adx, SL_CONSOLE | SL_NOTE, "", "", caller(), 0, 0, 0,
2097c478bd9Sstevel@tonic-gate 	    zoneid);
2107c478bd9Sstevel@tonic-gate 	va_end(adx);
2117c478bd9Sstevel@tonic-gate }
2127c478bd9Sstevel@tonic-gate 
2137c478bd9Sstevel@tonic-gate void
2147c478bd9Sstevel@tonic-gate vuprintf(const char *fmt, va_list adx)
2157c478bd9Sstevel@tonic-gate {
2167c478bd9Sstevel@tonic-gate 	cprintf(fmt, adx, SL_CONSOLE | SL_LOGONLY | SL_USER | SL_NOTE,
2177c478bd9Sstevel@tonic-gate 	    "", "", caller(), 0, 0, 0, GLOBAL_ZONEID);
2187c478bd9Sstevel@tonic-gate }
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate /*PRINTFLIKE1*/
2217c478bd9Sstevel@tonic-gate void
2227c478bd9Sstevel@tonic-gate uprintf(const char *fmt, ...)
2237c478bd9Sstevel@tonic-gate {
2247c478bd9Sstevel@tonic-gate 	va_list adx;
2257c478bd9Sstevel@tonic-gate 
2267c478bd9Sstevel@tonic-gate 	va_start(adx, fmt);
2277c478bd9Sstevel@tonic-gate 	cprintf(fmt, adx, SL_CONSOLE | SL_LOGONLY | SL_USER | SL_NOTE,
2287c478bd9Sstevel@tonic-gate 	    "", "", caller(), 0, 0, 0, GLOBAL_ZONEID);
2297c478bd9Sstevel@tonic-gate 	va_end(adx);
2307c478bd9Sstevel@tonic-gate }
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate void
2337c478bd9Sstevel@tonic-gate vzcmn_err(zoneid_t zoneid, int ce, const char *fmt, va_list adx)
2347c478bd9Sstevel@tonic-gate {
2357c478bd9Sstevel@tonic-gate 	if (ce == CE_PANIC)
2367c478bd9Sstevel@tonic-gate 		vpanic(fmt, adx);
2377c478bd9Sstevel@tonic-gate 	if ((uint_t)ce < CE_IGNORE)
2387c478bd9Sstevel@tonic-gate 		cprintf(fmt, adx, ce_to_sl[ce] | SL_CONSOLE,
2397c478bd9Sstevel@tonic-gate 		    ce_prefix[ce], ce_suffix[ce], caller(), 0, 0, 0,
2407c478bd9Sstevel@tonic-gate 		    zoneid);
2417c478bd9Sstevel@tonic-gate }
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate void
2447c478bd9Sstevel@tonic-gate vcmn_err(int ce, const char *fmt, va_list adx)
2457c478bd9Sstevel@tonic-gate {
2467c478bd9Sstevel@tonic-gate 	vzcmn_err(GLOBAL_ZONEID, ce, fmt, adx);
2477c478bd9Sstevel@tonic-gate }
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate /*PRINTFLIKE2*/
2507c478bd9Sstevel@tonic-gate void
2517c478bd9Sstevel@tonic-gate cmn_err(int ce, const char *fmt, ...)
2527c478bd9Sstevel@tonic-gate {
2537c478bd9Sstevel@tonic-gate 	va_list adx;
2547c478bd9Sstevel@tonic-gate 
2557c478bd9Sstevel@tonic-gate 	va_start(adx, fmt);
2567c478bd9Sstevel@tonic-gate 	if (ce == CE_PANIC)
2577c478bd9Sstevel@tonic-gate 		vpanic(fmt, adx);
2587c478bd9Sstevel@tonic-gate 	if ((uint_t)ce < CE_IGNORE)
2597c478bd9Sstevel@tonic-gate 		cprintf(fmt, adx, ce_to_sl[ce] | SL_CONSOLE,
2607c478bd9Sstevel@tonic-gate 		    ce_prefix[ce], ce_suffix[ce], caller(), 0, 0, 0,
2617c478bd9Sstevel@tonic-gate 		    GLOBAL_ZONEID);
2627c478bd9Sstevel@tonic-gate 	va_end(adx);
2637c478bd9Sstevel@tonic-gate }
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate /*PRINTFLIKE3*/
2667c478bd9Sstevel@tonic-gate void
2677c478bd9Sstevel@tonic-gate zcmn_err(zoneid_t zoneid, int ce, const char *fmt, ...)
2687c478bd9Sstevel@tonic-gate {
2697c478bd9Sstevel@tonic-gate 	va_list adx;
2707c478bd9Sstevel@tonic-gate 
2717c478bd9Sstevel@tonic-gate 	va_start(adx, fmt);
2727c478bd9Sstevel@tonic-gate 	if (ce == CE_PANIC)
2737c478bd9Sstevel@tonic-gate 		vpanic(fmt, adx);
2747c478bd9Sstevel@tonic-gate 	if ((uint_t)ce < CE_IGNORE)
2757c478bd9Sstevel@tonic-gate 		cprintf(fmt, adx, ce_to_sl[ce] | SL_CONSOLE, ce_prefix[ce],
2767c478bd9Sstevel@tonic-gate 		    ce_suffix[ce], caller(), 0, 0, 0, zoneid);
2777c478bd9Sstevel@tonic-gate 	va_end(adx);
2787c478bd9Sstevel@tonic-gate }
2797c478bd9Sstevel@tonic-gate 
2807c478bd9Sstevel@tonic-gate int
2817c478bd9Sstevel@tonic-gate assfail(const char *a, const char *f, int l)
2827c478bd9Sstevel@tonic-gate {
2837c478bd9Sstevel@tonic-gate 	if (aask)  {
2847c478bd9Sstevel@tonic-gate 		printf("ASSERTION CAUGHT: %s, file: %s, line: %d", a, f, l);
2857c478bd9Sstevel@tonic-gate 		debug_enter(NULL);
2867c478bd9Sstevel@tonic-gate 	}
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate 	if (!aok && !panicstr)
2897c478bd9Sstevel@tonic-gate 		panic("assertion failed: %s, file: %s, line: %d", a, f, l);
2907c478bd9Sstevel@tonic-gate 
2917c478bd9Sstevel@tonic-gate 	return (0);
2927c478bd9Sstevel@tonic-gate }
2937c478bd9Sstevel@tonic-gate 
294fa9e4066Sahrens void
295fa9e4066Sahrens assfail3(const char *a, uintmax_t lv, const char *op, uintmax_t rv,
296fa9e4066Sahrens     const char *f, int l)
297fa9e4066Sahrens {
298fa9e4066Sahrens 	if (aask)  {
299fa9e4066Sahrens 		printf("ASSERTION CAUGHT: %s (0x%llx %s 0x%llx), file: %s, "
300fa9e4066Sahrens 		    "line: %d", a, (u_longlong_t)lv, op, (u_longlong_t)rv,
301fa9e4066Sahrens 		    f, l);
302fa9e4066Sahrens 		debug_enter(NULL);
303fa9e4066Sahrens 	}
304fa9e4066Sahrens 
305fa9e4066Sahrens 	if (!aok && !panicstr)
306fa9e4066Sahrens 		panic("assertion failed: %s (0x%llx %s 0x%llx), file: %s, "
307fa9e4066Sahrens 		    "line: %d", a, (u_longlong_t)lv, op, (u_longlong_t)rv,
308fa9e4066Sahrens 		    f, l);
309fa9e4066Sahrens }
310fa9e4066Sahrens 
3117c478bd9Sstevel@tonic-gate int
3127c478bd9Sstevel@tonic-gate strlog(short mid, short sid, char level, ushort_t sl, char *fmt, ...)
3137c478bd9Sstevel@tonic-gate {
3147c478bd9Sstevel@tonic-gate 	if (sl & log_global.lz_active) {
3157c478bd9Sstevel@tonic-gate 		va_list adx;
3167c478bd9Sstevel@tonic-gate 		va_start(adx, fmt);
3177c478bd9Sstevel@tonic-gate 		cprintf(fmt, adx, sl, "", "", caller(), mid, sid, level,
3187c478bd9Sstevel@tonic-gate 		    GLOBAL_ZONEID);
3197c478bd9Sstevel@tonic-gate 		va_end(adx);
3207c478bd9Sstevel@tonic-gate 	}
3217c478bd9Sstevel@tonic-gate 	return (1);
3227c478bd9Sstevel@tonic-gate }
3237c478bd9Sstevel@tonic-gate 
3247c478bd9Sstevel@tonic-gate int
3257c478bd9Sstevel@tonic-gate vstrlog(short mid, short sid, char level, ushort_t sl, char *fmt, va_list adx)
3267c478bd9Sstevel@tonic-gate {
3277c478bd9Sstevel@tonic-gate 	if (sl & log_global.lz_active)
3287c478bd9Sstevel@tonic-gate 		cprintf(fmt, adx, sl, "", "", caller(), mid, sid, level,
3297c478bd9Sstevel@tonic-gate 		    GLOBAL_ZONEID);
3307c478bd9Sstevel@tonic-gate 	return (1);
3317c478bd9Sstevel@tonic-gate }
332