It will be better to support colors customization than use
ugly blue color. BTW, for example git-log uses brow/yellow too
by default.
This reverts commit 0b6fbc2599.
[kzak@redhat.com: - move paths to pathnames.h,
- use static path buffer]
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Earlier uptime determination, which was done with sysinfo(2), had one
second resolution, which made time stamps to be rounded unstable way
depending on when a dmesg command was executed. In practical terms; the
command below was supposed not to differ but it did.
$ diff -q <(dmesg --ctime) <(sleep 0.5 ; dmesg --ctime)
[kzak@redhat.com: - add -lrt to Makemodule.am,
- fallback to sysinfo() based boot time
- use #ifdef]
CC: Kay Sievers <kay@vrfy.org>
References: https://lkml.org/lkml/2013/6/30/37
Buglink: https://github.com/karelzak/util-linux/issues/24
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
The ISO-8601 should be welcomed by anyone who tries to parse dmesg time
stamp, and compare them across servers. Time format tries to imitate
coreutils 'date --iso-8601=ns' output, but instead of having nanoseconds
the dmesg is using microseconds.
Reference: http://www.cs.tut.fi/~jkorpela/iso8601.html
Addresses: http://xkcd.com/1179/
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Delete EXCL_ACT_ERR and EXCL_SYS_ERR defines:
usage is removed in 43d2eeef5dd3a64c372dbf60e4a32aa9e97b4645:
"dmesg: use err_exclusive_options()"
Signed-off-by: Karel Zak <kzak@redhat.com>
When user runs with --color it should not need to be combined with
filtering per level or facility, or decoding.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The dmesg should not crash while --decode'ing message facilities and
levels to readable string even if the values are out of bounds.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
commit f06ec64f dmesg; support level names (e.g. --console-level=alert)
introduced an off-by-one error. The kernel will print messages with
a *higher* level than the console-level. The bug made it impossible to
set the level for debugging, like it is documented in e.g
Documentation/networking/netconsole.txt :
nemi:/tmp# dmesg -n 8
dmesg: unknown level '8'
And attempting to set the "emerg" level would result in an invalid 0 value:
nemi:/tmp# dmesg -n emerg
dmesg: klogctl failed: Invalid argument
Restoring the old behaviour for numeric levels, and mapping the level
names so that "dmesg -n debug" behaves as expected: logging everything
at level "debug" and higher.
[kzak@redhat.com: - add comment to parse_level()]
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Karel Zak <kzak@redhat.com>
The /dev/kmsg can return EPIPE if current record has beed modified
while reading.
For init_kmsg, it cause switch to DMESG_METHOD_SYSLOG
(which is not expected) and later it can truncate output.
Signed-off-by: Milan Broz <mbroz@redhat.com>
On old kernels (<3.5) kernel allows to open read-only /dev/kmsg for
root, but read() returns -EINVAL. It means that open() is not enough
to detect /dev/kmsg usability. We have to call read() (or epoll).
Reported-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Fix to small regression which made 'dmesg --clear' not to error
when running without root privileges. Same happen with '-D' and
few other options as well.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>