Re: Extend ktrace/kdump output

From: Norberto Lopes <nlopes.ml_at_gmail.com>
Date: Sat, 18 Sep 2010 11:28:00 +0200
Anyway, attached is the patch.
All (constructive) criticism is welcome, even if it has to deal with
"how I should do things freebsd way (in case there is one)".

On Fri, Sep 17, 2010 at 10:48 PM, Norberto Lopes <nlopes.ml_at_gmail.com> wrote:
> On Fri, Sep 17, 2010 at 10:36 PM, Kostik Belousov <kostikbel_at_gmail.com> wrote:
>> On Fri, Sep 17, 2010 at 09:55:26PM +0200, Norberto Lopes wrote:
>>> Hi.
>>> I've been taking a look at ktrace and kdump in order to get (1) familiar with the sources and (2) to finally try to give back something to the community.
>>>
>>> So far from what I've seen, and after reading this thread http://lists.freebsd.org/pipermail/freebsd-arch/2006-April/005107.html it seems that most of those points got done.
>>>
>>> To warm up I changed the output of the stat structure in order to provide me with the device name (something I actually find useful for me sometimes)
>>>
>>> Instead of:
>>>  22596 cat      STRU  struct stat {dev=89, ino=3320836, mode=-r--r--r-- , nlink=1, uid=0, gid=0, atime=1284725358, stime=1284485510, ctime=1284485510, birthtime=1284485509, size=1172220, blksize=16384, blocks=2336, flags=0x20000 }
>>>
>>> I get this now (including major and minor):
>>>  22596 cat      STRU  struct stat {dev=<id=89:M=0:m=89> (/dev/ad4s1a), ino=3320836, mode=-r--r--r-- , nlink=1, uid=0, gid=0, atime=1284725358, stime=1284485510, ctime=1284485510, birthtime=1284485509, size=1172220, blksize=16384, blocks=2336, flags=0x20000 }
>>>
>>> I wouldn't mind having someone help me whenever and if I get stuck on the technical side (*wink* Alexander Leidinger *wink*) and also to give me more insight on what the road to help in this should be.
>>>
>>> P.S.: I'm still going through "man style" hence no patch attached. If anyone finds this one useful, I'll reply with the patch though.
>>>
>> How do you look up the device name by st_dev ? Note that the number is
>> generated by devfs at the moment of cdev creation. It is only valid on
>> the machine where stat(2) is done, and only due to the next reboot.
>>
>
> Through a really ugly hack...
> opendir("/dev")
> readdir("/dev")
> go through them and find the one...
>
> Yes, I know, painful and ugly, but as I usually use kdump with no
> reboots between analysis (I hardly ever reboot actually), and because
> I find it exhausting to keep going back to look up the device name,
> this kept me happy enough. :)
>

Received on Sat Sep 18 2010 - 07:28:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:07 UTC