Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to list all files opened by a process on the Mac OS X?




Am 24.01.2006 um 21:51 schrieb Mike Smith:

To start with, why are you interested in this information? What do you expect to do with it?

Glad you asked!

I would like to know which files of a certain pattern (say: Extension) are opened by other processes, and I am interested in the full path. Not much else really, maybe the process ID that has opened it. Preferably I would like to do it without root privileges, because I am actually only interested in processes owned by the current user.

Right now, I am calling lsof from my code, and just parse the output. This seems like a pretty wasteful way of achieving what I need.

It would be great to know if there even is a smarter way of doing this. I did succeed in getting a file list from sysctl, but was unsuccessful in reading the corresponding vnodes (I assume that I was I need to obtain the full path)

Thanks a lot

Alex

 = Mike


_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: How to list all files opened by a process on the Mac OS X? (From: Mike Smith <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.