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
#![allow(non_upper_case_globals, non_camel_case_types)]
extern crate libc;
use core_foundation as cf;
pub type FSEventStreamRef = *mut libc::c_void;
pub type FSEventStreamCallback = extern "C" fn(
FSEventStreamRef,
*mut libc::c_void,
libc::size_t,
*mut libc::c_void,
*mut libc::c_void,
*mut libc::c_void,
);
pub type FSEventStreamEventId = u64;
pub const kFSEventStreamEventIdSinceNow: FSEventStreamEventId = 0xFFFFFFFFFFFFFFFF;
pub type FSEventStreamCreateFlags = u32;
pub const kFSEventStreamCreateFlagNone: FSEventStreamCreateFlags = 0x00000000;
pub const kFSEventStreamCreateFlagUseCFTypes: FSEventStreamCreateFlags = 0x00000001;
pub const kFSEventStreamCreateFlagNoDefer: FSEventStreamCreateFlags = 0x00000002;
pub const kFSEventStreamCreateFlagWatchRoot: FSEventStreamCreateFlags = 0x00000004;
pub const kFSEventStreamCreateFlagIgnoreSelf: FSEventStreamCreateFlags = 0x00000008;
pub const kFSEventStreamCreateFlagFileEvents: FSEventStreamCreateFlags = 0x00000010;
#[repr(C)]
pub struct FSEventStreamContext {
pub version: cf::CFIndex,
pub info: *mut libc::c_void,
pub retain: *mut libc::c_void,
pub copy_description: *mut libc::c_void,
}
#[link(name = "CoreServices", kind = "framework")]
extern "C" {
pub fn FSEventStreamCreate(
allocator: cf::CFRef,
callback: *const FSEventStreamCallback,
context: *const FSEventStreamContext,
pathsToWatch: cf::CFMutableArrayRef,
sinceWhen: FSEventStreamEventId,
latency: cf::CFTimeInterval,
flags: FSEventStreamCreateFlags ) -> FSEventStreamRef;
pub fn FSEventStreamShow(stream_ref: FSEventStreamRef);
pub fn FSEventStreamScheduleWithRunLoop(stream_ref: FSEventStreamRef,
run_loop: cf::CFRunLoopRef,
run_loop_mode: cf::CFStringRef);
pub fn FSEventStreamUnscheduleFromRunLoop(stream_ref: FSEventStreamRef,
run_loop: cf::CFRunLoopRef,
run_loop_mode: cf::CFStringRef);
pub fn FSEventStreamStart(stream_ref: FSEventStreamRef) -> bool;
pub fn FSEventStreamFlushSync(stream_ref: FSEventStreamRef);
pub fn FSEventStreamStop(stream_ref: FSEventStreamRef);
pub fn FSEventStreamInvalidate(stream_ref: FSEventStreamRef);
pub fn FSEventStreamRelease(stream_ref: FSEventStreamRef);
}