FSEvent- FSEventStreamEventFlags

2008-06-12 Thread santoshb

Hi All,

I want to know how we can get the file close event using  
FSEventStreamEventFlags.
I have written the code for get the event when user write, open and  
close the file. But we are not able to distinguish between which event  
is for which purpose.


Shown below is the out put of  function call --  
FSEventStreamShow(streamRef);


FSEventStreamRef @ 0x101f10:
   allocator = 0xa01ea1a0
   callback = 0x1c20
   context = {0, 0x2034, 0x0, 0x0, 0x0}
   numPathsToWatch = 1
   pathsToWatch = 0xa01ea1a0
pathsToWatch[0] = '/private/tmp'
   latestEventId = 49124
   latency = 100 (microseconds)
   flags = 0x
in this always flags is NULL for all event in that directory specified,
only the latestEventId changes for every event.

So how can i find out whether file was opened, closed or write  
operation was performed on the file.



Here is the code snippet for creating stream.

FSEventStreamCreate(kCFAllocatorDefault,
 mycallback,
 context,
 pathsToWatch,
 kFSEventStreamEventIdSinceNow,
latency,
kFSEventStreamCreateFlagNone /* Flags explained in reference */
);
where as pathsToWatch=/tmp/,
latency=3.0,
mycallback=is the callback function.



Is something i am missing
Please suggest.

Thanks,
Santosh
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: FSEvent- FSEventStreamEventFlags

2008-06-12 Thread Jens Alfke


On 12 Jun '08, at 5:57 AM, santoshb wrote:

I want to know how we can get the file close event using  
FSEventStreamEventFlags.
I have written the code for get the event when user write, open and  
close the file. But we are not able to distinguish between which  
event is for which purpose.


You can't. The FSEvents API only tells you what _directories_ have  
been changed, and only sometime after the changes happen. It doesn't  
tell you about individual changes, or even what files changed, much  
less individual open/write/close calls. (The reason is that doing so  
doesn't scale — the system would choke under the burden of delivering  
so many notifications.)


Did you read the File System Events Programming Guide? Its overview  
section says:
When your application registers for notification, the file system  
events daemon will post a notification every time that any file in  
the monitored directory hierarchy changes. It will also post a  
notification if the directory itself is modified (for example, if  
its permissions change or a new file is added). The important point  
to take away is that the granularity of notifications is at a  
directory level. It tells you only that something in the directory  
has changed, but does not tell you what changed.





—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]