git: c545a7b2c7db - main - prf: add setting of msgbuftrigger in paths where it is missing

From: Chuck Silvers <chs_at_FreeBSD.org>
Date: Fri, 13 Oct 2023 22:02:48 UTC
The branch main has been updated by chs:

URL: https://cgit.FreeBSD.org/src/commit/?id=c545a7b2c7db90b7647ef0a4f1fce05e4d7664a0

commit c545a7b2c7db90b7647ef0a4f1fce05e4d7664a0
Author:     Chuck Silvers <chs@FreeBSD.org>
AuthorDate: 2023-10-13 22:00:34 +0000
Commit:     Chuck Silvers <chs@FreeBSD.org>
CommitDate: 2023-10-13 22:02:37 +0000

    prf: add setting of msgbuftrigger in paths where it is missing
    
    Logging things to msgbuf is supposed to set msgbuftrigger so that
    syslogd will notice that there is more to read from /dev/klog,
    but several paths do not do that.  Add the missing trigger.
    
    Reviewed by:    imp, kib
    Differential Revision:  https://reviews.freebsd.org/D42173
---
 sys/kern/subr_prf.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index f2be2f0dc664..5c06bf8270f6 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -422,8 +422,10 @@ static void
 prf_putchar(int c, int flags, int pri)
 {
 
-	if (flags & TOLOG)
+	if (flags & TOLOG) {
 		msglogchar(c, pri);
+		msgbuftrigger = 1;
+	}
 
 	if (flags & TOCONS) {
 		if ((!KERNEL_PANICKED()) && (constty != NULL))
@@ -438,8 +440,10 @@ static void
 prf_putbuf(char *bufr, int flags, int pri)
 {
 
-	if (flags & TOLOG)
+	if (flags & TOLOG) {
 		msglogstr(bufr, pri, /*filter_cr*/1);
+		msgbuftrigger = 1;
+	}
 
 	if (flags & TOCONS) {
 		if ((!KERNEL_PANICKED()) && (constty != NULL))