From owner-freebsd-arch@FreeBSD.ORG Mon Dec 31 18:18:58 2007 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6ED7116A418; Mon, 31 Dec 2007 18:18:58 +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 450F113C50B; Mon, 31 Dec 2007 18:18:58 +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 4EB6D485BD; Mon, 31 Dec 2007 13:18:57 -0500 (EST) Date: Mon, 31 Dec 2007 18:18:57 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: John Baldwin In-Reply-To: <200712311128.42114.jhb@freebsd.org> Message-ID: <20071231181758.I59781@fledge.watson.org> References: <20071229133256.D957@desktop> <200712311128.42114.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: arch@FreeBSD.org, freebsd-arch@FreeBSD.org Subject: Re: kvm_getfiles is badly broken X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Dec 2007 18:18:58 -0000 On Mon, 31 Dec 2007, John Baldwin wrote: > As long as fstat(1) still works on coredumps I'm happy. :) Actually, it > looks like fstat(1) doesn't use sysctl at all, but always uses kvm, even on > live kernels. It would probably be nice to provide a kvm_getfiles(3) that > exports 'struct xfile' objects by using the sysctl on live systems and by > simulating the syscall on crashdumps to generate 'struct xfile' objects. > You could then fix fstat(1) to use that instead of what it does now. Note > that fstat(1) actually works now by walking each process' fdp table rather > than by walking the global filelist. FWIW, I found the kernel export of file descriptor information via sysctl a bit sparse, so I implemented a more extended interface for procstat -f. It could well be that fstat could be modified to use that interface and probably do quite a bit less work as a result. Robert N M Watson Computer Laboratory University of Cambridge