]> git.saurik.com Git - apple/libdispatch.git/blob - src/firehose/firehose_server_internal.h
libdispatch-703.50.37.tar.gz
[apple/libdispatch.git] / src / firehose / firehose_server_internal.h
1 /*
2 * Copyright (c) 2015 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 #ifndef __FIREHOSE_SERVER_INTERNAL__
22 #define __FIREHOSE_SERVER_INTERNAL__
23
24 OS_OBJECT_CLASS_DECL(firehose_client, object);
25 #define FIREHOSE_CLIENT_CLASS OS_OBJECT_VTABLE(firehose_client)
26
27 typedef struct firehose_snapshot_s *firehose_snapshot_t;
28 struct firehose_snapshot_s {
29 firehose_snapshot_handler_t handler;
30 dispatch_group_t fs_group;
31 };
32
33 struct firehose_client_s {
34 union {
35 _OS_OBJECT_HEADER(void *os_obj_isa, os_obj_ref_cnt, os_obj_xref_cnt);
36 struct _os_object_s fc_as_os_object;
37 };
38 TAILQ_ENTRY(firehose_client_s) fc_entry;
39
40 firehose_buffer_t fc_buffer;
41 uint64_t volatile fc_mem_sent_flushed_pos;
42 uint64_t volatile fc_mem_flushed_pos;
43 uint64_t volatile fc_io_sent_flushed_pos;
44 uint64_t volatile fc_io_flushed_pos;
45
46 void *volatile fc_ctxt;
47
48 union {
49 dispatch_mach_t fc_mach_channel;
50 dispatch_source_t fc_kernel_source;
51 };
52 dispatch_source_t fc_io_source;
53 dispatch_source_t fc_mem_source;
54 mach_port_t fc_recvp;
55 mach_port_t fc_sendp;
56 os_unfair_lock fc_lock;
57 pid_t fc_pid;
58 int fc_pidversion;
59 uid_t fc_euid;
60 bool fc_use_notifs;
61 bool fc_memory_corrupted;
62 bool fc_needs_io_snapshot;
63 bool fc_needs_mem_snapshot;
64 };
65
66 void
67 _firehose_client_xref_dispose(struct firehose_client_s *fc);
68 void
69 _firehose_client_dispose(struct firehose_client_s *fc);
70
71 extern unsigned char __libfirehose_serverVersionString[];
72 extern double __libfirehose_serverVersionNumber;
73
74 #endif // __FIREHOSE_SERVER_INTERNAL__