From owner-freebsd-bugs@FreeBSD.ORG Sat Oct 29 23:10:15 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org 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 E85B616A41F for ; Sat, 29 Oct 2005 23:10:15 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6E54743D48 for ; Sat, 29 Oct 2005 23:10:15 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j9TNAFIH018666 for ; Sat, 29 Oct 2005 23:10:15 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j9TNAFn5018665; Sat, 29 Oct 2005 23:10:15 GMT (envelope-from gnats) Resent-Date: Sat, 29 Oct 2005 23:10:15 GMT Resent-Message-Id: <200510292310.j9TNAFn5018665@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, doug steinwand Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A4E5016A42A for ; Sat, 29 Oct 2005 23:00:55 +0000 (GMT) (envelope-from dzs@paris.fx.org) Received: from paris.fx.org (dsl081-037-111.lax1.dsl.speakeasy.net [64.81.37.111]) by mx1.FreeBSD.org (Postfix) with SMTP id 8A2ED43D58 for ; Sat, 29 Oct 2005 23:00:54 +0000 (GMT) (envelope-from dzs@paris.fx.org) Received: (qmail 11566 invoked by uid 1001); 29 Oct 2005 16:00:53 -0700 Message-Id: <20051029230053.11565.qmail@paris.fx.org> Date: 29 Oct 2005 16:00:53 -0700 From: doug steinwand To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: bin/88203: fstat(1) does not show correct device numbers X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: doug steinwand List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Oct 2005 23:10:16 -0000 >Number: 88203 >Category: bin >Synopsis: fstat(1) does not show correct device numbers >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Oct 29 23:10:14 GMT 2005 >Closed-Date: >Last-Modified: >Originator: dzs >Release: FreeBSD 6.0-RC1 amd64 >Organization: >Environment: System: FreeBSD paris.fx.org 6.0-RC1 FreeBSD 6.0-RC1 #0: Fri Oct 28 22:55:08 PDT 2005 root@paris.fx.org:/usr/obj/usr/src/sys/HAWK amd64 >Description: fstat(1) doesn't report correct device number in "-n" output >How-To-Repeat: notice that the output of: % fstat -n is showing device numbers of 0,0 when something else like 0,112 is expected (like in FreeBSD 5.x). >Fix: See included patch. The dev2udev() function in fstat.c is broken --- fstat_1.patch begins here --- --- usr.bin/fstat/fstat.c-orig Sat Aug 6 15:26:51 2005 +++ usr.bin/fstat/fstat.c Sat Oct 29 15:32:51 2005 @@ -68,6 +68,7 @@ #include #include #include +#include #undef _KERNEL #include #include @@ -886,10 +887,11 @@ dev2udev(struct cdev *dev) { struct cdev si; + struct cdev_priv priv; - if (KVM_READ(dev, &si, sizeof si)) { - /* XXX: FIXME! */ - return 0; + if (KVM_READ(dev, &si, sizeof si) && + KVM_READ(si.si_priv, &priv, sizeof priv)) { + return (dev_t) priv.cdp_inode; } else { dprintf(stderr, "can't convert cdev *%p to a dev_t\n", dev); return -1; --- fstat_1.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: