From owner-freebsd-current@FreeBSD.ORG Fri Sep 17 20:48:44 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9366E106566C; Fri, 17 Sep 2010 20:48:44 +0000 (UTC) (envelope-from nlopes.ml@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 2EC028FC18; Fri, 17 Sep 2010 20:48:43 +0000 (UTC) Received: by qyk31 with SMTP id 31so1352088qyk.13 for ; Fri, 17 Sep 2010 13:48:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=BIt9XG2Ma6WoUQjqGtOTheWzRuuHkia1/+Ve0HITpeA=; b=NJeHMv8M9lPC0lBelqdXp3UdQAkFzltg8ln7b48o9FDEHYyT1Wwg24xYRiFIwTvdHv 29es1faH6IihVrYlgjgiFwB8AQlqjFSdNk0hkUzw33Vs4wLmWS28sBrIieuuYoLTybVz PXLNFzspW+j9h0Eqp65RtWQyindgF5P+R3apg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=pjHekwGr4bnNQ4hZak3GtpK9RTqlyLCTIXIEzqrfhXwZkDc8z4ot5YIebaQcfgGr9B r74NdxVo8mQldNJF3Eks3ntorXfgNYYOtX+BGfPDbNla5ePShBORMta0HAYJiYWvdZBB T75EAVvASdXRpBvpzJB1fxFUN2N1u2ziFcf2g= MIME-Version: 1.0 Received: by 10.224.54.143 with SMTP id q15mr3757445qag.399.1284756523294; Fri, 17 Sep 2010 13:48:43 -0700 (PDT) Received: by 10.229.236.193 with HTTP; Fri, 17 Sep 2010 13:48:43 -0700 (PDT) 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> Date: Fri, 17 Sep 2010 22:48:43 +0200 Message-ID: From: Norberto Lopes To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org, netchild@freebsd.org Subject: Re: Extend ktrace/kdump output X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Sep 2010 20:48:44 -0000 On Fri, Sep 17, 2010 at 10:36 PM, Kostik Belousov 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 (/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. :)