Module Name:    src
Committed By:   riastradh
Date:           Mon Jul 17 22:57:35 UTC 2023

Modified Files:
        src/sys/kern: subr_prf.c

Log Message:
device_printf(9): Lock to avoid interleaving output.

XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/kern/subr_prf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_prf.c
diff -u src/sys/kern/subr_prf.c:1.200 src/sys/kern/subr_prf.c:1.201
--- src/sys/kern/subr_prf.c:1.200	Wed Apr 12 06:35:26 2023
+++ src/sys/kern/subr_prf.c	Mon Jul 17 22:57:35 2023
@@ -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();
 }
 
 /*

Reply via email to