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 <aurelien.nephtali@wanadoo.fr> (basically rewritten)
MFC after:	maybe never
This commit is contained in:
Kyle Evans 2018-08-09 01:32:09 +00:00
parent b8ac5c5a01
commit 2834d61202
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=337518
2 changed files with 4 additions and 0 deletions

View File

@ -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;

View File

@ -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;