Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Dec 2007 18:18:57 +0000 (GMT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        arch@FreeBSD.org, freebsd-arch@FreeBSD.org
Subject:   Re: kvm_getfiles is badly broken
Message-ID:  <20071231181758.I59781@fledge.watson.org>
In-Reply-To: <200712311128.42114.jhb@freebsd.org>
References:  <20071229133256.D957@desktop> <200712311128.42114.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071231181758.I59781>