Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Add printf_nostamp(9), kernel printf() without prepe...



details:   https://anonhg.NetBSD.org/src/rev/164f82ced8e7
branches:  trunk
changeset: 960172:164f82ced8e7
user:      simonb <simonb%NetBSD.org@localhost>
date:      Wed Mar 10 13:27:51 2021 +0000

description:
Add printf_nostamp(9), kernel printf() without prepending a timestamp.

diffstat:

 distrib/sets/lists/comp/mi |   5 ++++-
 share/man/man9/Makefile    |   4 ++--
 share/man/man9/kprintf.9   |  12 ++++++++++--
 sys/kern/subr_prf.c        |  18 ++++++++++++++++--
 sys/sys/systm.h            |   4 +++-
 5 files changed, 35 insertions(+), 8 deletions(-)

diffs (154 lines):

diff -r c4acac49f8bf -r 164f82ced8e7 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Wed Mar 10 11:03:48 2021 +0000
+++ b/distrib/sets/lists/comp/mi        Wed Mar 10 13:27:51 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: mi,v 1.2375 2021/02/26 03:08:25 christos Exp $
+#      $NetBSD: mi,v 1.2376 2021/03/10 13:27:51 simonb Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.comp                           comp-sys-root
@@ -12043,6 +12043,7 @@
 ./usr/share/man/cat9/preempt.0                 comp-sys-catman         .cat
 ./usr/share/man/cat9/printf.0                  comp-sys-catman         .cat
 ./usr/share/man/cat9/printf_nolog.0            comp-sys-catman         .cat
+./usr/share/man/cat9/printf_nostamp.0          comp-sys-catman         .cat
 ./usr/share/man/cat9/proc_find.0               comp-sys-catman         .cat
 ./usr/share/man/cat9/proc_trampoline.0         comp-obsolete           obsolete
 ./usr/share/man/cat9/profhz.0                  comp-sys-catman         .cat
@@ -20213,6 +20214,7 @@
 ./usr/share/man/html9/preempt.html             comp-sys-htmlman        html
 ./usr/share/man/html9/printf.html              comp-sys-htmlman        html
 ./usr/share/man/html9/printf_nolog.html                comp-sys-htmlman        html
+./usr/share/man/html9/printf_nostamp.html      comp-sys-htmlman        html
 ./usr/share/man/html9/proc_find.html           comp-sys-htmlman        html
 ./usr/share/man/html9/proc_trampoline.html     comp-obsolete           obsolete
 ./usr/share/man/html9/profhz.html              comp-sys-htmlman        html
@@ -28545,6 +28547,7 @@
 ./usr/share/man/man9/preempt.9                 comp-sys-man            .man
 ./usr/share/man/man9/printf.9                  comp-sys-man            .man
 ./usr/share/man/man9/printf_nolog.9            comp-sys-man            .man
+./usr/share/man/man9/printf_nostamp.9          comp-sys-man            .man
 ./usr/share/man/man9/proc_find.9               comp-sys-man            .man
 ./usr/share/man/man9/proc_trampoline.9         comp-obsolete           obsolete
 ./usr/share/man/man9/profhz.9                  comp-sys-man            .man
diff -r c4acac49f8bf -r 164f82ced8e7 share/man/man9/Makefile
--- a/share/man/man9/Makefile   Wed Mar 10 11:03:48 2021 +0000
+++ b/share/man/man9/Makefile   Wed Mar 10 13:27:51 2021 +0000
@@ -1,4 +1,4 @@
-#       $NetBSD: Makefile,v 1.455 2021/01/24 17:29:11 thorpej Exp $
+#       $NetBSD: Makefile,v 1.456 2021/03/10 13:27:51 simonb Exp $
 
 #      Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -464,7 +464,7 @@
        kpreempt.9 kpreempt_disabled.9 \
        kpreempt.9 kpreempt_enable.9
 MLINKS+=proc_find.9 pgrp_find.9
-MLINKS+=kprintf.9 printf.9 kprintf.9 printf_nolog.9 \
+MLINKS+=kprintf.9 printf.9 kprintf.9 printf_nolog.9 kprintf.9 printf_nostamp.9 \
        kprintf.9 snprintf.9 kprintf.9 vprintf.9 \
        kprintf.9 vsnprintf.9 kprintf.9 uprintf.9 kprintf.9 ttyprintf.9 \
        kprintf.9 tprintf.9 kprintf.9 tprintf_open.9 kprintf.9 tprintf_close.9 \
diff -r c4acac49f8bf -r 164f82ced8e7 share/man/man9/kprintf.9
--- a/share/man/man9/kprintf.9  Wed Mar 10 11:03:48 2021 +0000
+++ b/share/man/man9/kprintf.9  Wed Mar 10 13:27:51 2021 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: kprintf.9,v 1.39 2019/05/21 09:24:21 wiz Exp $
+.\"     $NetBSD: kprintf.9,v 1.40 2021/03/10 13:27:51 simonb Exp $
 .\"
 .\" Copyright (c) 1998, 2002, 2007, 2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,13 +27,14 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 20, 2019
+.Dd March 10, 2021
 .Dt KPRINTF 9
 .Os
 .Sh NAME
 .Nm device_printf ,
 .Nm printf ,
 .Nm printf_nolog ,
+.Nm printf_nostamp ,
 .Nm snprintf ,
 .Nm vasprintf ,
 .Nm vprintf ,
@@ -68,6 +69,8 @@
 .Fn printf "const char *format" "..."
 .Ft void
 .Fn printf_nolog "const char *format" "..."
+.Ft void
+.Fn printf_nostamp "const char *format" "..."
 .Ft int
 .Fn snprintf "char *buf" "size_t size" "const char *format" "..."
 .Ft int
@@ -140,6 +143,11 @@
 function is identical to
 .Fn printf ,
 except it does not send the data to the system log.
+The
+.Fn printf_nostamp
+function is identical to
+.Fn printf ,
+except it does not prefix the output with a timestamp.
 The functions
 .Fn snprintf ,
 .Fn vasprintf ,
diff -r c4acac49f8bf -r 164f82ced8e7 sys/kern/subr_prf.c
--- a/sys/kern/subr_prf.c       Wed Mar 10 11:03:48 2021 +0000
+++ b/sys/kern/subr_prf.c       Wed Mar 10 13:27:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_prf.c,v 1.185 2020/07/11 07:14:53 maxv Exp $      */
+/*     $NetBSD: subr_prf.c,v 1.186 2021/03/10 13:27:51 simonb Exp $    */
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.185 2020/07/11 07:14:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.186 2021/03/10 13:27:51 simonb Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1060,6 +1060,20 @@
 }
 
 /*
+ * printf_nostamp: Like printf(), but does not prepend a timestamp.
+ */
+
+void
+printf_nostamp(const char *fmt, ...)
+{
+       va_list ap;
+
+       va_start(ap, fmt);
+       vprintf_flags(TOCONS|NOTSTAMP, fmt, ap);
+       va_end(ap);
+}
+
+/*
  * normal kernel printf functions: printf, vprintf, snprintf, vsnprintf
  */
 
diff -r c4acac49f8bf -r 164f82ced8e7 sys/sys/systm.h
--- a/sys/sys/systm.h   Wed Mar 10 11:03:48 2021 +0000
+++ b/sys/sys/systm.h   Wed Mar 10 13:27:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: systm.h,v 1.298 2020/08/28 12:43:24 christos Exp $     */
+/*     $NetBSD: systm.h,v 1.299 2021/03/10 13:27:51 simonb Exp $       */
 
 /*-
  * Copyright (c) 1982, 1988, 1991, 1993
@@ -269,6 +269,8 @@
 
 void   printf_nolog(const char *, ...) __printflike(1, 2);
 
+void   printf_nostamp(const char *, ...) __printflike(1, 2);
+
 void   printf(const char *, ...) __printflike(1, 2);
 
 int    snprintf(char *, size_t, const char *, ...) __printflike(3, 4);



Home | Main Index | Thread Index | Old Index