Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^2: how to know the files opened by a process

by tirwhan (Abbot)
on Dec 26, 2005 at 09:38 UTC ( #519092=note: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://519092]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2022-09-29 23:15 GMT
Find Nodes?
    Voting Booth?
    I prefer my indexes to start at:

    Results (125 votes). Check out past polls.