2 * Copyright (c) 2008-2011 Apple Inc. All rights reserved.
4 * @APPLE_APACHE_LICENSE_HEADER_START@
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @APPLE_APACHE_LICENSE_HEADER_END@
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.
27 #ifndef __DISPATCH_SOURCE_PRIVATE__
28 #define __DISPATCH_SOURCE_PRIVATE__
30 #ifndef __DISPATCH_INDIRECT__
31 #error "Please #include <dispatch/dispatch.h> instead of this file directly."
32 #include <dispatch/base.h> // for HeaderDoc
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).
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
;
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.
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
;
55 * @enum dispatch_source_vfs_flags_t
57 * @constant DISPATCH_VFS_NOTRESP
60 * @constant DISPATCH_VFS_NEEDAUTH
63 * @constant DISPATCH_VFS_LOWDISK
66 * @constant DISPATCH_VFS_MOUNT
67 * New filesystem arrived.
69 * @constant DISPATCH_VFS_UNMOUNT
70 * Filesystem has left.
72 * @constant DISPATCH_VFS_DEAD
73 * Filesystem is dead, needs force unmount.
75 * @constant DISPATCH_VFS_ASSIST
76 * Filesystem needs assistance from external program.
78 * @constant DISPATCH_VFS_NOTRESPLOCK
81 * @constant DISPATCH_VFS_UPDATE
82 * Filesystem information has changed.
84 * @constant DISPATCH_VFS_VERYLOWDISK
85 * File system has *very* little disk space left.
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,
101 * @enum dispatch_source_mach_send_flags_t
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.
113 DISPATCH_MACH_SEND_POSSIBLE
= 0x8,
117 * @enum dispatch_source_proc_flags_t
119 * @constant DISPATCH_PROC_REAP
120 * The process has been reaped by the parent process via
124 DISPATCH_PROC_REAP
= 0x10000000,
128 * @enum dispatch_source_vm_flags_t
130 * @constant DISPATCH_VM_PRESSURE
131 * The VM has experienced memory pressure.
135 DISPATCH_VM_PRESSURE
= 0x80000000,
138 #if TARGET_IPHONE_SIMULATOR // rdar://problem/9219483
139 #define DISPATCH_VM_PRESSURE DISPATCH_VNODE_ATTRIB
146 * @typedef dispatch_mig_callback_t
149 * The signature of a function that handles Mach message delivery and response.
151 typedef boolean_t (*dispatch_mig_callback_t
)(mach_msg_header_t
*message
,
152 mach_msg_header_t
*reply
);
154 __OSX_AVAILABLE_STARTING(__MAC_10_6
,__IPHONE_4_0
)
155 DISPATCH_EXPORT DISPATCH_NONNULL_ALL DISPATCH_NOTHROW
157 dispatch_mig_server(dispatch_source_t ds
, size_t maxmsgsz
,
158 dispatch_mig_callback_t callback
);