1
  
2
  
3
  
4
  
5
  
6
  
7
  
8
  
9
  
10
  
11
  
12
  
13
  
14
  
15
  
16
  
17
  
18
  
19
  
20
  
21
  
22
  
23
  
24
  
25
  
26
  
27
  
28
  
29
  
30
  
31
  
32
  
33
  
34
  
35
  
36
  
37
  
38
  
39
  
40
  
41
  
42
  
43
  
44
  
45
  
46
  
47
  
48
  
49
  
50
  
51
  
52
  
53
  
54
  
55
  
56
  
57
  
58
  
59
  
60
  
61
  
62
  
63
  
64
  
65
  
66
  
67
  
68
  
69
  
70
  
71
  
72
  
73
  
74
  
75
  
76
  
77
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
154
  
155
  
156
  
157
  
158
  
159
  
160
  
161
  
162
  
163
  
164
  
165
  
166
  
167
  
168
  
169
  
170
  
171
  
172
  
173
  
174
  
175
  
176
  
177
  
178
  
179
  
180
  
181
  
182
  
183
  
184
  
185
  
186
  
187
  
188
  
189
  
190
  
191
  
192
  
193
  
194
  
195
  
196
  
197
  
198
  
199
  
200
  
201
  
202
  
203
  
204
  
205
  
206
  
207
  
208
  
209
  
210
  
211
  
212
  
213
  
214
  
215
  
216
  
217
  
218
  
219
  
220
  
221
  
222
  
223
  
224
  
225
  
226
  
227
  
228
  
229
  
230
  
231
  
232
  
233
  
234
  
235
  
236
  
237
  
238
  
239
  
240
  
241
  
242
  
243
  
244
  
245
  
246
  
247
  
248
  
249
  
250
  
251
  
252
  
253
  
254
  
255
  
256
  
257
  
258
  
259
  
260
  
261
  
262
  
263
  
264
  
265
  
266
  
267
  
268
  
269
  
270
  
271
  
272
  
273
  
274
  
275
  
276
  
277
  
278
  
279
  
280
  
281
  
282
  
283
  
284
  
285
  
286
  
287
  
288
  
289
  
290
  
291
  
292
  
293
  
294
  
295
  
296
  
297
  
298
  
299
  
300
  
301
  
302
  
303
  
304
  
305
  
306
  
307
  
308
  
309
  
310
  
311
  
312
  
313
  
314
  
315
  
316
  
317
  
318
  
319
  
320
  
321
  
322
  
323
  
324
  
325
  
326
  
327
  
328
  
329
  
330
  
331
  
332
  
333
  
334
  
335
  
336
  
337
  
338
  
339
  
340
  
341
  
342
  
343
  
344
  
345
  
346
  
347
  
348
  
349
  
350
  
351
  
352
  
353
  
354
  
355
  
356
  
357
  
358
  
359
  
360
  
361
  
362
  
363
  
364
  
365
  
366
  
367
  
368
  
369
  
370
  
371
  
372
  
373
  
374
  
375
  
376
  
377
  
378
  
379
  
380
  
381
  
382
  
383
  
384
  
385
  
386
  
387
  
388
  
389
  
390
  
391
  
392
  
393
  
394
  
395
  
396
  
397
  
398
  
399
  
400
  
401
  
402
  
403
  
404
  
405
  
406
  
407
  
408
  
409
  
410
  
411
  
412
  
413
  
414
  
415
  
416
  
417
  
418
  
419
  
420
  
421
  
422
  
423
  
424
  
425
  
426
  
427
  
428
  
429
  
430
  
431
  
432
  
433
  
434
  
435
  
436
  
437
  
438
  
439
  
440
  
441
  
442
  
443
  
444
  
445
  
446
  
447
  
448
  
449
  
450
  
451
  
452
  
453
  
454
  
455
  
456
  
457
  
458
  
459
  
460
  
461
  
462
  
463
  
464
  
465
  
466
  
467
  
468
  
469
  
470
  
471
  
472
  
473
  
474
  
475
  
476
  
477
  
478
  
479
  
480
  
481
  
482
  
483
  
484
  
485
  
486
  
487
  
488
  
489
  
490
  
491
  
492
  
493
  
494
  
495
  
496
  
497
  
498
  
499
  
500
  
501
  
502
  
503
  
504
  
505
  
506
  
507
  
508
  
509
  
510
  
511
  
512
  
513
  
514
  
515
  
516
  
517
  
518
  
519
  
520
  
521
  
522
  
523
  
524
  
525
  
526
  
527
  
528
  
529
  
530
  
531
  
532
  
533
  
534
  
535
  
536
  
537
  
538
  
539
  
540
  
541
  
542
  
543
  
544
  
545
  
546
  
547
  
548
  
549
  
550
  
551
  
552
  
553
  
554
  
555
  
556
  
557
  
558
  
559
  
560
  
561
  
562
  
563
  
564
  
565
  
566
  
567
  
568
  
569
  
570
  
571
  
572
  
573
  
574
  
575
  
576
  
577
  
578
  
579
  
580
  
581
  
582
  
583
  
584
  
585
  
586
  
587
  
588
  
589
  
590
  
591
  
592
  
593
  
594
  
595
  
596
  
597
  
598
  
599
  
600
  
601
  
602
  
603
  
604
  
605
  
606
  
607
  
608
  
609
  
610
  
611
  
612
  
613
  
614
  
615
  
616
  
617
  
618
  
619
  
620
  
621
  
622
  
623
  
624
  
625
  
626
  
627
  
628
  
629
  
630
  
631
  
632
  
/* -*- c -*- 
|| This file is part of Pike. For copyright information see COPYRIGHT. 
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING 
|| for more information. 
*/ 
 
/*! @module System 
 */ 
 
/*! @module FSEvents 
 */ 
 
#include "module.h" 
#include "interpret.h" 
#include "threads.h" 
#include "pike_types.h" 
#include "builtin_functions.h" 
 
#include "fsevents_config.h" 
 
#define ADD_ICONST(name) do {                   \ 
        add_integer_constant(#name, name, 0);   \ 
} while(0); 
 
#ifdef HAVE_FRAMEWORK_CORESERVICES 
#import <CoreServices/CoreServices.h> 
#endif /* HAVE_FRAMEWORK_CORESERVICES */ 
 
DECLARATIONS 
#ifdef HAVE_FRAMEWORK_CORESERVICES 
 
void low_stop(void); 
struct pike_string * string_from_cfstring(CFStringRef cfString); 
 
struct event_callback_ctx 
{ 
  ConstFSEventStreamRef streamRef; 
  void *clientCallBackInfo; 
  size_t numEvents; 
  void *eventPaths; 
  const FSEventStreamEventFlags * eventFlags; 
  const FSEventStreamEventId * eventIds; 
}; 
 
static void do_event_callback(struct event_callback_ctx * ctx); 
 
static void event_callback(ConstFSEventStreamRef streamRef, 
                             void *clientCallBackInfo, 
                             size_t numEvents, 
                             void *eventPaths, 
                             const FSEventStreamEventFlags eventFlags[], 
                             const FSEventStreamEventId eventIds[]); 
 
/*! @class EventStream 
 */ 
 
PIKECLASS EventStream 
{ 
  CVAR CFRunLoopRef runLoop; 
  CVAR FSEventStreamRef stream; 
  CVAR int isRunning; 
  CVAR CFArrayRef _paths; 
  CVAR FSEventStreamEventId _sinceWhen; 
  CVAR FSEventStreamCreateFlags _flags; 
  CVAR CFAbsoluteTime _latency; 
 
  PIKEVAR function callback_func; 
 
/*! @decl int is_started() 
 *! Has start() been called? 
 */ 
PIKEFUN int is_started() 
{ 
  RETURN(THIS->isRunning); 
} 
 
/*! @decl void flush_async() 
 *! 
 *! Requests that the FS Events service to flush out any events that have occurred but have not yet been 
 *! delivered, due to the latency parameter that was supplied when the stream was created. 
 *! 
 *! This flushing occurs asynchronously -- events most likely will not have been delivered 
 *! by the time this call returns. 
 *! 
 *! @note 
 *! Only call this function after the stream has been started, via start(). 
 */ 
PIKEFUN void flush_async() 
{ 
  if(THIS->stream) 
        FSEventStreamFlushAsync(THIS->stream); 
  else 
    Pike_error("FSEvents.EventStream: not started\n"); 
} 
 
/*! @decl void flush_sync() 
 *! 
 *! Requests that the FS Events service to flush out any events that have occurred but have not yet been 
 *! delivered, due to the latency parameter that was supplied when the stream was created. 
 *! 
 *! Flushing synchronously when using this method; clients will have received all the callbacks by 
 *! the time this call returns to them. 
 *! 
 *! @note 
 *! Only call this function after the stream has been started, via start(). 
 *! 
 */ 
PIKEFUN void flush_sync() 
{ 
  if(THIS->stream) 
        FSEventStreamFlushSync(THIS->stream); 
  else 
    Pike_error("FSEvents.EventStream: not started\n"); 
} 
 
/*! @decl void create(array(string) paths, float latency, int|void since_when, int|void flags) 
 *!   Creates a new Public.System.FSEvents.EventStream object 
 *! 
 *! @param paths 
 *! An array with each element containing a path to a directory, signifying the root of a 
 *! filesystem hierarchy to be watched for modifications. 
 *! 
 *! Additional paths may be added later using @[add_path()], though only if the stream is stopped. 
 *! 
 *! @param latency 
 *! The number of seconds the service should wait after hearing about an event from the kernel 
 *! before passing it along to the client via its callback. Specifying a larger value may 
 *! result in more effective temporal coalescing, resulting in fewer callbacks and greater 
 *! overall efficiency. 
 *! 
 *! @param since_when 
 *! The service will supply events that have happened after the given event ID. To ask for events 
 *! "since now" pass the constant kFSEventStreamEventIdSinceNow. Do not pass zero for this value 
 *! unless you want to receive events for the requested directories "since the beginning of time". 
 *! 
 *! @param flags 
 *! Flags that modify the behavior of the stream being created. See Apple's FSEvents documentation 
 *! for details of the various flags available. 
 */ 
PIKEFUN void create(array paths, float latency, int|void sinceWhen, int|void flags) 
{ 
  int idx = 0, cnt = 0; 
 
  THIS->isRunning = 0; 
  THIS->_latency = latency; 
 
  if(sinceWhen && TYPEOF(*sinceWhen) == T_INT) 
  { 
    THIS->_sinceWhen = sinceWhen->u.integer; 
  } 
  else 
  { 
    THIS->_sinceWhen = kFSEventStreamEventIdSinceNow; 
  } 
 
  if(flags && TYPEOF(*flags) == T_INT) 
  { 
    THIS->_flags = flags->u.integer; 
  } 
  else 
  { 
    THIS->_flags = kFSEventStreamCreateFlagNone; 
  } 
 
  THIS->_paths = CFArrayCreateMutable(NULL, 0, NULL); 
  CFRetain(THIS->_paths); 
 
  if(paths && paths->size) 
  { 
    for(idx = 0; idx < paths->size; idx++) 
    { 
      struct svalue sv; 
      CFStringRef str; 
      if(TYPEOF(ITEM(paths)[idx]) != T_STRING) continue; 
      sv = ITEM(paths)[idx]; 
      push_svalue(&sv); 
      f_string_to_utf8(1); 
      str = CFStringCreateWithBytes(NULL, (const UInt8 *)(Pike_sp[-1].u.string->str), (CFIndex)Pike_sp[-1].u.string->len, kCFStringEncodingUTF8, false); 
      pop_stack(); 
      CFArrayInsertValueAtIndex( (CFMutableArrayRef)THIS->_paths, cnt, str); 
      cnt++; 
    } 
  } 
} 
 
/*! @decl void add_path(string path) 
 *!   Add a path to the monitor list. 
 *! 
 *! @param path 
 *! 
 *!  @note 
 *!    this can only be called when the monitor is stopped. 
 */ 
PIKEFUN void add_path(string path) 
{ 
  if(THIS->isRunning) 
  { 
    Pike_error("Cannot add paths while monitor is started.\n"); 
  } 
 
  if(path && path->len) 
  { 
    int size; 
    CFStringRef str; 
    f_string_to_utf8(1); 
    str = CFStringCreateWithBytes(NULL, (const UInt8 *)(Pike_sp[-1].u.string->str), (CFIndex)Pike_sp[-1].u.string->len, kCFStringEncodingUTF8, false); 
    size = CFArrayGetCount(THIS->_paths); 
    CFArrayInsertValueAtIndex( (CFMutableArrayRef)THIS->_paths, size, str); 
  } 
} 
 
/*! @decl void set_callback(function callback) 
 *! Sets the function that will be called when a file notification event is received. 
 *! 
 *! The method signature for the callback is: 
 *! 
 *! void event_callback(string path, int flags, int event_id) 
 */ 
PIKEFUN void set_callback(function callback) 
{ 
  assign_svalue(&THIS->callback_func, callback); 
} 
 
/* 
 *   TODO we should allow the runloop to be specified. 
 */ 
 
/*! @decl void start() 
 *! 
 *! Requests that new events be delivered to this EventStream. 
 *! 
 *! If a value was supplied for the since_when parameter then "historical" events will be sent via 
 *! your callback first, then a HistoryDone event, then "contemporary" events will be sent on 
 *! an ongoing basis. 
 */ 
PIKEFUN void start() 
{ 
  FSEventStreamContext context; 
 
  if(THIS->isRunning) 
  { 
    Pike_error("EventStream: monitor is already running.\n"); 
  } 
 
  if(!THIS->_paths) 
    Pike_error("EventStream: no paths.\n"); 
 
  if(!THIS->_sinceWhen) 
    Pike_error("EventStream: no startdate.\n"); 
 
  if(!THIS->_latency) 
    Pike_error("EventStream: no latency.\n"); 
 
  if(CFArrayGetCount(THIS->_paths)) 
  { 
    THIS->runLoop = CFRunLoopGetCurrent(); 
    CFRetain(THIS->runLoop); 
 
    context.version = 0; 
    context.info = THIS; 
    context.retain = NULL; 
    context.release = NULL; 
    context.copyDescription = NULL; 
 
    THIS->stream = FSEventStreamCreate(kCFAllocatorDefault, 
      &event_callback, 
      &context, 
      THIS->_paths, 
      THIS->_sinceWhen, 
      THIS->_latency, 
      THIS->_flags | 
      kFSEventStreamCreateFlagUseCFTypes 
    ); 
 
    THIS->isRunning = 1; 
    FSEventStreamScheduleWithRunLoop(THIS->stream, THIS->runLoop, kCFRunLoopDefaultMode); 
    FSEventStreamStart(THIS->stream); 
  } 
  else 
  { 
    Pike_error("EventStream: No paths registered for monitoring.\n"); 
  } 
} 
 
/*! @decl void stop() 
 *! Stops watching for new events. 
 */ 
PIKEFUN void stop() 
{ 
  low_stop(); 
} 
 
void low_stop(void) 
{ 
  if(THIS->isRunning) 
  { 
    FSEventStreamStop(THIS->stream); 
    FSEventStreamUnscheduleFromRunLoop(THIS->stream, THIS->runLoop, kCFRunLoopDefaultMode); 
        FSEventStreamInvalidate(THIS->stream); 
        FSEventStreamRelease(THIS->stream); 
    CFRelease(THIS->runLoop); 
    THIS->isRunning = 0; 
  } 
} 
 
/** 
 * FSEvents callback function. The frequency at which this callback is 
 * called depends upon the notification latency value. This callback is usually 
 * called with more than one event and so multiple calls to the callback occur. 
 * 
 * @param streamRef          The calling stream reference 
 * @param clientCallBackInfo Any client callback info that was supplied when the stream was created 
 * @param numEvents          The number of events being supplied 
 * @param eventPaths         An array of the event's paths 
 * @param eventFlags         An array of flags associated with the events 
 * @param eventIds           An array of IDs associated with the events 
 */ 
 
static void event_callback(ConstFSEventStreamRef streamRef, 
                              void *clientCallBackInfo, 
                              size_t numEvents, 
                              void *eventPaths, 
                              const FSEventStreamEventFlags eventFlags[], 
                              const FSEventStreamEventId eventIds[]) 
{ 
  struct event_callback_ctx ctx; 
  struct event_callback_ctx * ctx_ptr; 
 
  ctx.streamRef = streamRef; 
  ctx.clientCallBackInfo = clientCallBackInfo; 
  ctx.numEvents = numEvents; 
  ctx.eventPaths = eventPaths; 
  ctx.eventFlags = eventFlags; 
  ctx.eventIds = eventIds; 
 
  ctx_ptr = &ctx; 
 
  call_with_interpreter((void *)&do_event_callback, (void *)ctx_ptr); 
/* 
      do_event_callback(streamRef, clientCallBackInfo, numEvents, eventPaths, eventFlags, eventIds); 
*/ 
} 
 
static void do_event_callback(struct event_callback_ctx * ctx) 
{ 
   size_t cnt = 0; 
 
  for(cnt = 0; cnt < ctx->numEvents; cnt++) 
  { 
     CFStringRef eventPath; 
     struct pike_string * str; 
     const char * u8s; 
         struct FSEvents_EventStream_struct * eventStreamObj; 
 
         eventPath = CFArrayGetValueAtIndex(ctx->eventPaths, (CFIndex)cnt); 
         str = string_from_cfstring(eventPath); 
         push_string(str); 
         f_utf8_to_string(1); 
         push_int(ctx->eventFlags[cnt]); 
         push_int(ctx->eventIds[cnt]); 
         eventStreamObj = (struct FSEvents_EventStream_struct *)(ctx->clientCallBackInfo); 
         apply_svalue(&eventStreamObj->callback_func, 3); 
  } 
} 
 
struct pike_string * string_from_cfstring(CFStringRef cfString) 
{ 
  const char *useUTF8StringPtr = NULL; 
  UInt8 *freeUTF8StringPtr = NULL; 
  struct pike_string * str = NULL; 
  long utf8Length; 
 
  CFIndex stringLength = CFStringGetLength(cfString), usedBytes = 0L; 
 
  if((useUTF8StringPtr = CFStringGetCStringPtr(cfString, kCFStringEncodingUTF8)) == NULL) { 
    if((freeUTF8StringPtr = malloc(stringLength + 1L)) != NULL) { 
      CFStringGetBytes(cfString, CFRangeMake(0L, stringLength), kCFStringEncodingUTF8, '?', false, freeUTF8StringPtr, stringLength, &usedBytes); 
      freeUTF8StringPtr[usedBytes] = 0; 
      useUTF8StringPtr = (const char *)freeUTF8StringPtr; 
    } 
  } 
 
  utf8Length = (long)((freeUTF8StringPtr != NULL) ? usedBytes : stringLength); 
 
  if(useUTF8StringPtr != NULL) { 
    /* 
     *  useUTF8StringPtr points to a NULL terminated UTF8 encoded string. 
     *  utf8Length contains the length of the UTF8 string. 
     */ 
    str = make_shared_binary_string(useUTF8StringPtr, utf8Length); 
  } 
 
  if(freeUTF8StringPtr != NULL) { free(freeUTF8StringPtr); freeUTF8StringPtr = NULL; } 
 
  return str; 
} 
 
  INIT 
  { 
  } 
 
  EXIT 
  { 
#ifdef HAVE_FRAMEWORK_CORESERVICES 
    low_stop(); 
    if(THIS->_paths) CFRelease(THIS->_paths); 
#endif /* HAVE_FRAMEWORK_CORESERVICES */ 
  } 
 
} 
 
/*! @endclass 
 */ 
 
#endif /* HAVE_FRAMEWORK_CORESERVICES */ 
 
PIKE_MODULE_INIT 
{ 
  INIT; 
/*! @decl constant kFSEventStreamEventFlagNone 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagMustScanSubDirs 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagUserDropped 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagKernelDropped 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagEventIdsWrapped 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagHistoryDone 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagRootChanged 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagMount 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagUnmount 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagItemCreated 
 *! Available in MacOS X 10.7 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagItemRemoved 
 *! Available in MacOS X 10.7 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagInodeMetaMod 
 *! Available in MacOS X 10.7 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagRenamed 
 *! Available in MacOS X 10.7 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagItemModified 
 *! Available in MacOS X 10.7 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagFinderInfoMod 
 *! Available in MacOS X 10.7 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagChangeOwner 
 *! Available in MacOS X 10.7 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagXattrMod 
 *! Available in MacOS X 10.7 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagIsFile 
 *! Available in MacOS X 10.7 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagIsDir 
 *! Available in MacOS X 10.7 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamEventFlagIsSymlink 
 *! Available in MacOS X 10.7 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamCreateFlagFileEvents 
 *! Available in MacOS X 10.7 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamCreateFlagIgnoreSelf 
 *! Available in MacOS X 10.6 and newer. 
 */ 
 
/*! @decl constant kFSEventStreamCreateFlagWatchRoot 
 */ 
 
/*! @decl constant kFSEventStreamCreateFlagNoDefer 
 */ 
 
/*! @decl constant kFSEventStreamCreateFlagNone 
 */ 
 
/*! @decl constant kFSEventStreamEventIdSinceNow 
 */ 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGNONE 
 ADD_ICONST(kFSEventStreamEventFlagNone); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGMUSTSCANSUBDIRS 
 ADD_ICONST(kFSEventStreamEventFlagMustScanSubDirs); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGUSERDROPPED 
 ADD_ICONST(kFSEventStreamEventFlagUserDropped); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGKERNELDROPPED 
 ADD_ICONST(kFSEventStreamEventFlagKernelDropped); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGEVENTIDSWRAPPED 
 ADD_ICONST(kFSEventStreamEventFlagEventIdsWrapped); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGHISTORYDONE 
 ADD_ICONST(kFSEventStreamEventFlagHistoryDone); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGROOTCHANGED 
 ADD_ICONST(kFSEventStreamEventFlagRootChanged); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGMOUNT 
 ADD_ICONST(kFSEventStreamEventFlagMount); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGUNMOUNT 
 ADD_ICONST(kFSEventStreamEventFlagUnmount); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGITEMCREATED 
 ADD_ICONST(kFSEventStreamEventFlagItemCreated); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGITEMREMOVED 
 ADD_ICONST(kFSEventStreamEventFlagItemRemoved); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGINODEMETAMOD 
 ADD_ICONST(kFSEventStreamEventFlagItemInodeMetaMod); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGITEMRENAMED 
 ADD_ICONST(kFSEventStreamEventFlagItemRenamed); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGITEMMODIFIED 
 ADD_ICONST(kFSEventStreamEventFlagItemModified); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGFINDERINFOMOD 
 ADD_ICONST(kFSEventStreamEventFlagItemFinderInfoMod); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGITEMCHANGEOWNER 
 ADD_ICONST(kFSEventStreamEventFlagItemChangeOwner); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGITEMXATTRMOD 
 ADD_ICONST(kFSEventStreamEventFlagItemXattrMod); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGITEMISFILE 
 ADD_ICONST(kFSEventStreamEventFlagItemIsFile); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGITEMISDIR 
 ADD_ICONST(kFSEventStreamEventFlagItemIsDir); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTFLAGITEMISSYMLINK 
 ADD_ICONST(kFSEventStreamEventFlagItemIsSymlink); 
#endif 
 
/* 
 * flags for the stream creation 
 */ 
 
#if HAVE_DECL_KFSEVENTSTREAMCREATEFLAGFILEEVENTS 
 ADD_ICONST(kFSEventStreamCreateFlagFileEvents); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMCREATEFLAGIGNORESELF 
 ADD_ICONST(kFSEventStreamCreateFlagIgnoreSelf); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMCREATEFLAGWATCHROOT 
 ADD_ICONST(kFSEventStreamCreateFlagWatchRoot); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMCREATEFLAGNODEFER 
 ADD_ICONST(kFSEventStreamCreateFlagNoDefer); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMCREATEFLAGNONE 
 
 ADD_ICONST(kFSEventStreamCreateFlagNone); 
#endif 
 
#if HAVE_DECL_KFSEVENTSTREAMEVENTIDSINCENOW 
  ADD_ICONST(kFSEventStreamEventIdSinceNow); 
#endif 
 
} 
 
PIKE_MODULE_EXIT 
{ 
  EXIT; 
} 
 
/*! @endmodule 
 */ 
 
/*! @endmodule 
 */