Last change
on this file since 940 was 821, checked in by Bruno Cornec, 18 years ago |
Addition of busybox 1.2.1 as a mindi-busybox new package
This should avoid delivering binary files in mindi not built there (Fedora and Debian are quite serious about that)
|
File size:
806 bytes
|
Rev | Line | |
---|
[821] | 1 | /* vi: set ts=4:
|
---|
| 2 | *
|
---|
| 3 | * dmesg - display/control kernel ring buffer.
|
---|
| 4 | *
|
---|
| 5 | * Copyring 2006 Rob Landley <rob@landley.net>
|
---|
| 6 | *
|
---|
| 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | #include "busybox.h"
|
---|
| 11 | #include <unistd.h>
|
---|
| 12 | #include <sys/klog.h>
|
---|
| 13 |
|
---|
| 14 | int dmesg_main(int argc, char *argv[])
|
---|
| 15 | {
|
---|
| 16 | char *size, *level;
|
---|
| 17 | int flags = bb_getopt_ulflags(argc, argv, "cs:n:", &size, &level);
|
---|
| 18 |
|
---|
| 19 | if (flags & 4) {
|
---|
| 20 | if(klogctl(8, NULL, bb_xgetlarg(level, 10, 0, 10)))
|
---|
| 21 | bb_perror_msg_and_die("klogctl");
|
---|
| 22 | } else {
|
---|
| 23 | int len;
|
---|
| 24 | char *buf;
|
---|
| 25 |
|
---|
| 26 | len = (flags & 2) ? bb_xgetlarg(size, 10, 2, INT_MAX) : 16384;
|
---|
| 27 | buf = xmalloc(len);
|
---|
| 28 | if (0 > (len = klogctl(3 + (flags & 1), buf, len)))
|
---|
| 29 | bb_perror_msg_and_die("klogctl");
|
---|
| 30 | write(1,buf,len);
|
---|
| 31 | if (len && buf[len-1]!='\n') putchar('\n');
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | return 0;
|
---|
| 35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.