From owner-freebsd-bugs Tue Oct 1 10:10: 8 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D1BCB37B401 for ; Tue, 1 Oct 2002 10:10:06 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7377143E4A for ; Tue, 1 Oct 2002 10:10:06 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g91HA6Co022256 for ; Tue, 1 Oct 2002 10:10:06 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g91HA6AC022255; Tue, 1 Oct 2002 10:10:06 -0700 (PDT) Date: Tue, 1 Oct 2002 10:10:06 -0700 (PDT) Message-Id: <200210011710.g91HA6AC022255@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: bin/43434: New option to 'dmesg' which allow to display or not old boot messages Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/43434; it has been noted by GNATS. From: Bruce Evans To: Brooks Davis Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: bin/43434: New option to 'dmesg' which allow to display or not old boot messages Date: Wed, 2 Oct 2002 03:10:58 +1000 (EST) On Mon, 30 Sep 2002, Brooks Davis wrote: > On Mon, Sep 30, 2002 at 09:53:43AM +0300, Ruslan Ermilov wrote: > > On Fri, Sep 27, 2002 at 12:00:20PM -0700, Brooks Davis wrote: > > > On Fri, Sep 27, 2002 at 08:36:52PM +0200, AurIlien Nephtali wrote: > > > >=20 > > > > Some times it could be usefull to display only the last boot > > > > message (ie: when grep'ing). The attached patch modifies > > > > sys/kern/subr_prf.c and dmesg.c (and the also the manual). It > > > > adds a tag (---<<>>---) at the begining of each boot > > > > message (the tag macro is stored in sys/sys/msgbuf.h and could > > > > also be stored in /usr/include/msgbuf.h) dmesg.c is modified > > > > and has a new option: -o, which when it is specified, displays > > > > the full content of the message buffer, otherwise only the last > > > > message is displayed). This patch has been tested (by me :p) > > > > without any troubles on -CURRENT. > > > =20 > > > This was my propsed solution to this annoyance so I agree with it. :) = > I > > > haven't had time to test and fully review this change so I asked > > > AurIlien to put it in a PR in hopes that someone else will have to time > > > to commit it or something similar. > > > =20 > > What's wrong with ``dmesg | tail -1''? > > It does nothing like what this patch does? That just shows the last > line of dmesg, this cause dmesg to only show messages from this boot > unless you specificly ask for saved messages (assuming they exist). What's wrong with ``grep [-C] /var/log/messages'' then? :-) (except it doesn't handled rotated log files or races with newsyslog ...). It handles rotation a bit better than dmesg -- my message buffer gets rotated by debugging cruft and doesn't keep boot messages for long. Some magic would be required to find the last message without tags. Printing only the very last message doesn't seem very useful anyway. Lastness depends on an arbitrary descision about where the boot ends. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message