Source-Changes-HG archive

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

[src/trunk]: src/sys/kern device_printf(9): Lock to avoid interleaving output.



details:   https://anonhg.NetBSD.org/src/rev/2637730b2502
branches:  trunk
changeset: 377573:2637730b2502
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Jul 17 22:57:35 2023 +0000

description:
device_printf(9): Lock to avoid interleaving output.

XXX pullup-9
XXX pullup-10

diffstat:

 sys/kern/subr_prf.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r c06633eecdf4 -r 2637730b2502 sys/kern/subr_prf.c
--- a/sys/kern/subr_prf.c       Mon Jul 17 21:51:45 2023 +0000
+++ b/sys/kern/subr_prf.c       Mon Jul 17 22:57:35 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_prf.c,v 1.200 2023/04/12 06:35:26 riastradh Exp $ */
+/*     $NetBSD: subr_prf.c,v 1.201 2023/07/17 22:57:35 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.200 2023/04/12 06:35:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.201 2023/07/17 22:57:35 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1241,11 +1241,12 @@ device_printf(device_t dev, const char *
 {
        va_list ap;
 
+       kprintf_lock();
+       kprintf_internal("%s: ", TOCONS|TOLOG, NULL, NULL, device_xname(dev));
        va_start(ap, fmt);
-       printf("%s: ", device_xname(dev));
-       vprintf(fmt, ap);
+       kprintf(fmt, TOCONS|TOLOG, NULL, NULL, ap);
        va_end(ap);
-       return;
+       kprintf_unlock();
 }
 
 /*



Home | Main Index | Thread Index | Old Index