xref: /libuv/src/unix/darwin-stub.h (revision 33005022)
1 /* Copyright libuv project contributors. All rights reserved.
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to
5  * deal in the Software without restriction, including without limitation the
6  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7  * sell copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19  * IN THE SOFTWARE.
20  */
21 
22 #ifndef UV_DARWIN_STUB_H_
23 #define UV_DARWIN_STUB_H_
24 
25 #include <stdint.h>
26 
27 struct CFArrayCallBacks;
28 struct CFRunLoopSourceContext;
29 struct FSEventStreamContext;
30 
31 typedef double CFAbsoluteTime;
32 typedef double CFTimeInterval;
33 typedef int FSEventStreamEventFlags;
34 typedef int OSStatus;
35 typedef long CFIndex;
36 typedef struct CFArrayCallBacks CFArrayCallBacks;
37 typedef struct CFRunLoopSourceContext CFRunLoopSourceContext;
38 typedef struct FSEventStreamContext FSEventStreamContext;
39 typedef uint32_t FSEventStreamCreateFlags;
40 typedef uint64_t FSEventStreamEventId;
41 typedef unsigned CFStringEncoding;
42 typedef void* CFAllocatorRef;
43 typedef void* CFArrayRef;
44 typedef void* CFBundleRef;
45 typedef void* CFDictionaryRef;
46 typedef void* CFRunLoopRef;
47 typedef void* CFRunLoopSourceRef;
48 typedef void* CFStringRef;
49 typedef void* CFTypeRef;
50 typedef void* FSEventStreamRef;
51 
52 typedef void (*FSEventStreamCallback)(const FSEventStreamRef,
53                                       void*,
54                                       size_t,
55                                       void*,
56                                       const FSEventStreamEventFlags*,
57                                       const FSEventStreamEventId*);
58 
59 struct CFRunLoopSourceContext {
60   CFIndex version;
61   void* info;
62   void* pad[7];
63   void (*perform)(void*);
64 };
65 
66 struct FSEventStreamContext {
67   CFIndex version;
68   void* info;
69   void* pad[3];
70 };
71 
72 static const CFStringEncoding kCFStringEncodingUTF8 = 0x8000100;
73 static const OSStatus noErr = 0;
74 
75 static const FSEventStreamEventId kFSEventStreamEventIdSinceNow = -1;
76 
77 static const int kFSEventStreamCreateFlagNoDefer = 2;
78 static const int kFSEventStreamCreateFlagFileEvents = 16;
79 
80 static const int kFSEventStreamEventFlagEventIdsWrapped = 8;
81 static const int kFSEventStreamEventFlagHistoryDone = 16;
82 static const int kFSEventStreamEventFlagItemChangeOwner = 0x4000;
83 static const int kFSEventStreamEventFlagItemCreated = 0x100;
84 static const int kFSEventStreamEventFlagItemFinderInfoMod = 0x2000;
85 static const int kFSEventStreamEventFlagItemInodeMetaMod = 0x400;
86 static const int kFSEventStreamEventFlagItemIsDir = 0x20000;
87 static const int kFSEventStreamEventFlagItemModified = 0x1000;
88 static const int kFSEventStreamEventFlagItemRemoved = 0x200;
89 static const int kFSEventStreamEventFlagItemRenamed = 0x800;
90 static const int kFSEventStreamEventFlagItemXattrMod = 0x8000;
91 static const int kFSEventStreamEventFlagKernelDropped = 4;
92 static const int kFSEventStreamEventFlagMount = 64;
93 static const int kFSEventStreamEventFlagRootChanged = 32;
94 static const int kFSEventStreamEventFlagUnmount = 128;
95 static const int kFSEventStreamEventFlagUserDropped = 2;
96 
97 #endif  /* UV_DARWIN_STUB_H_ */
98