kvm_getfiles is badly broken
rwatson at FreeBSD.org
Mon Dec 31 10:18:58 PST 2007
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
University of Cambridge
More information about the freebsd-arch