diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2022-02-05 21:25:38 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2022-02-05 21:35:31 +0000 |
commit | c999e3481d936980354d09e3d6a138e5dde5fabc (patch) | |
tree | c7defc12c617ab0487123aa6922fada00acaec66 /sbin | |
parent | 6598559fdf0c6342b6c30229430c739c42dc9941 (diff) | |
download | src-c999e3481d936980354d09e3d6a138e5dde5fabc.tar.gz src-c999e3481d936980354d09e3d6a138e5dde5fabc.zip |
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.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dmesg/dmesg.c | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c index 469582204f7b..f266e6b98b39 100644 --- a/sbin/dmesg/dmesg.c +++ b/sbin/dmesg/dmesg.c @@ -184,10 +184,6 @@ main(int argc, char *argv[]) /* Strip leading \0's */ while (*p == '\0') p++; - } else if (!all) { - /* Skip the first line, since it is probably incomplete. */ - p = memchr(p, '\n', ep - p); - p++; } for (; p < ep; p = nextp) { nextp = memchr(p, '\n', ep - p); |