objc2_core_services/generated/
FSEvents.rs1use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "dispatch2")]
8use dispatch2::*;
9#[cfg(feature = "objc2")]
10use objc2::__framework_prelude::*;
11use objc2_core_foundation::*;
12
13use crate::*;
14
15pub type FSEventStreamCreateFlags = u32;
17
18pub const kFSEventStreamCreateFlagNone: c_uint = 0x00000000;
20pub const kFSEventStreamCreateFlagUseCFTypes: c_uint = 0x00000001;
22pub const kFSEventStreamCreateFlagNoDefer: c_uint = 0x00000002;
24pub const kFSEventStreamCreateFlagWatchRoot: c_uint = 0x00000004;
26pub const kFSEventStreamCreateFlagIgnoreSelf: c_uint = 0x00000008;
28pub const kFSEventStreamCreateFlagFileEvents: c_uint = 0x00000010;
30pub const kFSEventStreamCreateFlagMarkSelf: c_uint = 0x00000020;
32pub const kFSEventStreamCreateFlagUseExtendedData: c_uint = 0x00000040;
34pub const kFSEventStreamCreateFlagFullHistory: c_uint = 0x00000080;
36pub const kFSEventStreamCreateWithDocID: c_uint = 0x00000100;
38pub const kFSEventStreamCreateDeviceState: c_uint = 0x00000200;
40
41pub type FSEventStreamEventFlags = u32;
43
44pub const kFSEventStreamEventFlagNone: c_uint = 0x00000000;
46pub const kFSEventStreamEventFlagMustScanSubDirs: c_uint = 0x00000001;
48pub const kFSEventStreamEventFlagUserDropped: c_uint = 0x00000002;
50pub const kFSEventStreamEventFlagKernelDropped: c_uint = 0x00000004;
52pub const kFSEventStreamEventFlagEventIdsWrapped: c_uint = 0x00000008;
54pub const kFSEventStreamEventFlagHistoryDone: c_uint = 0x00000010;
56pub const kFSEventStreamEventFlagRootChanged: c_uint = 0x00000020;
58pub const kFSEventStreamEventFlagMount: c_uint = 0x00000040;
60pub const kFSEventStreamEventFlagUnmount: c_uint = 0x00000080;
62pub const kFSEventStreamEventFlagItemCreated: c_uint = 0x00000100;
64pub const kFSEventStreamEventFlagItemRemoved: c_uint = 0x00000200;
66pub const kFSEventStreamEventFlagItemInodeMetaMod: c_uint = 0x00000400;
68pub const kFSEventStreamEventFlagItemRenamed: c_uint = 0x00000800;
70pub const kFSEventStreamEventFlagItemModified: c_uint = 0x00001000;
72pub const kFSEventStreamEventFlagItemFinderInfoMod: c_uint = 0x00002000;
74pub const kFSEventStreamEventFlagItemChangeOwner: c_uint = 0x00004000;
76pub const kFSEventStreamEventFlagItemXattrMod: c_uint = 0x00008000;
78pub const kFSEventStreamEventFlagItemIsFile: c_uint = 0x00010000;
80pub const kFSEventStreamEventFlagItemIsDir: c_uint = 0x00020000;
82pub const kFSEventStreamEventFlagItemIsSymlink: c_uint = 0x00040000;
84pub const kFSEventStreamEventFlagOwnEvent: c_uint = 0x00080000;
86pub const kFSEventStreamEventFlagItemIsHardlink: c_uint = 0x00100000;
88pub const kFSEventStreamEventFlagItemIsLastHardlink: c_uint = 0x00200000;
90pub const kFSEventStreamEventFlagItemCloned: c_uint = 0x00400000;
92
93pub type FSEventStreamEventId = u64;
95
96#[repr(C)]
98#[derive(Debug)]
99pub struct __FSEventStream {
100 inner: [u8; 0],
101 _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
102}
103
104#[cfg(feature = "objc2")]
105unsafe impl RefEncode for __FSEventStream {
106 const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("__FSEventStream", &[]));
107}
108
109pub type FSEventStreamRef = *mut __FSEventStream;
111
112#[repr(C, packed(2))]
114#[allow(unpredictable_function_pointer_comparisons)]
115#[derive(Clone, Copy, Debug, PartialEq)]
116pub struct FSEventStreamContext {
117 pub version: CFIndex,
118 pub info: *mut c_void,
119 pub retain: CFAllocatorRetainCallBack,
120 pub release: CFAllocatorReleaseCallBack,
121 pub copyDescription: CFAllocatorCopyDescriptionCallBack,
122}
123
124#[cfg(feature = "objc2")]
125unsafe impl Encode for FSEventStreamContext {
126 const ENCODING: Encoding = Encoding::Struct(
127 "FSEventStreamContext",
128 &[
129 <CFIndex>::ENCODING,
130 <*mut c_void>::ENCODING,
131 <CFAllocatorRetainCallBack>::ENCODING,
132 <CFAllocatorReleaseCallBack>::ENCODING,
133 <CFAllocatorCopyDescriptionCallBack>::ENCODING,
134 ],
135 );
136}
137
138#[cfg(feature = "objc2")]
139unsafe impl RefEncode for FSEventStreamContext {
140 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
141}
142
143pub type FSEventStreamCallback = Option<
145 unsafe extern "C-unwind" fn(
146 ConstFSEventStreamRef,
147 *mut c_void,
148 usize,
149 NonNull<c_void>,
150 NonNull<FSEventStreamEventFlags>,
151 NonNull<FSEventStreamEventId>,
152 ),
153>;
154
155extern "C-unwind" {
156 pub fn FSEventStreamCreate(
162 allocator: Option<&CFAllocator>,
163 callback: FSEventStreamCallback,
164 context: *mut FSEventStreamContext,
165 paths_to_watch: &CFArray,
166 since_when: FSEventStreamEventId,
167 latency: CFTimeInterval,
168 flags: FSEventStreamCreateFlags,
169 ) -> FSEventStreamRef;
170}
171
172extern "C-unwind" {
173 #[cfg(feature = "libc")]
179 pub fn FSEventStreamCreateRelativeToDevice(
180 allocator: Option<&CFAllocator>,
181 callback: FSEventStreamCallback,
182 context: *mut FSEventStreamContext,
183 device_to_watch: libc::dev_t,
184 paths_to_watch_relative_to_device: &CFArray,
185 since_when: FSEventStreamEventId,
186 latency: CFTimeInterval,
187 flags: FSEventStreamCreateFlags,
188 ) -> FSEventStreamRef;
189}
190
191extern "C-unwind" {
192 pub fn FSEventStreamGetLatestEventId(stream_ref: ConstFSEventStreamRef)
196 -> FSEventStreamEventId;
197}
198
199extern "C-unwind" {
200 #[cfg(feature = "libc")]
204 pub fn FSEventStreamGetDeviceBeingWatched(stream_ref: ConstFSEventStreamRef) -> libc::dev_t;
205}
206
207#[inline]
211pub unsafe extern "C-unwind" fn FSEventStreamCopyPathsBeingWatched(
212 stream_ref: ConstFSEventStreamRef,
213) -> CFRetained<CFArray> {
214 extern "C-unwind" {
215 fn FSEventStreamCopyPathsBeingWatched(
216 stream_ref: ConstFSEventStreamRef,
217 ) -> Option<NonNull<CFArray>>;
218 }
219 let ret = unsafe { FSEventStreamCopyPathsBeingWatched(stream_ref) };
220 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
221 unsafe { CFRetained::from_raw(ret) }
222}
223
224extern "C-unwind" {
225 pub fn FSEventsGetCurrentEventId() -> FSEventStreamEventId;
226}
227
228#[cfg(feature = "libc")]
229#[inline]
230pub unsafe extern "C-unwind" fn FSEventsCopyUUIDForDevice(
231 dev: libc::dev_t,
232) -> Option<CFRetained<CFUUID>> {
233 extern "C-unwind" {
234 fn FSEventsCopyUUIDForDevice(dev: libc::dev_t) -> Option<NonNull<CFUUID>>;
235 }
236 let ret = unsafe { FSEventsCopyUUIDForDevice(dev) };
237 ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
238}
239
240extern "C-unwind" {
241 #[cfg(feature = "libc")]
242 pub fn FSEventsGetLastEventIdForDeviceBeforeTime(
243 dev: libc::dev_t,
244 time: CFAbsoluteTime,
245 ) -> FSEventStreamEventId;
246}
247
248#[cfg(feature = "libc")]
249#[inline]
250pub unsafe extern "C-unwind" fn FSEventsPurgeEventsForDeviceUpToEventId(
251 dev: libc::dev_t,
252 event_id: FSEventStreamEventId,
253) -> bool {
254 extern "C-unwind" {
255 fn FSEventsPurgeEventsForDeviceUpToEventId(
256 dev: libc::dev_t,
257 event_id: FSEventStreamEventId,
258 ) -> Boolean;
259 }
260 let ret = unsafe { FSEventsPurgeEventsForDeviceUpToEventId(dev, event_id) };
261 ret != 0
262}
263
264extern "C-unwind" {
265 pub fn FSEventStreamRetain(stream_ref: FSEventStreamRef);
269}
270
271extern "C-unwind" {
272 pub fn FSEventStreamRelease(stream_ref: FSEventStreamRef);
276}
277
278extern "C-unwind" {
279 #[deprecated = "Use FSEventStreamSetDispatchQueue instead."]
284 pub fn FSEventStreamScheduleWithRunLoop(
285 stream_ref: FSEventStreamRef,
286 run_loop: &CFRunLoop,
287 run_loop_mode: &CFString,
288 );
289}
290
291extern "C-unwind" {
292 #[deprecated = "Use FSEventStreamSetDispatchQueue instead."]
297 pub fn FSEventStreamUnscheduleFromRunLoop(
298 stream_ref: FSEventStreamRef,
299 run_loop: &CFRunLoop,
300 run_loop_mode: &CFString,
301 );
302}
303
304extern "C-unwind" {
305 #[cfg(feature = "dispatch2")]
310 pub fn FSEventStreamSetDispatchQueue(stream_ref: FSEventStreamRef, q: Option<&DispatchQueue>);
311}
312
313extern "C-unwind" {
314 pub fn FSEventStreamInvalidate(stream_ref: FSEventStreamRef);
318}
319
320#[inline]
324pub unsafe extern "C-unwind" fn FSEventStreamStart(stream_ref: FSEventStreamRef) -> bool {
325 extern "C-unwind" {
326 fn FSEventStreamStart(stream_ref: FSEventStreamRef) -> Boolean;
327 }
328 let ret = unsafe { FSEventStreamStart(stream_ref) };
329 ret != 0
330}
331
332extern "C-unwind" {
333 pub fn FSEventStreamFlushAsync(stream_ref: FSEventStreamRef) -> FSEventStreamEventId;
337}
338
339extern "C-unwind" {
340 pub fn FSEventStreamFlushSync(stream_ref: FSEventStreamRef);
344}
345
346extern "C-unwind" {
347 pub fn FSEventStreamStop(stream_ref: FSEventStreamRef);
351}
352
353extern "C-unwind" {
354 pub fn FSEventStreamShow(stream_ref: ConstFSEventStreamRef);
358}
359
360#[inline]
364pub unsafe extern "C-unwind" fn FSEventStreamCopyDescription(
365 stream_ref: ConstFSEventStreamRef,
366) -> CFRetained<CFString> {
367 extern "C-unwind" {
368 fn FSEventStreamCopyDescription(
369 stream_ref: ConstFSEventStreamRef,
370 ) -> Option<NonNull<CFString>>;
371 }
372 let ret = unsafe { FSEventStreamCopyDescription(stream_ref) };
373 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
374 unsafe { CFRetained::from_raw(ret) }
375}
376
377#[inline]
382pub unsafe extern "C-unwind" fn FSEventStreamSetExclusionPaths(
383 stream_ref: FSEventStreamRef,
384 paths_to_exclude: &CFArray,
385) -> bool {
386 extern "C-unwind" {
387 fn FSEventStreamSetExclusionPaths(
388 stream_ref: FSEventStreamRef,
389 paths_to_exclude: &CFArray,
390 ) -> Boolean;
391 }
392 let ret = unsafe { FSEventStreamSetExclusionPaths(stream_ref, paths_to_exclude) };
393 ret != 0
394}