aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2018-08-10 15:29:06 +0000
committerKyle Evans <kevans@FreeBSD.org>2018-08-10 15:29:06 +0000
commit170bc29131a5826050bdc6e91647741efcff2a6d (patch)
tree02fbd17a355f3e3c7fab56be00cc0f0a6e0381aa /sys
parent3d19db5dfb957aa57cce016c0df7711fc5269e44 (diff)
downloadsrc-170bc29131a5826050bdc6e91647741efcff2a6d.tar.gz
src-170bc29131a5826050bdc6e91647741efcff2a6d.zip
boot tagging: minor fixes
msgbufinit may be called multiple times as we initialize the msgbuf into a progressively larger buffer. This doesn't happen as of now on head, but it may happen in the future and we generally support this. As such, only print the boot tag if we've just initialized the buffer for the first time. The boot tag also now has a newline appended to it for better visibility, and has been switched to a normal printf, by requesto f bde, after we've denoted that the msgbuf is mapped.
Notes
Notes: svn path=/head/; revision=337579
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_prf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index f1bc4c295a64..ef295f206227 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -1033,20 +1033,24 @@ void
msgbufinit(void *ptr, int size)
{
char *cp;
- static struct msgbuf *oldp = NULL;
+ static struct msgbuf *oldp;
+ bool print_boot_tag;
+ oldp = NULL;
size -= sizeof(*msgbufp);
cp = (char *)ptr;
+ print_boot_tag = !msgbufmapped;
/* Attempt to fetch kern.boot_tag tunable on first mapping */
if (!msgbufmapped)
TUNABLE_STR_FETCH("kern.boot_tag", current_boot_tag,
sizeof(current_boot_tag));
msgbufp = (struct msgbuf *)(cp + size);
msgbuf_reinit(msgbufp, cp, size);
- msgbuf_addstr(msgbufp, -1, current_boot_tag, 0);
if (msgbufmapped && oldp != msgbufp)
msgbuf_copy(oldp, msgbufp);
msgbufmapped = true;
+ if (print_boot_tag)
+ printf("%s\n", current_boot_tag);
oldp = msgbufp;
}