Date: Mon, 9 Apr 2007 11:49:41 -0700 (PDT) From: youshi10@u.washington.edu To: freebsd-hackers@freebsd.org Subject: Re: Discovering list of open files from "kernel level" without using utils like lsof Message-ID: <Pine.LNX.4.43.0704091149410.23549@hymn09.u.washington.edu> In-Reply-To: <20070409152956.GB93087@dan.emsphone.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 9 Apr 2007, Dan Nelson wrote: > In the last episode (Apr 08), Garrett Cooper said: >> I'm trying to see whether it's possible to grab the list of >> files open from a kernel level on FreeBSD, using a userland library >> interface as opposed to lsof. >> I'm trying to see if there's a simple tool that I could code in >> C/C++ if necessary to spin down disks automatically to save power and >> disk life. Plus, I think that lsof actually would probe the devices >> and 'wake them up' instead of keeping them as-is. However, I could be >> wrong so if I am please let me know. > > Take a look at how /usr/bin/fstat does it. There is apparently a > "kern.file" sysctl that holds the open file table, but fstat digs > through kernel memory. > > -- > Dan Nelson > dnelson@allantgroup.com Ok, excellent. Thanks for more info. I'm thinking of changing "spinning down" to "adjusting acoustics level", i.e. reduce spindle speed to avoid pricey spin-downs, which may cause long-term serious damage to disks. Trying to keep my electric bills down and keep my disk life up :). -Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.43.0704091149410.23549>