summaryrefslogtreecommitdiffstats
path: root/sys-utils/dmesg.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "dmesg: don't use brow/yellow in output"Karel Zak2014-04-231-1/+1
| | | | | | | | 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 0b6fbc25990d9498956e06bfcf699fca094e24a9.
* dmesg: don't use brow/yellow in outputKarel Zak2014-04-011-1/+1
| | | | | | | The color used for subsystem prefix is useless on while background. Let's use blue. Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: don't report EPIPEKarel Zak2014-03-131-2/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: check for /etc/terminal-colors.d/[util].disableOndrej Oprala2014-03-111-2/+2
| | | | | | | | [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>
* dmesg: -w output not line-bufferedKarel Zak2014-02-061-0/+2
| | | | | | | | when writing to e.g. a pipe, output from dmesg -w can come many minutes late due to buffering. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1060925 Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: fix --raw zero timestamp for kmsgKarel Zak2014-01-071-8/+12
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1049438 Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: properly use uppercase in certain abbreviationsBenno Schulenberg2013-10-081-1/+1
| | | | | Reported-by: Petr Písař <petr.pisar@atlas.cz> Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* dmesg: don't use pager for --followKarel Zak2013-07-291-1/+2
| | | | | References: https://bugzilla.redhat.com/show_bug.cgi?id=984666 Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: inform user --show-delta and iso8601 time format does not mixSami Kerola2013-07-091-0/+3
| | | | | References: http://marc.info/?l=util-linux-ng&m=137267606929951&w=2 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: make time stamps to be printed consistentlySami Kerola2013-07-011-10/+22
| | | | | | | | | | | | | | | | | | | 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>
* dmesg: define is_timefmt() macro only onceKarel Zak2013-07-011-5/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: fix --human color initializationKarel Zak2013-07-011-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: regroup time related options close to each otherSami Kerola2013-07-011-6/+6
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: add iso-8601 time formatSami Kerola2013-07-011-3/+26
| | | | | | | | | | | 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>
* dmesg: add --time-format optionSami Kerola2013-07-011-0/+22
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: convert time format bitfield to enumSami Kerola2013-07-011-82/+77Star
| | | | | | Foremost this commit makes time printing formats explicit. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/colors: add colormode_or_err()Karel Zak2013-05-071-6/+3Star
| | | | | | ... to make the code easy to use in utils. Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: fix usage() typoSami Kerola2013-05-061-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: support --color[={auto,always,never}]Karel Zak2013-05-061-6/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: minor cleanup of EXCL_xxx_ERR macrosAndrii Bordunov2013-04-231-3/+0Star
| | | | | | | | 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>
* dmesg: fix usage() output consistancySami Kerola2013-04-051-2/+2
| | | | | | | Possible facilities and levels are meant to be printed to same file as the rest of the usage output. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: use $PAGER for --human output, add --nopagerKarel Zak2013-03-181-4/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: add --humanKarel Zak2013-03-181-6/+19
| | | | | | | | * enable --reltime * enable --color * a little bit cleanup main() Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: more colors, more funKarel Zak2013-03-181-21/+101
| | | | | | | | * colorize subsystem prefix * colorize time * colorize by keywords (now "segfault" only) Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: fix usage()Karel Zak2013-01-301-1/+1
|
* dmesg: make usage() translator friendlySami Kerola2013-01-251-40/+35Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* dmesg: parse level when --color is usedSami Kerola2013-01-251-1/+1
| | | | | | | 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>
* dmesg: add boundary check to facility & level array usageSami Kerola2013-01-251-1/+3
| | | | | | | 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>
* dmesg: Add a --color option to colorize error and panic messagesOndrej Oprala2012-10-161-3/+38
| | | | | | | | [kzak@redhat.com: - update man page - colorize critical messages too] Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* dmesg: fix console-level off-by-oneBjørn Mork2012-10-021-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* dmesg: fix kmsg read if read returns EPIPEMilan Broz2012-08-131-3/+15
| | | | | | | | | | 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>
* dmesg: fix kmsg usability detectionKarel Zak2012-08-021-12/+35
| | | | | | | | | 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>
* dmesg: improve err handling codeKarel Zak2012-07-261-13/+12Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: inform user when klogctl() or read_buffer() failsSami Kerola2012-07-261-5/+8
| | | | | | | | 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>
* dmesg: use err_exclusive_options()Karel Zak2012-07-261-20/+10Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: fix usage()Karel Zak2012-07-201-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: add --reltime to print human readable deltasKarel Zak2012-07-201-18/+73
| | | | | | | | | | | | | | | | | [Jul20 09:50] device vnet0 entered promiscuous mode [ +0.002248] virbr0: topology change detected, propagating [ +0.000017] virbr0: port 2(vnet0) entered forwarding state [ +0.000036] virbr0: port 2(vnet0) entered forwarding state [ +0.001663] ADDRCONF(NETDEV_CHANGE): virbr0: link becomes ready [ +10.480914] vnet0: no IPv6 routers present [Jul20 14:35] xhci_hcd 0000:0e:00.0: WARN Event TRB for slot 3 ep 5 with no TDs queued? [Jul20 19:23] EXT4-fs (sda2): re-mounted. Opts: (null) [ +6.052980] EXT4-fs (sda2): re-mounted. Opts: (null) Suggested by Linus: http://thread.gmane.org/gmane.linux.kernel/1290886/focus=1296138 Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg; cleanup time printing stuffKarel Zak2012-07-201-14/+35
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: implement backwardly compatible --raw for /dev/kmsgKarel Zak2012-07-201-0/+12
| | | | | | .. and if you really want raw data from /dev/kmsg then use dd(1) ;-) Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: cleanup exclusive_option() usageKarel Zak2012-07-201-10/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: add --follow featureKarel Zak2012-07-201-5/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: support --clear for kmsgKarel Zak2012-07-201-1/+13
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: read /dev/kmsg (since kernel 3.5.0)Karel Zak2012-07-201-28/+202
| | | | | | | | | | | kmsg advantages: - extendible format - tags for messages - one read() returns one complete record See kernel Documentation/ABI/testing/dev-kmsg. Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: add --syslog to force to old syslog(2) interfaceKarel Zak2012-07-191-2/+7
| | | | | | | ... just for debugging or for people who somehow depends on syslog(2) behavior. Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: refactoring for kmsg supportKarel Zak2012-07-191-48/+71
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: unify internal APIsKarel Zak2012-07-191-18/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: cleanup, move more stuff to control structKarel Zak2012-07-191-33/+54
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: move filename to control structKarel Zak2012-07-191-13/+18
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* translation: unify file open error messagesSami Kerola2012-07-161-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* translation: unify stat error messagesSami Kerola2012-07-161-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>