Identify all open files of current OS X process
Identify all open files of current OS X process
- Subject: Identify all open files of current OS X process
- From: Jerry Krinock <email@hidden>
- Date: Sat, 07 Feb 2015 15:26:32 -0800
I need a method which will give me the paths of all files which the current OS X process (*) has open. Yes, this is for a benevolent hack and no, I am not sandboxed.
I’m considering using getpid() and passing the result to /usr/sbin/lsof with a -p option. This works very fast in Terminal.app, but I’m hoping for something less fragile (lsof has lots of weird options including a timeout) and more lightweight.
Thanks,
Jerry Krinock
(*) Actually, this code is going in to a binary plug-in in another app, so my plug-in is going to get the open files of its host app. The purpose is to work around a deficiency in the host app’s plug-in API.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden