Author: kevans
Date: Thu Aug  9 01:32:09 2018
New Revision: 337518
URL: https://svnweb.freebsd.org/changeset/base/337518

Log:
  kern: Add a BOOT_TAG marker at the beginning of boot dmesg
  
  From the "newly licensed to drive" PR department, add a BOOT_TAG marker (by
  default, --<<BOOT>>--, to the beginning of each boot's dmesg. This makes it
  easier to do textproc magic to locate the start of each boot and, of
  particular interest to some, the dmesg of the current boot.
  
  The PR has a dmesg(8) component as well that I've opted not to include for
  the moment- it was the more contentious part of this PR.
  
  bde@ also made the statement that this boot tag should be written with an
  ordinary printf, which I've- for the moment- declined to change about this
  patch to keep it more transparent to observer of the boot process.
  
  PR:           43434
  Submitted by: dak <[email protected]> (basically rewritten)
  MFC after:    maybe never

Modified:
  head/sys/kern/subr_prf.c
  head/sys/sys/msgbuf.h

Modified: head/sys/kern/subr_prf.c
==============================================================================
--- head/sys/kern/subr_prf.c    Thu Aug  9 01:17:35 2018        (r337517)
+++ head/sys/kern/subr_prf.c    Thu Aug  9 01:32:09 2018        (r337518)
@@ -1027,6 +1027,7 @@ msgbufinit(void *ptr, int size)
        cp = (char *)ptr;
        msgbufp = (struct msgbuf *)(cp + size);
        msgbuf_reinit(msgbufp, cp, size);
+       msgbuf_addstr(msgbufp, -1, BOOT_TAG, 0);
        if (msgbufmapped && oldp != msgbufp)
                msgbuf_copy(oldp, msgbufp);
        msgbufmapped = 1;

Modified: head/sys/sys/msgbuf.h
==============================================================================
--- head/sys/sys/msgbuf.h       Thu Aug  9 01:17:35 2018        (r337517)
+++ head/sys/sys/msgbuf.h       Thu Aug  9 01:32:09 2018        (r337518)
@@ -60,6 +60,9 @@ struct msgbuf {
 /* Subtract sequence numbers.  Note that only positive values result. */
 #define        MSGBUF_SEQSUB(mbp, seq1, seq2)  (MSGBUF_SEQNORM((mbp), (seq1) - 
(seq2)))
 
+/* Tag used to mark the start of a boot in dmesg */
+#define        BOOT_TAG  "---<<BOOT>>---"
+
 #ifdef _KERNEL
 extern int     msgbufsize;
 extern int     msgbuftrigger;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to