Search
j0ke.net Open Build Service
>
Projects
>
stresslinux
>
busybox
> busybox.dmesg-size.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File busybox.dmesg-size.patch of Package busybox (Revision 15)
Currently displaying revision
15
,
show latest
--- util-linux/dmesg.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c @@ -12,6 +12,14 @@ #include <sys/klog.h> #include "libbb.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) MAIN_EXTERNALLY_VISIBLE; int dmesg_main(int argc, char **argv) { @@ -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");