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: Monitor opened files



On 29/04/07, Sherm Pendley <email@hidden> wrote:
On Apr 29, 2007, at 7:08 AM, Philip Q wrote:

> On 29/04/07, Daniel <email@hidden> wrote:
>> it is the first time I work with Cocoa and I wanted to know if there
>> is a way to launch a second application from the running one (and for
>> that I have found something) _and_ additionally being able to montior
>> this process/application in such a way to know exactly which file it
>> has opened for writing, which one he has created.
>>
>
> Creating a child process is pretty simple using NSTask (although, is
> there a specific reason you want to use a child process and not a
> thread?).
>
> However, getting a list of the open files is not a trivial task

Just use the aforementioned simple NSTask to run 'lsof'. :-)


Well... yes. But, I've always considered doing that to be a bit of a hack, especially when there's a more robust path available (albeit, confusing and complicated).

Or, if you know *where* the files will be opened, just watch that
directory with kqueue.


Or a Spotlight query, which has the added benefit of being in Cocoa.

-Phil
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Monitor opened files (From: Daniel <email@hidden>)
 >Re: Monitor opened files (From: "Philip Q" <email@hidden>)
 >Re: Monitor opened files (From: Sherm Pendley <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.