]> git.saurik.com Git - apple/libdispatch.git/blob - private/source_private.h
libdispatch-187.9.tar.gz
[apple/libdispatch.git] / private / source_private.h
1 /*
2 * Copyright (c) 2008-2011 Apple Inc. All rights reserved.
3 *
4 * @APPLE_APACHE_LICENSE_HEADER_START@
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * @APPLE_APACHE_LICENSE_HEADER_END@
19 */
20
21 /*
22 * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch
23 * which are subject to change in future releases of Mac OS X. Any applications
24 * relying on these interfaces WILL break.
25 */
26
27 #ifndef __DISPATCH_SOURCE_PRIVATE__
28 #define __DISPATCH_SOURCE_PRIVATE__
29
30 #ifndef __DISPATCH_INDIRECT__
31 #error "Please #include <dispatch/dispatch.h> instead of this file directly."
32 #include <dispatch/base.h> // for HeaderDoc
33 #endif
34
35 /*!
36 * @const DISPATCH_SOURCE_TYPE_VFS
37 * @discussion Apple-internal dispatch source that monitors for vfs events
38 * defined by dispatch_vfs_flags_t.
39 * The handle is a process identifier (pid_t).
40 */
41 #define DISPATCH_SOURCE_TYPE_VFS (&_dispatch_source_type_vfs)
42 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
43 DISPATCH_EXPORT const struct dispatch_source_type_s _dispatch_source_type_vfs;
44
45 /*!
46 * @const DISPATCH_SOURCE_TYPE_VM
47 * @discussion A dispatch source that monitors virtual memory
48 * The mask is a mask of desired events from dispatch_source_vm_flags_t.
49 */
50 #define DISPATCH_SOURCE_TYPE_VM (&_dispatch_source_type_vm)
51 __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_4_3)
52 DISPATCH_EXPORT const struct dispatch_source_type_s _dispatch_source_type_vm;
53
54 /*!
55 * @enum dispatch_source_vfs_flags_t
56 *
57 * @constant DISPATCH_VFS_NOTRESP
58 * Server down.
59 *
60 * @constant DISPATCH_VFS_NEEDAUTH
61 * Server bad auth.
62 *
63 * @constant DISPATCH_VFS_LOWDISK
64 * We're low on space.
65 *
66 * @constant DISPATCH_VFS_MOUNT
67 * New filesystem arrived.
68 *
69 * @constant DISPATCH_VFS_UNMOUNT
70 * Filesystem has left.
71 *
72 * @constant DISPATCH_VFS_DEAD
73 * Filesystem is dead, needs force unmount.
74 *
75 * @constant DISPATCH_VFS_ASSIST
76 * Filesystem needs assistance from external program.
77 *
78 * @constant DISPATCH_VFS_NOTRESPLOCK
79 * Server lockd down.
80 *
81 * @constant DISPATCH_VFS_UPDATE
82 * Filesystem information has changed.
83 *
84 * @constant DISPATCH_VFS_VERYLOWDISK
85 * File system has *very* little disk space left.
86 */
87 enum {
88 DISPATCH_VFS_NOTRESP = 0x0001,
89 DISPATCH_VFS_NEEDAUTH = 0x0002,
90 DISPATCH_VFS_LOWDISK = 0x0004,
91 DISPATCH_VFS_MOUNT = 0x0008,
92 DISPATCH_VFS_UNMOUNT = 0x0010,
93 DISPATCH_VFS_DEAD = 0x0020,
94 DISPATCH_VFS_ASSIST = 0x0040,
95 DISPATCH_VFS_NOTRESPLOCK = 0x0080,
96 DISPATCH_VFS_UPDATE = 0x0100,
97 DISPATCH_VFS_VERYLOWDISK = 0x0200,
98 };
99
100 /*!
101 * @enum dispatch_source_mach_send_flags_t
102 *
103 * @constant DISPATCH_MACH_SEND_POSSIBLE
104 * The mach port corresponding to the given send right has space available
105 * for messages. Delivered only once a mach_msg() to that send right with
106 * options MACH_SEND_MSG|MACH_SEND_TIMEOUT|MACH_SEND_NOTIFY has returned
107 * MACH_SEND_TIMED_OUT (and not again until the next such mach_msg() timeout).
108 * NOTE: The source must have registered the send right for monitoring with the
109 * system for such a mach_msg() to arm the send-possible notifcation, so
110 * the initial send attempt must occur from a source registration handler.
111 */
112 enum {
113 DISPATCH_MACH_SEND_POSSIBLE = 0x8,
114 };
115
116 /*!
117 * @enum dispatch_source_proc_flags_t
118 *
119 * @constant DISPATCH_PROC_REAP
120 * The process has been reaped by the parent process via
121 * wait*().
122 */
123 enum {
124 DISPATCH_PROC_REAP = 0x10000000,
125 };
126
127 /*!
128 * @enum dispatch_source_vm_flags_t
129 *
130 * @constant DISPATCH_VM_PRESSURE
131 * The VM has experienced memory pressure.
132 */
133
134 enum {
135 DISPATCH_VM_PRESSURE = 0x80000000,
136 };
137
138 #if TARGET_IPHONE_SIMULATOR // rdar://problem/9219483
139 #define DISPATCH_VM_PRESSURE DISPATCH_VNODE_ATTRIB
140 #endif
141
142 __BEGIN_DECLS
143
144 #if TARGET_OS_MAC
145 /*!
146 * @typedef dispatch_mig_callback_t
147 *
148 * @abstract
149 * The signature of a function that handles Mach message delivery and response.
150 */
151 typedef boolean_t (*dispatch_mig_callback_t)(mach_msg_header_t *message,
152 mach_msg_header_t *reply);
153
154 __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0)
155 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
156 mach_msg_return_t
157 dispatch_mig_server(dispatch_source_t ds, size_t maxmsgsz,
158 dispatch_mig_callback_t callback);
159 #endif
160
161 __END_DECLS
162
163 #endif