From owner-svn-src-all@FreeBSD.ORG Sat Sep 7 07:53:21 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E636FC28; Sat, 7 Sep 2013 07:53:21 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BA8CE2130; Sat, 7 Sep 2013 07:53:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r877rLmR080379; Sat, 7 Sep 2013 07:53:21 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r877rLs0080377; Sat, 7 Sep 2013 07:53:21 GMT (envelope-from np@svn.freebsd.org) Message-Id: <201309070753.r877rLs0080377@svn.freebsd.org> From: Navdeep Parhar Date: Sat, 7 Sep 2013 07:53:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255351 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Sep 2013 07:53:22 -0000 Author: np Date: Sat Sep 7 07:53:21 2013 New Revision: 255351 URL: http://svnweb.freebsd.org/changeset/base/255351 Log: Add a vtprintf. It is to tprintf what vprintf is to printf. Reviewed by: kib Modified: head/sys/kern/subr_prf.c head/sys/sys/systm.h Modified: head/sys/kern/subr_prf.c ============================================================================== --- head/sys/kern/subr_prf.c Sat Sep 7 07:39:24 2013 (r255350) +++ head/sys/kern/subr_prf.c Sat Sep 7 07:53:21 2013 (r255351) @@ -175,15 +175,24 @@ out: } /* - * tprintf prints on the controlling terminal associated with the given - * session, possibly to the log as well. + * tprintf and vtprintf print on the controlling terminal associated with the + * given session, possibly to the log as well. */ void tprintf(struct proc *p, int pri, const char *fmt, ...) { + va_list ap; + + va_start(ap, fmt); + vtprintf(p, pri, fmt, ap); + va_end(ap); +} + +void +vtprintf(struct proc *p, int pri, const char *fmt, va_list ap) +{ struct tty *tp = NULL; int flags = 0; - va_list ap; struct putchar_arg pca; struct session *sess = NULL; @@ -208,13 +217,11 @@ tprintf(struct proc *p, int pri, const c pca.tty = tp; pca.flags = flags; pca.p_bufr = NULL; - va_start(ap, fmt); if (pca.tty != NULL) tty_lock(pca.tty); kvprintf(fmt, putchar, &pca, 10, ap); if (pca.tty != NULL) tty_unlock(pca.tty); - va_end(ap); if (sess != NULL) sess_release(sess); msgbuftrigger = 1; Modified: head/sys/sys/systm.h ============================================================================== --- head/sys/sys/systm.h Sat Sep 7 07:39:24 2013 (r255350) +++ head/sys/sys/systm.h Sat Sep 7 07:53:21 2013 (r255351) @@ -212,6 +212,7 @@ u_long strtoul(const char *, char **, in quad_t strtoq(const char *, char **, int) __nonnull(1); u_quad_t strtouq(const char *, char **, int) __nonnull(1); void tprintf(struct proc *p, int pri, const char *, ...) __printflike(3, 4); +void vtprintf(struct proc *, int, const char *, __va_list) __printflike(3, 0); void hexdump(const void *ptr, int length, const char *hdr, int flags); #define HD_COLUMN_MASK 0xff #define HD_DELIM_MASK 0xff00