* If the kernel is quickly adding to the dmesg buffer and has not started
recycling the FIFO the increasing size of the buffer will exceed the
probed size.
* Add another 4K to the probed size to try to deal with this case.
/* Running kernel. Use sysctl. */
if (sysctlbyname("kern.msgbuf", NULL, &buflen, NULL, 0) == -1)
err(1, "sysctl kern.msgbuf");
+ buflen += 4096; /* add some slop */
if ((bp = malloc(buflen)) == NULL)
errx(1, "malloc failed");
if (sysctlbyname("kern.msgbuf", bp, &buflen, NULL, 0) == -1)