Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Need to find mount point for device.

by NateTut (Deacon)
on Jul 17, 2009 at 16:50 UTC ( #781103=perlquestion: print w/ replies, xml ) Need Help??
NateTut has asked for the wisdom of the Perl Monks concerning the following question:

On a Sun box I'm trying to find what files certain processes have open. I'm to the point where by using Proc::ProcessTable and the pfiles function on Sun (I don't have root privileges to us lsof) I can get the following information back for each of the files:

'Device' => '283,0', 'Create Mode' => 'O_RDWR FD_CLOEXEC', 'File Number' => '5', 'Group ID' => '14700', 'Mode' => '0000', 'Size' => '0', 'Type' => 'S_IFIFO', 'Inode' => '1877643288', 'User ID' => '5800'
I know I can use find to find the file name from the inode, but I'm having trouble getting from a device like '283,0' to a mounted file system I can search.

Searches have turned up too many results and the several CPAN modules I've tried haven't worked out. Can anyone recommend a good module I can use for this? Also I would love a module that could return a list of open files given a Pid, but I haven't been able to find anything like that.

Comment on Need to find mount point for device.
Select or Download Code
Re: Need to find mount point for device.
by ig (Vicar) on Jul 17, 2009 at 21:23 UTC
Re: Need to find mount point for device.
by Bloodnok (Vicar) on Jul 18, 2009 at 00:07 UTC
    Untested, but I'd do something along the lines of:

    Run a recursive detailed listing of /dev and grep for the major & minor numbers - in this case 283 & 0 e.g. find /dev -ls | perl -ne 'print if /\s283,\s+0\s/' - this will give you the dev entry e.g. /dev/c1t2d3s0, then simply grep this out of the mounted device list e.g. mount | grep '/dev/c1t2d3s0'.

    A user level that continues to overstate my experience :-))
Re: Need to find mount point for device.
by leocharre (Priest) on Jul 22, 2009 at 15:04 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://781103]
Approved by jrsimmon
Front-paged by lostjimmy
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2014-08-21 10:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (133 votes), past polls