diff options
author | Karel Zak | 2006-12-07 00:25:35 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:25:35 +0100 |
commit | 2b6fc908bc368b540845a313c3b8a867c5ad9a42 (patch) | |
tree | 6fad48a239bc90515a5dc4084d6e3c3ee1f41e29 /sys-utils/dmesg.c | |
parent | Imported from util-linux-2.7.1 tarball. (diff) | |
download | kernel-qcow2-util-linux-2b6fc908bc368b540845a313c3b8a867c5ad9a42.tar.gz kernel-qcow2-util-linux-2b6fc908bc368b540845a313c3b8a867c5ad9a42.tar.xz kernel-qcow2-util-linux-2b6fc908bc368b540845a313c3b8a867c5ad9a42.zip |
Imported from util-linux-2.8 tarball.
Diffstat (limited to 'sys-utils/dmesg.c')
-rw-r--r-- | sys-utils/dmesg.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c index 56beb3fea..bfb488f96 100644 --- a/sys-utils/dmesg.c +++ b/sys-utils/dmesg.c @@ -4,6 +4,8 @@ * Copyright 1993 Theodore Ts'o (tytso@athena.mit.edu) * This program comes with ABSOLUTELY NO WARRANTY. * Modifications by Rick Sladkey (jrs@world.std.com) + * Larger buffersize 3 June 1998 by Nicolai Langfeldt, based on a patch + * by Peeter Joot. This was also suggested by John Hudson. */ #include <linux/unistd.h> @@ -29,12 +31,13 @@ static char *progname; void usage() { - fprintf( stderr, "Usage: %s [-c] [-n level]\n", progname ); + fprintf( stderr, "Usage: %s [-c] [-n level] [-s bufsize]\n", progname ); } int main( int argc, char *argv[] ) { - char buf[4096]; + char *buf; + int bufsize=8196; int i; int n; int c; @@ -43,7 +46,7 @@ int main( int argc, char *argv[] ) int cmd = 3; progname = argv[0]; - while ((c = getopt( argc, argv, "cn:" )) != EOF) { + while ((c = getopt( argc, argv, "cn:s:" )) != EOF) { switch (c) { case 'c': cmd = 4; @@ -52,6 +55,9 @@ int main( int argc, char *argv[] ) cmd = 8; level = atoi(optarg); break; + case 's': + bufsize = atoi(optarg); + break; case '?': default: usage(); @@ -75,7 +81,9 @@ int main( int argc, char *argv[] ) exit( 0 ); } - n = klogctl( cmd, buf, sizeof( buf ) ); + if (bufsize < 4096) bufsize = 4096; + buf = (char*)malloc(bufsize); + n = klogctl( cmd, buf, bufsize ); if (n < 0) { perror( "klogctl" ); exit( 1 ); |