| 1 |
#![allow(non_upper_case_globals, non_camel_case_types)] |
| 2 |
|
| 3 |
use core_foundation as cf; |
| 4 |
|
| 5 |
pub type FSEventStreamRef = *mut ::std::os::raw::c_void; |
| 6 |
|
| 7 |
pub type FSEventStreamCallback = extern "C" fn( |
| 8 |
FSEventStreamRef, |
| 9 |
*mut ::std::os::raw::c_void, |
| 10 |
usize, |
| 11 |
*mut ::std::os::raw::c_void, |
| 12 |
*const ::std::os::raw::c_void, |
| 13 |
*const ::std::os::raw::c_void, |
| 14 |
); |
| 15 |
|
| 16 |
pub type FSEventStreamEventId = u64; |
| 17 |
|
| 18 |
pub const kFSEventStreamEventIdSinceNow: FSEventStreamEventId = 0xFFFFFFFFFFFFFFFF; |
| 19 |
|
| 20 |
pub type FSEventStreamCreateFlags = std::os::raw::c_uint; |
| 21 |
|
| 22 |
pub const kFSEventStreamCreateFlagNone: FSEventStreamCreateFlags = 0x00000000; |
| 23 |
pub const kFSEventStreamCreateFlagUseCFTypes: FSEventStreamCreateFlags = 0x00000001; |
| 24 |
pub const kFSEventStreamCreateFlagNoDefer: FSEventStreamCreateFlags = 0x00000002; |
| 25 |
pub const kFSEventStreamCreateFlagWatchRoot: FSEventStreamCreateFlags = 0x00000004; |
| 26 |
pub const kFSEventStreamCreateFlagIgnoreSelf: FSEventStreamCreateFlags = 0x00000008; |
| 27 |
pub const kFSEventStreamCreateFlagFileEvents: FSEventStreamCreateFlags = 0x00000010; |
| 28 |
pub const kFSEventStreamCreateFlagMarkSelf: FSEventStreamCreateFlags = 0x00000020; |
| 29 |
pub const kFSEventStreamCreateFlagUseExtendedData: FSEventStreamCreateFlags = 0x00000040; |
| 30 |
|
| 31 |
pub type FSEventStreamEventFlags = std::os::raw::c_uint; |
| 32 |
|
| 33 |
pub const kFSEventStreamEventFlagNone: FSEventStreamEventFlags = 0x00000000; |
| 34 |
pub const kFSEventStreamEventFlagMustScanSubDirs: FSEventStreamEventFlags = 0x00000001; |
| 35 |
pub const kFSEventStreamEventFlagUserDropped: FSEventStreamEventFlags = 0x00000002; |
| 36 |
pub const kFSEventStreamEventFlagKernelDropped: FSEventStreamEventFlags = 0x00000004; |
| 37 |
pub const kFSEventStreamEventFlagEventIdsWrapped: FSEventStreamEventFlags = 0x00000008; |
| 38 |
pub const kFSEventStreamEventFlagHistoryDone: FSEventStreamEventFlags = 0x00000010; |
| 39 |
pub const kFSEventStreamEventFlagRootChanged: FSEventStreamEventFlags = 0x00000020; |
| 40 |
pub const kFSEventStreamEventFlagMount: FSEventStreamEventFlags = 0x00000040; |
| 41 |
pub const kFSEventStreamEventFlagUnmount: FSEventStreamEventFlags = 0x00000080; |
| 42 |
pub const kFSEventStreamEventFlagItemCreated: FSEventStreamEventFlags = 0x00000100; |
| 43 |
pub const kFSEventStreamEventFlagItemRemoved: FSEventStreamEventFlags = 0x00000200; |
| 44 |
pub const kFSEventStreamEventFlagItemInodeMetaMod: FSEventStreamEventFlags = 0x00000400; |
| 45 |
pub const kFSEventStreamEventFlagItemRenamed: FSEventStreamEventFlags = 0x00000800; |
| 46 |
pub const kFSEventStreamEventFlagItemModified: FSEventStreamEventFlags = 0x00001000; |
| 47 |
pub const kFSEventStreamEventFlagItemFinderInfoMod: FSEventStreamEventFlags = 0x00002000; |
| 48 |
pub const kFSEventStreamEventFlagItemChangeOwner: FSEventStreamEventFlags = 0x00004000; |
| 49 |
pub const kFSEventStreamEventFlagItemXattrMod: FSEventStreamEventFlags = 0x00008000; |
| 50 |
pub const kFSEventStreamEventFlagItemIsFile: FSEventStreamEventFlags = 0x00010000; |
| 51 |
pub const kFSEventStreamEventFlagItemIsDir: FSEventStreamEventFlags = 0x00020000; |
| 52 |
pub const kFSEventStreamEventFlagItemIsSymlink: FSEventStreamEventFlags = 0x00040000; |
| 53 |
pub const kFSEventStreamEventFlagOwnEvent: FSEventStreamEventFlags = 0x00080000; |
| 54 |
pub const kFSEventStreamEventFlagItemIsHardlink: FSEventStreamEventFlags = 0x00100000; |
| 55 |
pub const kFSEventStreamEventFlagItemIsLastHardlink: FSEventStreamEventFlags = 0x00200000; |
| 56 |
pub const kFSEventStreamEventFlagItemCloned: FSEventStreamEventFlags = 0x00400000; |
| 57 |
|
| 58 |
#[repr(C)] |
| 59 |
pub struct FSEventStreamContext { |
| 60 |
pub version: cf::CFIndex, |
| 61 |
pub info: *mut ::std::os::raw::c_void, |
| 62 |
pub retain: Option<cf::CFAllocatorRetainCallBack>, |
| 63 |
pub release: Option<cf::CFAllocatorReleaseCallBack>, |
| 64 |
pub copy_description: Option<cf::CFAllocatorCopyDescriptionCallBack>, |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
#[link(name = "CoreServices", kind = "framework")] |
| 70 |
extern "C" { |
| 71 |
pub fn FSEventStreamCreate( |
| 72 |
allocator: cf::CFAllocatorRef, |
| 73 |
callback: FSEventStreamCallback, |
| 74 |
context: *const FSEventStreamContext, |
| 75 |
pathsToWatch: cf::CFMutableArrayRef, |
| 76 |
sinceWhen: FSEventStreamEventId, |
| 77 |
latency: cf::CFTimeInterval, |
| 78 |
flags: FSEventStreamCreateFlags, |
| 79 |
) -> FSEventStreamRef; |
| 80 |
|
| 81 |
pub fn FSEventStreamShow(stream_ref: FSEventStreamRef); |
| 82 |
pub fn FSEventStreamScheduleWithRunLoop( |
| 83 |
stream_ref: FSEventStreamRef, |
| 84 |
run_loop: cf::CFRunLoopRef, |
| 85 |
run_loop_mode: cf::CFStringRef, |
| 86 |
); |
| 87 |
|
| 88 |
pub fn FSEventStreamUnscheduleFromRunLoop( |
| 89 |
stream_ref: FSEventStreamRef, |
| 90 |
run_loop: cf::CFRunLoopRef, |
| 91 |
run_loop_mode: cf::CFStringRef, |
| 92 |
); |
| 93 |
|
| 94 |
pub fn FSEventStreamStart(stream_ref: FSEventStreamRef) -> cf::Boolean; |
| 95 |
pub fn FSEventStreamFlushSync(stream_ref: FSEventStreamRef); |
| 96 |
pub fn FSEventStreamStop(stream_ref: FSEventStreamRef); |
| 97 |
pub fn FSEventStreamInvalidate(stream_ref: FSEventStreamRef); |
| 98 |
pub fn FSEventStreamRelease(stream_ref: FSEventStreamRef); |
| 99 |
} |