Display files currently in the buffer cache

Robert Watson rwatson at FreeBSD.org
Mon Oct 31 07:48:50 PST 2005


On Mon, 31 Oct 2005, Scott Long wrote:

>>> Assuming not, is it feasible to write one to do this? (if so, any 
>>> pointers appreciated - massive FreeBSD internals newbie here....).
>> 
>> This would be a cool tool!  I've been thinking of that too, and also 
>> would like to have a lkdump tool - which dumps information about 
>> currently locked files.
>
> Does the FreeBSD VM really have a concept of filenames at all?  I 
> thought that all it understood was buffer objects and vnodes.  And since 
> there isn't a strong correlation between vnodes and the filesystem 
> namespace, it would be hard to provide such information.

The usual work-arounds are either to assume this explicitly, showing 
device numbers and inodes, or to give it a best effort shot (use the name 
cache).  Either way, the results are still likely to be useful.  You'll 
get some obvious messes, such as the results of installworld deleting old 
libraries and running processes continuing to use the deleted ones, 
resulting in an inode number that doesn't have a name that can be found. 
The same approach is taken in lsof, whereby "good enough" is generally 
good enough.  The problems start when assumptions are made that paths can 
always be found.

Robert N M Watson


More information about the freebsd-hackers mailing list