Module Name: src Committed By: simonb Date: Wed Mar 10 13:27:51 UTC 2021
Modified Files: src/distrib/sets/lists/comp: mi src/share/man/man9: Makefile kprintf.9 src/sys/kern: subr_prf.c src/sys/sys: systm.h Log Message: Add printf_nostamp(9), kernel printf() without prepending a timestamp. To generate a diff of this commit: cvs rdiff -u -r1.2375 -r1.2376 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.455 -r1.456 src/share/man/man9/Makefile cvs rdiff -u -r1.39 -r1.40 src/share/man/man9/kprintf.9 cvs rdiff -u -r1.185 -r1.186 src/sys/kern/subr_prf.c cvs rdiff -u -r1.298 -r1.299 src/sys/sys/systm.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.2375 src/distrib/sets/lists/comp/mi:1.2376 --- src/distrib/sets/lists/comp/mi:1.2375 Fri Feb 26 03:08:25 2021 +++ src/distrib/sets/lists/comp/mi Wed Mar 10 13:27:51 2021 @@ -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 Index: src/share/man/man9/Makefile diff -u src/share/man/man9/Makefile:1.455 src/share/man/man9/Makefile:1.456 --- src/share/man/man9/Makefile:1.455 Sun Jan 24 17:29:11 2021 +++ src/share/man/man9/Makefile Wed Mar 10 13:27:51 2021 @@ -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 @@ MLINKS+=kpreempt.9 kpreempt_disable.9 \ 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 \ Index: src/share/man/man9/kprintf.9 diff -u src/share/man/man9/kprintf.9:1.39 src/share/man/man9/kprintf.9:1.40 --- src/share/man/man9/kprintf.9:1.39 Tue May 21 09:24:21 2019 +++ src/share/man/man9/kprintf.9 Wed Mar 10 13:27:51 2021 @@ -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 @@ The 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 , Index: src/sys/kern/subr_prf.c diff -u src/sys/kern/subr_prf.c:1.185 src/sys/kern/subr_prf.c:1.186 --- src/sys/kern/subr_prf.c:1.185 Sat Jul 11 07:14:53 2020 +++ src/sys/kern/subr_prf.c Wed Mar 10 13:27:51 2021 @@ -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_nolog(const char *fmt, ...) } /* + * 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 */ Index: src/sys/sys/systm.h diff -u src/sys/sys/systm.h:1.298 src/sys/sys/systm.h:1.299 --- src/sys/sys/systm.h:1.298 Fri Aug 28 12:43:24 2020 +++ src/sys/sys/systm.h Wed Mar 10 13:27:51 2021 @@ -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_tolog(const char *, ...) __p 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);