Re: sysutils/lsof Author Question (for CLANG)....

From: John Baldwin <jhb_at_freebsd.org>
Date: Fri, 11 Jan 2013 11:10:39 -0500
On Wednesday, November 07, 2012 06:15:21 PM Eitan Adler wrote:
> On 7 November 2012 17:35, Larry Rosenman <ler_at_lerctr.org> wrote:
> > On 2012-11-07 15:39, Greg 'groggy' Lehey wrote:
> >> On Wednesday,  7 November 2012 at 10:32:23 -0500, Benjamin Kaduk wrote:
> >>> Once again, attempting to use kernel internals outside of the
> >>> supported interfaces is just asking for trouble; I do not understand
> >>> why this message is not sinking in over the course of your previous
> >>> mails to these lists, so I will not try to belabor it further.
> >> 
> >> IIRC lsof is a special case that always needs to be built with
> >> intimate knowledge of the kernel.
> > 
> > This is VERY true.  Since some of the information lsof uses has
> > no API/ABI/KPI/KBI to get, it grovels around in the kernel.
> 
> Can you tell us what interfaces you need? Perhaps we can either point
> you to ones that may work better or seek provide (stable) kernel
> features?

The sysctls used by procstat -f and -v are close, (better than kern.files for 
example).  However, lsof also reads other things we don't export such as the 
file descriptor locking state (flock(), etc.) and that requires direct access 
to KVM still.  If you want to fix it, try to port lsof to use sysctls and see 
what you run into.  The code isn't that hard to work with.

-- 
John Baldwin
Received on Fri Jan 11 2013 - 19:42:04 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:33 UTC