From d6c90996e9f85ae712e669bf3b6efd3ba5fafde2 Mon Sep 17 00:00:00 2001 From: Abhinandan Ekande Date: Tue, 12 May 2009 02:21:55 -0700 Subject: PSARC 2009/222 Add zone support to uprintf() and vuprintf() 6676374 If Solaris Kills a process, the user needs to know why --- usr/src/uts/common/os/printf.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'usr/src/uts/common/os/printf.c') diff --git a/usr/src/uts/common/os/printf.c b/usr/src/uts/common/os/printf.c index a50bfa0db9..1caedb33b6 100644 --- a/usr/src/uts/common/os/printf.c +++ b/usr/src/uts/common/os/printf.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -213,8 +211,19 @@ zprintf(zoneid_t zoneid, const char *fmt, ...) void vuprintf(const char *fmt, va_list adx) { + va_list adxcp; + va_copy(adxcp, adx); + + /* Message the user tty, if any, and the global zone syslog */ cprintf(fmt, adx, SL_CONSOLE | SL_LOGONLY | SL_USER | SL_NOTE, "", "", caller(), 0, 0, 0, GLOBAL_ZONEID); + + /* Now message the local zone syslog */ + if (!INGLOBALZONE(curproc)) + cprintf(fmt, adxcp, SL_CONSOLE | SL_LOGONLY | SL_NOTE, + "", "", caller(), 0, 0, 0, getzoneid()); + + va_end(adxcp); } /*PRINTFLIKE1*/ @@ -224,8 +233,9 @@ uprintf(const char *fmt, ...) va_list adx; va_start(adx, fmt); - cprintf(fmt, adx, SL_CONSOLE | SL_LOGONLY | SL_USER | SL_NOTE, - "", "", caller(), 0, 0, 0, GLOBAL_ZONEID); + + vuprintf(fmt, adx); + va_end(adx); } -- cgit v1.2.3