kernel: Write parts of truncated messages to the log.

In case any one message (or, more likely, importing the bootloader's
syslog buffer) is too large for our buffer, do not discard it, but
keep as much as we can, and print <TRUNC> at the beginning of it,
to distinguish from <DROP>. (Documentation already notes <TRUNC> as
a possible thing to find in the syslog.)
This commit is contained in:
Augustin Cavalier
2021-09-16 15:04:54 -04:00
parent 7fd1fb8745
commit 7cde125283
+4 -2
View File
@@ -1269,8 +1269,10 @@ syslog_write(const char* text, int32 length, bool notify)
return;
if (length > sSyslogBuffer->size) {
text = "<DROP>";
length = 6;
syslog_write("<TRUNC>", 7, false);
text += length - (sSyslogBuffer->size - 7);
length = sSyslogBuffer->size - 7;
}
int32 writable = ring_buffer_writable(sSyslogBuffer);