History log of /freebsd-10.1-release/sbin/dmesg/dmesg.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 251618 11-Jun-2013 flo

Move the check whether the clear flag is set. This has 2 advantages

- When operating on a core file (-M) and -c is specified we don't clear
the message buffer of the running system.
- If we don't have permission to clear the buffer print the error message
only. That's what Linux does in this case, where this feature was ported
from, and it ensures that the error message doesn't get lost in the noise.

Discussed with: antoine, cognet
Approved by: cognet


# 250430 10-May-2013 eadler

Add support for 'dmesg -c' which clears the dmesg buffer after it has
been printed. This provides compatibility with other *nix systems
(including Linux).

While here use stdbool booleans for 'all'.

PR: bin/178295
Submitted by: Levent Serinol <lserinol@gmail.com>
Reviewed by: will


# 227081 04-Nov-2011 ed

Add missing static keywords for global variables to tools in sbin/.

These tools declare global variables without using the static keyword,
even though their use is limited to a single C-file, or without placing
an extern declaration of them in the proper header file.


# 156076 27-Feb-2006 dwmalone

Avoid moving onto a new line while testing if there is a syslog priority
in the buffer. This isn't exactly the patch that Stephen submitted, but
is based on one of his suggestions.

PR: 93841
Submitted by: Stephen Montgomery-Smith <stephen@math.missouri.edu>
MFC after: 2 weeks


# 140383 17-Jan-2005 delphij

WARNS=6 cleanup:

- signed/unsigned conform.
- Better initialization of nlist[]. I think we should have
something like NLIST_NULL instead of the current (ugly)
form...


# 136491 13-Oct-2004 schweikh

Print a usage message if a non-option is specified.
MFC after: 3 weeks


# 136092 03-Oct-2004 stefanf

Don't add integers to void pointers.


# 128073 09-Apr-2004 markm

Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp


# 127448 26-Mar-2004 ru

Not too much point specifying -N but not specifying -M.


# 125610 08-Feb-2004 iedowse

Further simplify the code for printing the message buffer:
- Ensure that the buffer ends with "\n\0" to avoid special cases
and allow the use of strtol().
- Use strvisx() on each complete line instead of character by
character.

Submitted by: bde
MFC after: 1 week


# 125497 05-Feb-2004 iedowse

Don't print the oldest line in the message buffer if the buffer is
full, since that line is almost always incomplete. Make the parsing
of <%d> lines more strict.

Also simplify the logic a little:
- Start off by making the buffer linear so that we don't have to
deal with it wrapping around (suggested by bde).
- Process line by line rather than byte at a time.


# 116660 22-Jun-2003 iedowse

Replace the code for reading and writing the kernel message buffer
with a new implementation that has a mostly reentrant "addchar"
routine, supports multiple message buffers in the kernel, and hides
the implementation details from callers.

The new code uses a kind of sequence number to represend the current
read and write positions in the buffer. This approach (suggested
mainly by bde) permits the read and write pointers to be maintained
separately, which reduces the number of atomic operations that are
required. The "mostly reentrant" above refers to the way that while
it is now always safe to have any number of concurrent writers,
readers could see the message buffer after a writer has advanced
the pointers but before it has witten the new character.

Discussed on: freebsd-arch


# 114515 02-May-2003 obrien

bufpos is used in size_t contexts, so make it one.


# 102069 18-Aug-2002 bde

Include <nlist.h> for nlist interfaces instead of depending on namespace
pollution in <kvm.h>.


# 92697 19-Mar-2002 imp

o Remove __P
o Use ANSI function definitions
o mark usage() as __dead2


# 79736 14-Jul-2001 billf

add -a to usage()

Submitted by: Ashley Penney <ashp@unloved.org>
MFC after: 3 days


# 79154 03-Jul-2001 tmm

Use the kern.msgbuf sysctl to get the message buffer on a running
kernel, and remove setgid kmem, which is not needed any more.


# 73076 26-Feb-2001 ru

Backout -a restriction hack.

Requested by: rwatson


# 72973 24-Feb-2001 ru

Restrict -a to root only.

PR: bin/25337


# 70123 17-Dec-2000 phk

Add a -a option to show the entire message buffer.


# 50476 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 37893 27-Jul-1998 hoek

Use an error message that more clearly indites(sp?) an out-of-sync
kernel+userland when that is the case.

PR: bin/7414


# 36634 04-Jun-1998 charnier

Use .Pa for filenames. Use .Bl/.El in FILES section. Remove unused #includes.


# 36179 19-May-1998 phk

Make the size of the msgbuf (dmesg) a "normal" option.


# 24359 29-Mar-1997 imp

compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.


# 22990 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 18439 21-Sep-1996 bde

Who would have though that dmesg didn't understand message buffers?

Fixed the following bugs:
- the buffer was reprinted endlessly when msg.bufx == 0 and (for a
different reason) when msg.bufx == 1.
- the last byte of the buffer wasn't printed except in the the infinite
loop cases.
- the comment about walking the buffer didn't match the (correct) code.
- minor -Wall and style bugs.
Not fixed:
- excessive newline processing which hid the non-printing of the last
byte of the buffer.


# 16497 18-Jun-1996 alex

Add #include <err.h>.


# 11749 23-Oct-1995 ache

Add setlocale LC_CTYPE


# 1559 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1558,
which included commits to RCS files with non-trunk default branches.


# 1558 26-May-1994 rgrimes

BSD 4.4 Lite sbin Sources

Note: XNSrouted and routed NOT imported here, they shall be imported with
usr.sbin.