FSEvents file flags set regardless of event flow creation options

According to Apple documentation , in the FSEvents ,

 /* These flags are only set if you specified the FileEvents */ /* flags when creating the stream. */ kFSEventStreamEventFlagItemCreated = 0x00000100, kFSEventStreamEventFlagItemRemoved = 0x00000200, kFSEventStreamEventFlagItemInodeMetaMod = 0x00000400, kFSEventStreamEventFlagItemRenamed = 0x00000800, kFSEventStreamEventFlagItemModified = 0x00001000, kFSEventStreamEventFlagItemFinderInfoMod = 0x00002000, kFSEventStreamEventFlagItemChangeOwner = 0x00004000, kFSEventStreamEventFlagItemXattrMod = 0x00008000, kFSEventStreamEventFlagItemIsFile = 0x00010000, kFSEventStreamEventFlagItemIsDir = 0x00020000, kFSEventStreamEventFlagItemIsSymlink = 0x00040000 

However, I triple checked that the kFSEventStreamCreateFlagFileEvents flag kFSEventStreamCreateFlagFileEvents not set when calling

 FSEventStreamRef FSEventStreamCreate( CFAllocatorRef allocator, FSEventStreamCallback callback, FSEventStreamContext *context, CFArrayRef pathsToWatch, FSEventStreamEventId sinceWhen, CFTimeInterval latency, FSEventStreamCreateFlags flags); 

But no matter what I do, the kFSEventStreamEventFlagItem* flags are still set when events are passed to me from the FSEvents API. I suspect this is a mistake, but I'm not quite sure. I am using OS X Lion 10.7.2

Sample code can be found here. http://stuconnolly.com/downloads/scevents/

EDIT

Question:
Has anyone else experienced the same results?
Is this a behavior I can rely on to check file event flags?

+6
source share
1 answer

In fact, these flags are set normally, although the flag does not look right.

For example, you received flag 133120. This is 0x20800. So you should notice "kFSEventStreamEventFlagItemRenamed = 0x00000800" and "kFSEventStreamEventFlagItemIsDir = 0x00020000".

That is, kFSEventStreamEventFlagItemRenamed and kFSEventStreamEventFlagItemIsDir are what you want.

0
source

Source: https://habr.com/ru/post/907677/


All Articles