I wasted a bunch of time wondering why even when I increased 
CONFIG_LOG_BUF_SHIFT I was missing 
the first half second of my boot logs from dmesg.  I saw a bunch of linux code 
referencing early_printk, 
and thought there was some magic crossover time when things actually started 
going to the log buffer. 

I didn't even think to read the dmesg man page because it never even occurred 
to me that dmesg would be 
dumb enough to hard code the size of the kernel buffer.

If you would kindly apply this patch, you would be doing humanity a great 
service by ensuring that nobody ever 
wastes time because of this again.

---
 util-linux/dmesg.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c
index f52026c..236a3dc 100644
--- a/util-linux/dmesg.c
+++ b/util-linux/dmesg.c
@@ -31,7 +31,13 @@ int dmesg_main(int argc UNUSED_PARAM, char **argv)
                return EXIT_SUCCESS;
        }
 
-       len = (flags & OPT_s) ? xatoul_range(size, 2, INT_MAX) : 16384;
+       if (flags & OPT_s) {
+               len = xatoul_range(size, 2, INT_MAX);
+       } else {
+               len = klogctl(10, NULL, 0);       /* read ringbuffer size */
+               if (len <= 0)
+                       len = 16384;
+       }
        buf = xmalloc(len);
        len = klogctl(3 + (flags & OPT_c), buf, len);
        if (len < 0)
-- 
1.6.2.3

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to