forked from pool/busybox
33 lines
883 B
Diff
33 lines
883 B
Diff
---
|
|
util-linux/dmesg.c | 10 +++++++++-
|
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
|
Index: busybox-1.4.2/util-linux/dmesg.c
|
|
===================================================================
|
|
--- busybox-1.4.2.orig/util-linux/dmesg.c
|
|
+++ busybox-1.4.2/util-linux/dmesg.c
|
|
@@ -13,6 +13,14 @@
|
|
#include <unistd.h>
|
|
#include <sys/klog.h>
|
|
|
|
+static int kernel_ringbuffer_size(void)
|
|
+{
|
|
+ int len = klogctl(10, NULL, 0);
|
|
+ if (len > 0)
|
|
+ return len;
|
|
+ return 16384;
|
|
+}
|
|
+
|
|
int dmesg_main(int argc, char *argv[])
|
|
{
|
|
char *size, *level;
|
|
@@ -25,7 +33,7 @@ int dmesg_main(int argc, char *argv[])
|
|
int len;
|
|
char *buf;
|
|
|
|
- len = (flags & 2) ? xatoul_range(size, 2, INT_MAX) : 16384;
|
|
+ len = (flags & 2) ? xatoul_range(size, 2, INT_MAX) : kernel_ringbuffer_size();
|
|
buf = xmalloc(len);
|
|
if (0 > (len = klogctl(3 + (flags & 1), buf, len)))
|
|
bb_perror_msg_and_die("klogctl");
|