Commit Graph

159 Commits

Author SHA1 Message Date
Karel Zak d12d063b4a dmesg: add missing include
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-06 10:28:26 +02:00
Sami Kerola 929f939e6a dmesg: move get_boot_time() to lib/timeutils
In future the last(1) will use get_boot_time() as well.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-04 11:42:03 +01:00
Karel Zak 885717c63e Revert "dmesg: don't use brow/yellow in output"
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.
2014-04-23 11:09:44 +02:00
Karel Zak 0b6fbc2599 dmesg: don't use brow/yellow in output
The color used for subsystem prefix is useless on
while background. Let's use blue.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-04-01 14:32:38 +02:00
Karel Zak 97c3278925 dmesg: don't report EPIPE
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-03-13 12:39:09 +01:00
Ondrej Oprala d0c9ddc3cc lib/colors: check for /etc/terminal-colors.d/[util].disable
[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>
2014-03-11 09:38:09 +01:00
Karel Zak 3938c08cd5 dmesg: -w output not line-buffered
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>
2014-02-06 11:48:40 +01:00
Karel Zak 1a38ad5c32 dmesg: fix --raw zero timestamp for kmsg
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1049438
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-07 17:41:42 +01:00
Benno Schulenberg 4df288452e textual: properly use uppercase in certain abbreviations
Reported-by: Petr Písař <petr.pisar@atlas.cz>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-10-08 15:27:28 +02:00
Karel Zak 5042cdcf77 dmesg: don't use pager for --follow
References: https://bugzilla.redhat.com/show_bug.cgi?id=984666
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-29 13:51:35 +02:00
Sami Kerola e7ba987a04 dmesg: inform user --show-delta and iso8601 time format does not mix
References: http://marc.info/?l=util-linux-ng&m=137267606929951&w=2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-09 14:24:53 +02:00
Sami Kerola 3c5384d05d dmesg: make time stamps to be printed consistently
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>
2013-07-01 14:30:20 +02:00
Karel Zak 15a1e37168 dmesg: define is_timefmt() macro only once
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-01 11:29:06 +02:00
Karel Zak 81bd88e4f3 dmesg: fix --human color initialization
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-07-01 11:17:17 +02:00
Sami Kerola 06dd56f91c dmesg: regroup time related options close to each other
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-01 11:07:48 +02:00
Sami Kerola 8a8be309d4 dmesg: add iso-8601 time format
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>
2013-07-01 11:07:39 +02:00
Sami Kerola babf605d2c dmesg: add --time-format option
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-01 11:07:37 +02:00
Sami Kerola 776eabe751 dmesg: convert time format bitfield to enum
Foremost this commit makes time printing formats explicit.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-07-01 11:07:35 +02:00
Karel Zak b7faf99128 lib/colors: add colormode_or_err()
... to make the code easy to use in utils.

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-07 09:09:35 +02:00
Sami Kerola 30b44cf1e7 dmesg: fix usage() typo
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-05-06 19:26:58 +02:00
Karel Zak 9bc2b51a06 dmesg: support --color[={auto,always,never}]
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-05-06 19:11:28 +02:00
Andrii Bordunov 6a5e45180b dmesg: minor cleanup of EXCL_xxx_ERR macros
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>
2013-04-23 14:40:47 +02:00
Sami Kerola 963ac50734 dmesg: fix usage() output consistancy
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>
2013-04-05 13:55:57 +02:00
Karel Zak aa192520d3 dmesg: use $PAGER for --human output, add --nopager
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-18 14:05:24 +01:00
Karel Zak f0a3a1caac dmesg: add --human
* enable --reltime
 * enable --color
 * a little bit cleanup main()

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-18 12:38:28 +01:00
Karel Zak 5aaee63cdf dmesg: more colors, more fun
* colorize subsystem prefix
 * colorize time
 * colorize by keywords (now "segfault" only)

Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-18 12:28:32 +01:00
Karel Zak 0a86a1a66c dmesg: fix usage() 2013-01-30 15:36:21 +01:00
Sami Kerola fbbc4c88d5 dmesg: make usage() translator friendly
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-01-25 16:40:05 +01:00
Sami Kerola bb9013177c dmesg: parse level when --color is used
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>
2013-01-25 10:29:37 +01:00
Sami Kerola ae6288da84 dmesg: add boundary check to facility & level array usage
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>
2013-01-25 10:09:36 +01:00
Ondrej Oprala 098ce273ca dmesg: Add a --color option to colorize error and panic messages
[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>
2012-10-16 16:42:32 +02:00
Bjørn Mork 8c8fa302c1 dmesg: fix console-level off-by-one
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>
2012-10-02 11:43:10 +02:00
Milan Broz 4ceb601d21 dmesg: fix kmsg read if read returns EPIPE
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>
2012-08-13 15:54:57 +02:00
Karel Zak 298a073c2a dmesg: fix kmsg usability detection
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>
2012-08-02 17:39:14 +02:00
Karel Zak 6e9b06cc05 dmesg: improve err handling code
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26 14:02:15 +02:00
Sami Kerola c1b2cb7003 dmesg: inform user when klogctl() or read_buffer() fails
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>
2012-07-26 13:51:44 +02:00
Karel Zak 43d2eeef5d dmesg: use err_exclusive_options()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26 09:25:35 +02:00
Karel Zak 81ddbc7140 dmesg: fix usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-20 20:06:10 +02:00
Karel Zak 60464b1f1a dmesg: add --reltime to print human readable deltas
[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>
2012-07-20 19:53:44 +02:00
Karel Zak 0d1b330071 dmesg; cleanup time printing stuff
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-20 17:43:50 +02:00
Karel Zak 37b04d6cce dmesg: implement backwardly compatible --raw for /dev/kmsg
.. and if you really want raw data from /dev/kmsg then use dd(1) ;-)

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-20 14:41:25 +02:00
Karel Zak 30e0661830 dmesg: cleanup exclusive_option() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-20 14:11:20 +02:00
Karel Zak 0fd12a9697 dmesg: add --follow feature
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-20 14:04:48 +02:00
Karel Zak c677ffba97 dmesg: support --clear for kmsg
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-20 13:24:42 +02:00
Karel Zak ddca870aa9 dmesg: read /dev/kmsg (since kernel 3.5.0)
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>
2012-07-20 12:09:09 +02:00
Karel Zak ed61acc254 dmesg: add --syslog to force to old syslog(2) interface
... just for debugging or for people who somehow depends on syslog(2)
behavior.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-19 18:35:20 +02:00
Karel Zak 7af230601a dmesg: refactoring for kmsg support
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-19 18:33:20 +02:00
Karel Zak 7ff1f63f15 dmesg: unify internal APIs
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-19 17:25:22 +02:00
Karel Zak e6471b9fc5 dmesg: cleanup, move more stuff to control struct
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-19 17:01:05 +02:00
Karel Zak 9b3a698427 dmesg: move filename to control struct
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-19 16:33:08 +02:00
Sami Kerola 289dcc9023 translation: unify file open error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Sami Kerola add1b8afd0 translation: unify stat error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-07-16 18:18:22 +02:00
Sami Kerola 9492013429 dmesg: use exclusive_option()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-17 17:59:59 +02:00
Karel Zak 20a3998222 sys-utils: cleanup strtoxx_or_err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 17:45:17 +02:00
Petr Uzel e12c9866b5 include: rename writeall.h to all-io.h
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2012-05-15 11:32:27 +02:00
Bernhard Voelker 455fe9a075 Fix typos found by misspellings
The tool misspellings (https://github.com/lyda/misspell-check)
detected several typos. Command used:

  $ git ls-files | grep -v ^po/ | misspellings -f -

* isosize: Fix typo in usage string.
* configure.ac: Fix typo in help string of --enable-most-builds option.
* fdisk: Fix typo in man page.
* libblkid, blkid, mount: Likewise.
* Fix various typos in docs and in source code comments.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2012-04-23 13:16:35 +02:00
Sami Kerola efb8854f4c sys-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:49:40 +02:00
Karel Zak 8cfd1ffb7a dmesg: fix non-ANSI function declaration [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-17 16:50:17 +01:00
Petr Uzel 0720766e3b dmesg: fix printing of multibyte characters
Also make it compile if HAVE_WIDECHAR is not defined.

Addresses: https://bugzilla.novell.com/show_bug.cgi?id=725993
Reported-by: Harald Koenig <koenig@linux.de>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-11-02 16:27:34 +01:00
Karel Zak c672220f1c dmesg: add --file option
This new option is mostly for testing (to test raw logs from another
boxes/kernels).

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-08 19:40:34 +02:00
Karel Zak 31c9099a81 dmesg: remove extra space only after time stamp
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-02 14:42:04 +02:00
Karel Zak 22f6982577 dmesg: fix for non-CONFIG_PRINTK_TIME kernels
* dmesg(1) incorrectly assumes that lines like "<6>\n"
   are broken.

 * it's more robust to assume the end of the record is "\n<"

 * print \n for empty lines

Reported-by: "Gabor Z. Papp" <gzp@papp.hu>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 12:36:02 +02:00
Karel Zak dcd16b0fb0 dmesg: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-16 13:02:00 +02:00
Petr Uzel 5920295058 dmesg: avoid mess at the end of dmesg output
Since util-linux commit a7ee94f220,
dmesg incorrectly calculates number of bytes that are remaining in the
buffer in get_next_record(). This could, under specific circumstances,
cause printing mess at the end of dmesg output:

> dmesg | tail
[ 1191.478725] Adding 285488k swap on /root/swapfile.  Priority:-2 extents:15 across:1186612k
[ 1205.588331] Adding 285488k swap on /root/swapfile.  Priority:-2 extents:15 across:1186612k
\xffffffba\xffffffba

Reported-by: Glenn Doig <doiggl@velocitynet.com.au>
Addresses: https://bugzilla.novell.com/show_bug.cgi?id=710417

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
2011-08-15 14:28:21 +02:00
Karel Zak 738767b921 dmesg: fix compiler warnings [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-01 13:01:31 +02:00
Karel Zak 9feec79cc5 misc: use unsigned int for bit-fileds
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-29 10:51:06 +02:00
Karel Zak c87638ad30 include: [strutils.c] add list parsers
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-27 16:41:21 +02:00
Karel Zak 608d45015f dmesg: allow to print time delta without timestamp
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-20 17:03:24 +02:00
Karel Zak 641986cf92 dmesg: mark some options mutually exclusive
Reported-by: "Voelker, Bernhard" <bernhard.voelker@siemens-enterprise.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-20 15:50:34 +02:00
Karel Zak 42fac79a21 dmesg: add --ctime to print human readable timestamps
Based on patch from "corentin.labbe" <corentin.labbe@geomatys.fr>.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-20 14:26:45 +02:00
Karel Zak bd304d92ff dmesg: add --show-delta option
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-20 12:52:15 +02:00
Karel Zak a7ee94f220 dmesg: print_buffer() refactoring
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-19 21:37:34 +02:00
Karel Zak aca1633a3e dmesg: variables refactoring
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-19 20:00:54 +02:00
Marc-Antoine Perennou 730d5e7761 dmesg: fix segfault
An element declared as size_t cannot be detected as negative (len < 0)
is always false.
This can lead to an infinite loop causing a segmentation fault.
Check if len is equal to -1 or -2 instead

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2011-07-18 23:46:45 +02:00
Karel Zak d74b8dfc70 dmesg: add -t option to suppress timestamps
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-18 11:48:41 +02:00
Karel Zak 2500018011 dmesg: add -u and -k options
-u  : print kernel messages
 -k  : print userspace message

The options could be mixed together or with --facility option too.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-18 11:28:15 +02:00
Karel Zak 872a1575e8 dmesg: fix typo in usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-14 13:46:13 +02:00
Karel Zak 5ef053699b dmesg: reorder options, add comments
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-14 13:31:53 +02:00
Karel Zak 0e24df3b10 dmesg: add --facility option
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-14 12:48:07 +02:00
Karel Zak 85f3cc55f7 dmesg: add --decode to print readable facility and level
# dmesg --decode
 ...
 kern  :info  : [53335.743185] PM: resume of devices complete after 2496.795 msecs
 kern  :debug : [53335.743593] PM: Finishing wakeup.
 kern  :warn  : [53335.743595] Restarting tasks ... done.
 kern  :info  : [53335.790452] video LNXVIDEO:00: Restoring backlight state
 kern  :debug : [53336.418576] e1000e 0000:00:19.0: irq 45 for MSI/MSI-X

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-14 12:30:18 +02:00
Karel Zak 636a6207d9 dmesg: add --level=<list>
For example

	dmesg --level=err,warn

will print only error and warning messages.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-13 15:50:47 +02:00
Karel Zak 5c8f6bc6df dmesg: consolidate level parsiig code
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-13 15:06:53 +02:00
Karel Zak b8300c0a1e dmesg: don't print non-printable chars, parse records
All non-printable chars, non-printable multibyte sequences or invalid
multibyte sequences will be replaced with \x<hex> strings.

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-13 15:00:49 +02:00
Karel Zak f06ec64fda dmesg; support level names (e.g. --console-level=alert)
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-01 16:33:34 +02:00
Karel Zak 2170174ee3 dmesg: add --console-on and --console-off
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-01 15:30:16 +02:00
Karel Zak 0506537a10 dmesg: cleanup options and man page
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-01 14:56:22 +02:00
Karel Zak 0419986053 dmesg: add --clear (SYSLOG_ACTION_CLEAR)
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-01 14:33:27 +02:00
Karel Zak 48c5c66212 dmesg: refactoring - cleanup main() code
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-01 14:26:19 +02:00
Karel Zak 65e3eed924 dmesg: refactoring - cleanup read buffer code
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-01 14:15:07 +02:00
Karel Zak f4fa5b44df dmesg: refactoring - cleanup print buffer code
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-01 13:57:36 +02:00
Karel Zak eed99b2a7c dmesg: refactoring - cleanup get bufsize code
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-01 13:49:25 +02:00
Karel Zak 59a1489968 dmesg: use SYSLOG_ACTION_* macros rather than magic constatnts
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-01 13:41:56 +02:00
Karel Zak 4a3b794968 dmesg: add long options, --help and --version
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-07-01 13:36:11 +02:00
Marek Polacek 15103c4bc6 dmesg.c: cleanups -- use err(), xalloc()
Signed-off-by: Marek Polacek <mpolacek@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-02-28 10:10:32 +01:00
Davidlohr Bueso 15673c1598 dmesg: use strtol_or_err instead of atoi
We shouldn't be accepting things like 'dmesg -n 2crapinput'
This patch also changes the exit's value to use EXIT_* constants.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2011-02-08 15:40:48 +01:00
Davidlohr Bueso 219da9223d dmesg: fix memory leak in dmesg(1).
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
2010-08-04 11:46:38 +02:00
Karel Zak e6c379eb8d dmesg: add -r to help output
On Tue, Aug 04, 2009 at 05:52:38PM +0200, Dalibor Straka wrote:
> while I was reading the source, I've noticed missing option in the
> help message for "-r". So I'm sending one-line patch for dmesg.

Reported-by: Dalibor Straka <dast@panelnet.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-08-17 11:37:27 +02:00
Adam Jackson 11ea22d5a3 dmesg: Add -r (raw) option.
Useful for debugging which kernel messages are ruining your quiet
bootup.

Signed-off-by: Adam Jackson <ajax@redhat.com>
2009-01-16 12:34:49 +01:00
maximilian attems 5423ccb1a1 dmesg: nuke old glibc 5 support
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘klogctl’
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘type’
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘b’
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘len’

without belows compat section dmesg just compiles fine against klibc.
as bonus reorder the includes.

Signed-off-by: maximilian attems <max@stro.at>
2008-07-28 11:06:50 +02:00
Karel Zak c129767e06 Imported from util-linux-2.12b tarball. 2006-12-07 00:26:16 +01:00