Author: kevans
Date: Fri Aug 10 15:29:06 2018
New Revision: 337579
URL: https://svnweb.freebsd.org/changeset/base/337579

Log:
  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.

Modified:
  head/sys/kern/subr_prf.c

Modified: head/sys/kern/subr_prf.c
==============================================================================
--- head/sys/kern/subr_prf.c    Fri Aug 10 15:16:41 2018        (r337578)
+++ head/sys/kern/subr_prf.c    Fri Aug 10 15:29:06 2018        (r337579)
@@ -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;
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to