Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Sep 2010 22:48:43 +0200
From:      Norberto Lopes <nlopes.ml@gmail.com>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-current@freebsd.org, netchild@freebsd.org
Subject:   Re: Extend ktrace/kdump output
Message-ID:  <AANLkTikWEzjeA8miRXkkSBuK65sBi%2BtDvx7F=mirTZ7g@mail.gmail.com>
In-Reply-To: <20100917203645.GS2389@deviant.kiev.zoral.com.ua>
References:  <8C5C36F5-A070-4CBA-8B8C-6751F8D636E1@gmail.com> <20100917203645.GS2389@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Sep 17, 2010 at 10:36 PM, Kostik Belousov <kostikbel@gmail.com> wro=
te:
> 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 comm=
unity.
>>
>> So far from what I've seen, and after reading this thread http://lists.f=
reebsd.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 provid=
e me with the device name (something I actually find useful for me sometime=
s)
>>
>> Instead of:
>> =C2=A022596 cat =C2=A0 =C2=A0 =C2=A0STRU =C2=A0struct stat {dev=3D89, in=
o=3D3320836, mode=3D-r--r--r-- , nlink=3D1, uid=3D0, gid=3D0, atime=3D12847=
25358, stime=3D1284485510, ctime=3D1284485510, birthtime=3D1284485509, size=
=3D1172220, blksize=3D16384, blocks=3D2336, flags=3D0x20000 }
>>
>> I get this now (including major and minor):
>> =C2=A022596 cat =C2=A0 =C2=A0 =C2=A0STRU =C2=A0struct stat {dev=3D<id=3D=
89:M=3D0:m=3D89> (/dev/ad4s1a), ino=3D3320836, mode=3D-r--r--r-- , nlink=3D=
1, uid=3D0, gid=3D0, atime=3D1284725358, stime=3D1284485510, ctime=3D128448=
5510, birthtime=3D1284485509, size=3D1172220, blksize=3D16384, blocks=3D233=
6, flags=3D0x20000 }
>>
>> I wouldn't mind having someone help me whenever and if I get stuck on th=
e technical side (*wink* Alexander Leidinger *wink*) and also to give me mo=
re 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 an=
yone 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. :)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikWEzjeA8miRXkkSBuK65sBi%2BtDvx7F=mirTZ7g>