this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Implement most of FSEvents

+570 -54
+6 -1
src/frameworks/CoreServices/CMakeLists.txt
··· 3 3 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions") 4 4 5 5 include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src/external/libcxx/include) 6 + include_directories( 7 + ${CMAKE_SOURCE_DIR}/src/kernel/emulation/linux 8 + ) 6 9 7 10 set(CoreServices_SRCS 8 11 CoreEndian.cpp ··· 41 44 VERSION "A" 42 45 PARENT "CoreServices" 43 46 SOURCES 44 - src/FSEvents/FSEvents.c 47 + src/FSEvents/FSEvents.m 48 + src/FSEvents/FSEventsImpl.m 45 49 DEPENDENCIES 46 50 CoreFoundation 51 + Foundation 47 52 system 48 53 ) 49 54
+60
src/frameworks/CoreServices/include/FSEvents/FSEvents.h
··· 17 17 along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 18 */ 19 19 20 + #ifndef _FSEVENTS_H 21 + #define _FSEVENTS_H 20 22 #include <CoreFoundation/CoreFoundation.h> 21 23 #include <sys/types.h> 22 24 #include <Availability.h> ··· 28 30 typedef UInt64 FSEventStreamEventId; 29 31 typedef UInt32 FSEventStreamEventFlags; 30 32 33 + enum { 34 + kFSEventStreamEventFlagNone = 0, 35 + kFSEventStreamEventFlagMustScanSubDirs = 1, 36 + kFSEventStreamEventFlagUserDropped = 2, 37 + kFSEventStreamEventFlagKernelDropped = 4, 38 + kFSEventStreamEventFlagEventIdsWrapped = 8, 39 + kFSEventStreamEventFlagHistoryDone = 0x10, 40 + kFSEventStreamEventFlagRootChanged = 0x20, 41 + kFSEventStreamEventFlagMount = 0x40, 42 + kFSEventStreamEventFlagUnmount = 0x80, 43 + kFSEventStreamEventFlagItemCreated = 0x100, 44 + kFSEventStreamEventFlagItemRemoved = 0x200, 45 + kFSEventStreamEventFlagItemInodeMetaMod = 0x400, 46 + kFSEventStreamEventFlagItemRenamed = 0x800, 47 + kFSEventStreamEventFlagItemModified = 0x1000, 48 + kFSEventStreamEventFlagItemFinderInfoMod = 0x2000, 49 + kFSEventStreamEventFlagItemChangeOwner = 0x4000, 50 + kFSEventStreamEventFlagItemXattrMod = 0x8000, 51 + kFSEventStreamEventFlagItemIsFile = 0x10000, 52 + kFSEventStreamEventFlagItemIsDir = 0x20000, 53 + kFSEventStreamEventFlagItemIsSymlink = 0x40000, 54 + kFSEventStreamEventFlagOwnEvent = 0x80000, 55 + kFSEventStreamEventFlagItemIsHardlink = 0x100000, 56 + kFSEventStreamEventFlagItemIsLastHardlink = 0x200000, 57 + kFSEventStreamEventFlagItemCloned = 0x400000, 58 + }; 59 + 60 + enum { 61 + kFSEventStreamCreateFlagUseCFTypes = 1, 62 + kFSEventStreamCreateFlagNoDefer = 2, 63 + kFSEventStreamCreateFlagWatchRoot = 4, 64 + kFSEventStreamCreateFlagIgnoreSelf = 8, 65 + kFSEventStreamCreateFlagFileEvents = 0x10, 66 + kFSEventStreamCreateFlagMarkSelf = 0x20, 67 + kFSEventStreamCreateFlagUseExtendedData = 0x40, 68 + }; 69 + 70 + #define kFSEventStreamEventExtendedDataPathKey CFSTR("path") 71 + #define kFSEventStreamEventExtendedFileIDKey CFSTR("fileID") 72 + 31 73 typedef CALLBACK_API_C(void, FSEventStreamCallback)( 32 74 ConstFSEventStreamRef streamRef, 33 75 void *clientCallBackInfo, ··· 55 97 FSEventStreamCreateFlags flags); 56 98 57 99 extern CF_RETURNS_RETAINED CFArrayRef FSEventStreamCopyPathsBeingWatched(ConstFSEventStreamRef streamRef); 100 + 101 + extern FSEventStreamEventId FSEventStreamGetLatestEventId(ConstFSEventStreamRef streamRef); 102 + 103 + extern void FSEventStreamInvalidate(FSEventStreamRef streamRef); 104 + 105 + extern void FSEventStreamRelease(FSEventStreamRef streamRef); 106 + 107 + extern void FSEventStreamRetain(FSEventStreamRef streamRef); 108 + 109 + extern void FSEventStreamScheduleWithRunLoop(FSEventStreamRef streamRef, CFRunLoopRef runLoop, CFStringRef runLoopMode); 110 + 111 + extern void FSEventStreamSetDispatchQueue(FSEventStreamRef streamRef, dispatch_queue_t q); 112 + 113 + extern Boolean FSEventStreamStart(FSEventStreamRef streamRef); 114 + 115 + extern void FSEventStreamStop(FSEventStreamRef streamRef); 116 + 117 + #endif
-53
src/frameworks/CoreServices/src/FSEvents/FSEvents.c
··· 1 - /* 2 - This file is part of Darling. 3 - 4 - Copyright (C) 2019 Lubos Dolezel 5 - 6 - Darling is free software: you can redistribute it and/or modify 7 - it under the terms of the GNU General Public License as published by 8 - the Free Software Foundation, either version 3 of the License, or 9 - (at your option) any later version. 10 - 11 - Darling is distributed in the hope that it will be useful, 12 - but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - GNU General Public License for more details. 15 - 16 - You should have received a copy of the GNU General Public License 17 - along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 - */ 19 - 20 - #include <FSEvents/FSEvents.h> 21 - #include <stdio.h> 22 - #include <stdlib.h> 23 - 24 - struct __FSEventStream { 25 - CFAllocatorRef allocator; 26 - CFArrayRef pathsToWatch; 27 - }; 28 - 29 - FSEventStreamRef FSEventStreamCreate( 30 - CFAllocatorRef allocator, 31 - FSEventStreamCallback callback, 32 - FSEventStreamContext *context, 33 - CFArrayRef pathsToWatch, 34 - FSEventStreamEventId sinceWhen, 35 - CFTimeInterval latency, 36 - FSEventStreamCreateFlags flags) 37 - { 38 - FSEventStreamRef stream = NULL; 39 - printf("STUB %s\n", __PRETTY_FUNCTION__); 40 - stream = CFAllocatorAllocate(allocator, sizeof(struct __FSEventStream), 0); 41 - stream->allocator = allocator; 42 - stream->pathsToWatch = CFArrayCreateCopy(allocator, pathsToWatch); 43 - return stream; 44 - } 45 - 46 - CFArrayRef FSEventStreamCopyPathsBeingWatched(ConstFSEventStreamRef streamRef) 47 - { 48 - CFArrayRef copy; 49 - printf("STUB %s\n", __PRETTY_FUNCTION__); 50 - copy = CFArrayCreateCopy(streamRef->allocator, streamRef->pathsToWatch); 51 - copy = CFRetain(copy); 52 - return copy; 53 - }
+92
src/frameworks/CoreServices/src/FSEvents/FSEvents.m
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2019-2020 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #include <FSEvents/FSEvents.h> 21 + #include <stdio.h> 22 + #include <stdlib.h> 23 + #import "FSEventsImpl.h" 24 + 25 + FSEventStreamRef FSEventStreamCreate( 26 + CFAllocatorRef allocator, 27 + FSEventStreamCallback callback, 28 + FSEventStreamContext *context, 29 + CFArrayRef pathsToWatch, 30 + FSEventStreamEventId sinceWhen, 31 + CFTimeInterval latency, 32 + FSEventStreamCreateFlags flags) 33 + { 34 + return (FSEventStreamRef) [[FSEventsImpl alloc] initWithPaths: (NSArray*)pathsToWatch 35 + flags: flags 36 + context: context 37 + callback: callback]; 38 + } 39 + 40 + CFArrayRef FSEventStreamCopyPathsBeingWatched(ConstFSEventStreamRef streamRef) 41 + { 42 + FSEventsImpl* impl = (FSEventsImpl*) streamRef; 43 + return (CFArrayRef) [impl copyPathsToWatch]; 44 + } 45 + 46 + FSEventStreamEventId FSEventStreamGetLatestEventId(ConstFSEventStreamRef streamRef) 47 + { 48 + return [((FSEventsImpl*) streamRef) lastEventID]; 49 + } 50 + 51 + void FSEventStreamInvalidate(FSEventStreamRef streamRef) 52 + { 53 + [((FSEventsImpl*) streamRef) invalidate]; 54 + } 55 + 56 + void FSEventStreamRelease(FSEventStreamRef streamRef) 57 + { 58 + [((FSEventsImpl*) streamRef) release]; 59 + } 60 + 61 + void FSEventStreamRetain(FSEventStreamRef streamRef) 62 + { 63 + [((FSEventsImpl*) streamRef) retain]; 64 + } 65 + 66 + void FSEventStreamScheduleWithRunLoop(FSEventStreamRef streamRef, CFRunLoopRef runLoop, CFStringRef runLoopMode) 67 + { 68 + [((FSEventsImpl*) streamRef) scheduleWithRunLoop: runLoop 69 + mode: runLoopMode]; 70 + } 71 + 72 + void FSEventStreamSetDispatchQueue(FSEventStreamRef streamRef, dispatch_queue_t q) 73 + { 74 + [((FSEventsImpl*) streamRef) setDispatchQueue: q]; 75 + } 76 + 77 + Boolean FSEventStreamStart(FSEventStreamRef streamRef) 78 + { 79 + [((FSEventsImpl*) streamRef) start]; 80 + return TRUE; 81 + } 82 + 83 + void FSEventStreamStop(FSEventStreamRef streamRef) 84 + { 85 + [((FSEventsImpl*) streamRef) stop]; 86 + } 87 + 88 + void FSEventStreamUnscheduleFromRunLoop(FSEventStreamRef streamRef, CFRunLoopRef runLoop, CFStringRef runLoopMode) 89 + { 90 + [((FSEventsImpl*) streamRef) unscheduleWithRunLoop: runLoop 91 + mode: runLoopMode]; 92 + }
+66
src/frameworks/CoreServices/src/FSEvents/FSEventsImpl.h
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2020 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #import <Foundation/NSObject.h> 21 + #import <Foundation/NSArray.h> 22 + #import <Foundation/NSString.h> 23 + #import <Foundation/NSDictionary.h> 24 + #include <CoreFoundation/CFBag.h> 25 + #include <FSEvents/FSEvents.h> 26 + #include <dispatch/dispatch.h> 27 + 28 + @interface FSEventsImpl : NSObject 29 + { 30 + NSArray<NSString*>* _pathsToWatch; 31 + NSDictionary<NSNumber*, NSString*>* _wdMap; 32 + 33 + FSEventStreamCreateFlags _flags; 34 + FSEventStreamContext _context; 35 + FSEventStreamCallback _callback; 36 + dispatch_source_t _source; 37 + dispatch_queue_t _queue; 38 + CFMutableBagRef _runloops; 39 + CFRunLoopSourceRef _rlSource; 40 + int _fd; 41 + FSEventStreamEventId _lastEventID; 42 + bool _running; 43 + 44 + NSMutableArray* _pathArray; 45 + FSEventStreamEventFlags* _flagArray; 46 + FSEventStreamEventId* _idArray; 47 + } 48 + 49 + -(instancetype)initWithPaths:(NSArray*)pathsToWatch 50 + flags:(FSEventStreamCreateFlags)flags 51 + context:(FSEventStreamContext*)context 52 + callback:(FSEventStreamCallback)callback; 53 + -(NSArray*)copyPathsToWatch; 54 + 55 + -(void)setDispatchQueue:(dispatch_queue_t)queue; 56 + -(void)scheduleWithRunLoop:(CFRunLoopRef)rl 57 + mode:(CFStringRef)rlMode; 58 + -(void)unscheduleWithRunLoop:(CFRunLoopRef)rl 59 + mode:(CFStringRef)rlMode; 60 + -(void)invalidate; 61 + -(void)start; 62 + -(void)stop; 63 + -(FSEventStreamEventId)lastEventID; 64 + 65 + @end 66 +
+345
src/frameworks/CoreServices/src/FSEvents/FSEventsImpl.m
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2020 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + #import "FSEventsImpl.h" 21 + #import <Foundation/NSDictionary.h> 22 + #include <unistd.h> 23 + #include <stdlib.h> 24 + #include <errno.h> 25 + #include <string.h> 26 + #include <ext/sys/inotify.h> 27 + 28 + static dispatch_queue_t g_fsEventsQueue = NULL; 29 + 30 + static void rlPerform(void* info) 31 + { 32 + FSEventsImpl* fse = (FSEventsImpl*) info; 33 + [fse _doCallback]; 34 + } 35 + 36 + @implementation FSEventsImpl 37 + 38 + -(instancetype)initWithPaths:(NSArray*)pathsToWatch 39 + flags:(FSEventStreamCreateFlags)flags 40 + context:(FSEventStreamContext*)context 41 + callback:(FSEventStreamCallback)callback 42 + { 43 + _pathsToWatch = [[NSArray alloc] initWithArray:pathsToWatch]; 44 + _flags = flags; 45 + _callback = callback; 46 + _fd = inotify_init1(IN_NONBLOCK); 47 + 48 + if (_fd == -1) 49 + { 50 + [self release]; 51 + return nil; 52 + } 53 + 54 + if (context) 55 + { 56 + _context = *context; 57 + if (_context.retain) 58 + _context.info = (void*) _context.retain(_context.info); 59 + } 60 + 61 + CFRunLoopSourceContext rlcontext = {0}; 62 + rlcontext.info = self; 63 + rlcontext.perform = rlPerform; 64 + 65 + _rlSource = CFRunLoopSourceCreate(NULL, 0, &rlcontext); 66 + NSMutableDictionary* wdmap = [[NSMutableDictionary alloc] initWithCapacity: [_pathsToWatch count]]; 67 + 68 + for (NSString* path in _pathsToWatch) 69 + { 70 + int wd = inotify_add_watch(_fd, [path UTF8String], IN_ATTRIB | IN_CREATE | IN_DELETE | IN_DELETE_SELF | IN_MODIFY | IN_MOVE); 71 + [wdmap setObject: path 72 + forKey: [NSNumber numberWithInt: wd]]; 73 + } 74 + _wdMap = [[NSDictionary alloc] initWithDictionary: wdmap]; 75 + [wdmap release]; 76 + 77 + static dispatch_once_t once; 78 + dispatch_once(&once, ^{ 79 + g_fsEventsQueue = dispatch_queue_create("FSEvents queue", NULL); 80 + }); 81 + 82 + _source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, _fd, 0, g_fsEventsQueue); 83 + dispatch_source_set_event_handler(_source, ^{ 84 + [self _readEvents]; 85 + }); 86 + 87 + _pathArray = [[NSMutableArray alloc] init]; 88 + _runloops = CFBagCreateMutable(NULL, 0, &kCFTypeBagCallBacks); 89 + 90 + return self; 91 + } 92 + 93 + -(void) dealloc 94 + { 95 + if (_context.release) 96 + _context.release(_context.info); 97 + 98 + if (_source) 99 + { 100 + dispatch_suspend(_source); 101 + dispatch_release(_source); 102 + } 103 + if (_rlSource) 104 + CFRelease(_rlSource); 105 + if (_runloops) 106 + CFRelease(_runloops); 107 + 108 + [self invalidate]; 109 + 110 + if (_fd != -1) 111 + close(_fd); 112 + 113 + [_pathsToWatch release]; 114 + [_pathArray release]; 115 + [_wdMap release]; 116 + free(_flagArray); 117 + free(_idArray); 118 + [super dealloc]; 119 + } 120 + 121 + -(NSArray*)copyPathsToWatch 122 + { 123 + return [_pathsToWatch retain]; 124 + } 125 + 126 + -(void)setDispatchQueue:(dispatch_queue_t)queue 127 + { 128 + if (_queue) 129 + { 130 + dispatch_release(_queue); 131 + _queue = NULL; 132 + } 133 + if (queue) 134 + { 135 + [self scheduleWithRunLoop: NULL 136 + mode: NULL]; 137 + 138 + _queue = queue; 139 + dispatch_retain(_queue); 140 + } 141 + } 142 + 143 + -(void)scheduleWithRunLoop:(CFRunLoopRef)rl 144 + mode:(CFStringRef)rlMode 145 + { 146 + @synchronized(self) 147 + { 148 + CFBagAddValue(_runloops, rl); 149 + } 150 + CFRunLoopAddSource(rl, _rlSource, rlMode); 151 + } 152 + 153 + -(void)unscheduleWithRunLoop:(CFRunLoopRef)rl 154 + mode:(CFStringRef)rlMode 155 + { 156 + @synchronized(self) 157 + { 158 + CFBagRemoveValue(_runloops, rl); 159 + } 160 + CFRunLoopRemoveSource(rl, _rlSource, rlMode); 161 + } 162 + 163 + -(void)invalidate 164 + { 165 + [self setDispatchQueue: NULL]; 166 + CFRunLoopSourceInvalidate(_rlSource); 167 + } 168 + 169 + -(void)start 170 + { 171 + if (!_running) 172 + { 173 + dispatch_resume(_source); 174 + _running = TRUE; 175 + } 176 + } 177 + 178 + -(void)stop 179 + { 180 + if (_running) 181 + { 182 + dispatch_suspend(_source); 183 + _running = FALSE; 184 + } 185 + } 186 + 187 + -(FSEventStreamEventId)lastEventID 188 + { 189 + return _lastEventID; 190 + } 191 + 192 + -(void)_readEvents 193 + { 194 + const size_t bytes = sizeof(struct inotify_event) + 4096 + 1; 195 + struct inotify_event* evt = (struct inotify_event*) malloc(bytes); 196 + 197 + while (1) 198 + { 199 + int rd = read(_fd, evt, bytes); 200 + if (rd < 0) 201 + { 202 + if (errno == EINTR) 203 + continue; 204 + else if (errno == EAGAIN || errno == EWOULDBLOCK) 205 + break; 206 + else 207 + { 208 + [self stop]; 209 + break; 210 + } 211 + } 212 + else 213 + { 214 + [self _processSingleEvent: evt]; 215 + } 216 + } 217 + 218 + free(evt); 219 + [self _dispatchEvents]; 220 + } 221 + 222 + -(void)_processSingleEvent:(struct inotify_event*)evt 223 + { 224 + FSEventStreamEventFlags flags = 0; 225 + 226 + if (evt->mask & IN_ISDIR) 227 + flags |= kFSEventStreamEventFlagItemIsDir; 228 + else 229 + flags |= kFSEventStreamEventFlagItemIsFile; // TODO: symlinks 230 + 231 + if (evt->mask & (IN_DELETE|IN_DELETE_SELF)) 232 + flags |= kFSEventStreamEventFlagItemRemoved; 233 + if (evt->mask & (IN_MOVE_SELF|IN_MOVED_FROM|IN_MOVED_TO)) 234 + flags |= kFSEventStreamEventFlagItemRenamed; 235 + if (evt->mask & (IN_MODIFY)) 236 + flags |= kFSEventStreamEventFlagItemModified; 237 + if (evt->mask & (IN_CREATE)) 238 + flags |= kFSEventStreamEventFlagItemCreated; 239 + if (evt->mask & IN_ATTRIB) 240 + flags |= kFSEventStreamEventFlagItemChangeOwner | kFSEventStreamEventFlagItemXattrMod; 241 + 242 + NSString* watchPath = [_wdMap objectForKey: [NSNumber numberWithInt: evt->wd]]; 243 + if (!watchPath) 244 + return; 245 + 246 + NSString* fullPath; 247 + 248 + if (evt->len == 0) 249 + fullPath = watchPath; 250 + else 251 + fullPath = [NSString stringWithFormat: @"%s/%s", [watchPath UTF8String], evt->name]; 252 + 253 + [_pathArray addObject: fullPath]; 254 + const int newCount = [_pathArray count]; 255 + 256 + _flagArray = (FSEventStreamEventFlags*) realloc(_flagArray, sizeof(*_flagArray) * newCount); 257 + _flagArray[newCount-1] = flags; 258 + 259 + _idArray = (FSEventStreamEventId*) realloc(_idArray, sizeof(*_idArray) * newCount); 260 + _idArray[newCount-1] = ++_lastEventID; 261 + } 262 + 263 + -(void)_dispatchEvents 264 + { 265 + if (_queue) 266 + { 267 + [self retain]; 268 + dispatch_async(_queue, ^{ 269 + [self _doCallback]; 270 + }); 271 + } 272 + else 273 + { 274 + [self retain]; 275 + CFRunLoopSourceSignal(_rlSource); 276 + 277 + @synchronized(self) 278 + { 279 + CFBagApplyFunction(_runloops, (CFBagApplierFunction) CFRunLoopWakeUp, NULL); 280 + } 281 + } 282 + } 283 + 284 + -(void)_doCallback 285 + { 286 + void* ptrToPass = _pathArray; 287 + char** cpathArray = NULL; 288 + NSArray<NSDictionary*>* dicts = NULL; 289 + 290 + dispatch_suspend(_source); // prevent races 291 + 292 + if (!(_flags & kFSEventStreamCreateFlagUseCFTypes)) 293 + { 294 + @autoreleasepool 295 + { 296 + cpathArray = (char**) malloc(sizeof(char*) * [_pathArray count]); 297 + for (int i = 0; i < [_pathArray count]; i++) 298 + cpathArray[i] = strdup([[_pathArray objectAtIndex: i] UTF8String]); 299 + } 300 + ptrToPass = cpathArray; 301 + } 302 + else if (_flags & kFSEventStreamCreateFlagUseExtendedData) 303 + { 304 + NSDictionary** dd = (NSDictionary**) malloc(sizeof(NSDictionary*) * [_pathArray count]); 305 + 306 + for (int i = 0; i < [_pathArray count]; i++) 307 + { 308 + dd[i] = @{ 309 + ((NSString*) kFSEventStreamEventExtendedDataPathKey) : [_pathArray objectAtIndex: i] 310 + }; 311 + } 312 + 313 + dicts = [[NSArray alloc] initWithObjects:dd 314 + count: [_pathArray count]]; 315 + free(dd); 316 + ptrToPass = dicts; 317 + } 318 + 319 + _callback((ConstFSEventStreamRef) self, _context.info, 320 + [_pathArray count], 321 + ptrToPass, 322 + _flagArray, _idArray); 323 + 324 + if (cpathArray != NULL) 325 + { 326 + for (int i = 0; i < [_pathArray count]; i++) 327 + free(cpathArray[i]); 328 + free(cpathArray); 329 + } 330 + 331 + if (dicts) 332 + [dicts release]; 333 + 334 + free(_flagArray); 335 + _flagArray = NULL; 336 + 337 + free(_idArray); 338 + _idArray = NULL; 339 + 340 + [_pathArray removeAllObjects]; 341 + dispatch_resume(_source); 342 + [self release]; 343 + } 344 + 345 + @end
+1
src/kernel/emulation/linux/ext/sys/inotify.h
··· 54 54 | IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM \ 55 55 | IN_MOVED_TO | IN_CREATE | IN_DELETE \ 56 56 | IN_DELETE_SELF | IN_MOVE_SELF) 57 + #define IN_NONBLOCK 00004000 57 58 58 59 extern int inotify_init (void) __THROW; 59 60