diff options
author | np <np@FreeBSD.org> | 2013-09-07 07:53:21 +0000 |
---|---|---|
committer | np <np@FreeBSD.org> | 2013-09-07 07:53:21 +0000 |
commit | 24e0bcea209256960f8d7476c2e6fb93569913c4 (patch) | |
tree | 855e9befa58753476a0708573f3d38da773a75f9 /sys/kern/subr_prf.c | |
parent | cd54db1de6406b113b54b965f6701efd87a366a5 (diff) | |
download | FreeBSD-src-24e0bcea209256960f8d7476c2e6fb93569913c4.zip FreeBSD-src-24e0bcea209256960f8d7476c2e6fb93569913c4.tar.gz |
Add a vtprintf. It is to tprintf what vprintf is to printf.
Reviewed by: kib
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r-- | sys/kern/subr_prf.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index d8e8e05..042afa3 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -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 char *fmt, ...) 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; |