Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Mar 95 10:08:44 MST
From:      terry@cs.weber.edu (Terry Lambert)
To:        gvrooij@mmra1.ms.philips.nl (Guido van Rooij)
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: lsof ported?
Message-ID:  <9503271708.AA02888@cs.weber.edu>
In-Reply-To: <9503271137.AA22173@mmra1.ms.philips.nl> from "Guido van Rooij" at Mar 27, 95 01:37:43 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> There is this handy program that lists all open file descriptors
> called lsof. It not only lists all open inodes but sockets as well.
> 
> lsof used to work on 1.1 systems but with 2.0 it seems nontrivial
> to port it. Hence my question.

All lsof does is traverse the system open file table, on the
assumption that the id's are not shared.

Basically, this is the same thing identd does.

The system open file table has the struct file *'s that refer to the
target files, as well as the process information for the openener.

Conceptually, it's a rather trivial program.

I haven't looked at the newest BSD changes, but I know that on newer
versions of SVR4, the system open file table is dynamically allocated,
and an lsof utility would have to traverse the open file table of
all active processes.

Under BSD, this would be even more trivial to implement because you
could use an SIUD root program and simply recursively descend in
/proc.


					Terry Lambert
					terry@cs.weber.edu
---
Any opinions in this posting are my own and not those of my present
or previous employers.



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