From owner-freebsd-fs@FreeBSD.ORG Sat Dec 22 01:28:41 2007 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F6ED16A417 for ; Sat, 22 Dec 2007 01:28:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id 406D413C442 for ; Sat, 22 Dec 2007 01:28:41 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id CBC5748C13; Fri, 21 Dec 2007 20:10:16 -0500 (EST) Date: Sat, 22 Dec 2007 01:10:16 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Denis Eremenko In-Reply-To: <1198206675.12065.5.camel@abyss.pnhz.kz> Message-ID: <20071222010629.F67327@fledge.watson.org> References: <1197437356.5183.24.camel@abyss.pnhz.kz> <44mysdjrum.fsf@Lowell-Desk.lan> <1198206675.12065.5.camel@abyss.pnhz.kz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-fs@freebsd.org, Lowell Gilbert Subject: Re: fstat and filenames X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2007 01:28:41 -0000 On Fri, 21 Dec 2007, Denis Eremenko wrote: > ? ??, 14/12/2007 ? 09:03 -0500, Lowell Gilbert ?????: >> moonshade@pnhz.kz (Denis Eremenko) writes: >> >>> Why fstat so secretive about file names and unix domain sockets? >> >> With respect to file names, you need to remember that there may not be a >> unique answer. A file handle's metadata doesn't keep information about how >> it was opened, just the inode. That inode could belong to multiple >> directory entries, or none -- this is why, as the fstat(1) manual points >> out, "there is no mapping from an open file back to the directory entry >> that was used to open that file." > > Yes. I clearly understand difficulties of exact inode-name mapping. And i > saw manpage note too. But doesn't _some_and_maybe_wrong_ information better > than nothing? Additionally - most files has one filesystem record. > >> As far as unix domain sockets, I don't understand the question. Sorry. > fstat doesn't show their names too. The procstat(1) command now present in 8.x, and likely to be MFC'd to 7.x after 7.0 but before 7.1 will allow you to inspect that information. And indeed, it will sometimes fail to be able to resolve a path for the object in which case it won't return one. It needs a bit of refinement before it can be MFC'd; it relies on the kernel vn_fullpath(9) KPI, which uses the name cache, but some synthetic file systems (i.e., devfs) don't use the name cache, so it fails for all device nodes (for example). Robert N M Watson Computer Laboratory University of Cambridge