http://qs1969.pair.com?node_id=519092


in reply to Re: how to know the files opened by a process
in thread how to know the files opened by a process

This will only give you the opened file descriptors for the process, it does not give you memory-mapped files(/proc/###/maps), the current working directory (/proc/###/cwd) or indeed the binary itself(/proc/###/exe). (All of these are for Linux btw, I have no idea whether this is the same on Sun OS)

In answer to the OP's question, I once looked for the same thing and don't know of an existing module that does this. If you're looking for a cross-platform solution I'd suggest going with McDarrens suggestion to use the lsof binary and parse its output(that's what I did, I'd post code, but I don't own it and it was bog-standard parsing stuff anyway). It'll be easier to compensate for syntax and output differences of lsof than to mimic its behaviour on different platforms.


A computer is a state machine. Threads are for people who can't program state machines. -- Alan Cox