HomeFreeBSD

dmesg: detect wrapped msgbuf on the kernel side and if so, skip first line

Description

dmesg: detect wrapped msgbuf on the kernel side and if so, skip first line

Since 59f256ec35d3 dmesg(8) will always skip first line of the message
buffer, cause it might be incomplete. The problem is that in most cases
it is complete, valid and contains the "---<<BOOT>>---" marker. This
skip can be disabled with '-a', but that would also unhide all non-kernel
messages. Move this functionality from dmesg(8) to kernel, since kernel
actually knows if wrap has happened or not.

The main motivation for the change is not actually the value of the
"---<<BOOT>>---" marker. The problem breaks unit tests, that clear
message buffer, perform a test and then check the message buffer for
a result. Example of such test is sys/kern/sonewconn_overflow.

Details

Provenance
glebiusAuthored on Feb 5 2022, 9:25 PM
Parents
rG6598559fdf0c: Update to bmake-20220204
Branches
Unknown
Tags
Unknown