]> git.saurik.com Git - apple/xnu.git/blame - osfmk/mach/flipc_types.h
xnu-123.5.tar.gz
[apple/xnu.git] / osfmk / mach / flipc_types.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/*
23 * @OSF_COPYRIGHT@
24 *
25 */
26/*
27 * HISTORY
28 *
29 * Revision 1.1.1.1 1998/09/22 21:05:30 wsanchez
30 * Import of Mac OS X kernel (~semeria)
31 *
32 * Revision 1.1.1.1 1998/03/07 02:25:45 wsanchez
33 * Import of OSF Mach kernel (~mburg)
34 *
35 * Revision 1.1.7.1 1996/09/17 16:34:35 bruel
36 * fixed types.
37 * [96/09/17 bruel]
38 *
39 * Revision 1.1.5.1 1995/06/13 18:20:20 sjs
40 * Merged from flipc_shared.
41 * [95/06/07 sjs]
42 *
43 * Revision 1.1.3.11 1995/05/23 19:55:36 randys
44 * Don't keep track of messages sent to a bad destination--that's
45 * purely a transport function now.
46 * [95/05/23 randys]
47 *
48 * Revision 1.1.3.10 1995/05/23 15:40:20 randys
49 * Added field to FLIPC_domain_errors to indicate validity of other
50 * fields.
51 * [95/05/22 randys]
52 *
53 * Revision 1.1.3.9 1995/05/16 20:46:35 randys
54 * Added a "performance_valid" field to the flipc performance
55 * structure.
56 * [95/05/16 randys]
57 *
58 * Revision 1.1.3.8 1995/04/05 21:22:01 randys
59 * Added field to domain_info struct to include allocations lock
60 * sched policy.
61 * [95/04/05 randys]
62 *
63 * Revision 1.1.3.7 1995/03/09 19:42:33 rwd
64 * Define SEMAPHORE_NULL (for now) and include mach_types.h instead
65 * of sema_types.h.
66 * [95/03/08 rwd]
67 *
68 * Revision 1.1.3.6 1995/02/23 21:32:52 randys
69 * Removed placeholder definition for locks--I don't believe that I
70 * use locks unless I'm on top of a real time base, in which case
71 * that base will define the type.
72 * [95/02/22 randys]
73 *
74 * Revision 1.1.3.5 1995/02/21 17:23:13 randys
75 * Re-indented code to four space indentation
76 * [1995/02/21 16:25:36 randys]
77 *
78 * Revision 1.1.3.4 1995/02/16 23:20:14 randys
79 * ANSIfy FLIPC_thread_yield_function.
80 * [95/02/14 randys]
81 *
82 * Add FLIPC_thread_yield_function type.
83 * [95/02/14 randys]
84 *
85 * Revision 1.1.3.3 1995/01/26 21:01:51 randys
86 * Added performance structure.
87 * [1995/01/24 21:14:12 randys]
88 *
89 * Added FLIPC_epgroup_info struct
90 * [1995/01/24 18:30:02 randys]
91 *
92 * Create a new structure (FLIPC_endpoint_info) to return
93 * information about an endpoint.
94 * [1995/01/20 19:26:35 randys]
95 *
96 * Get rid of FLIPC_DESTINATION_NULL and add in
97 * FLIPC_ADDRESS_ERROR (return code from FLIPC_buffer_destination)
98 * [1995/01/19 20:23:24 randys]
99 *
100 * Added domain index type for specifying domain in
101 * init and attach calls
102 * [1995/01/18 16:47:25 randys]
103 *
104 * Revision 1.1.3.2 1994/12/20 19:02:09 randys
105 * Added error reporting structure type, and added
106 * room in the standard domain query for error log size.
107 * [1994/12/19 23:46:09 randys]
108 *
109 * Added filename in comment at top of each file
110 * [1994/12/19 20:28:26 randys]
111 *
112 * Support and doc for minor user interface changes for error conditions
113 * [1994/12/18 23:24:30 randys]
114 *
115 * Yank the semaphore type definitions back out, and include the file
116 * that defines those types.
117 * [1994/12/13 17:50:03 randys]
118 *
119 * Revision 1.1.3.1 1994/12/12 17:46:20 randys
120 * Put definitions of semaphore_t and SEMAPHORE_NULL back in; they aren't
121 * defined in user space yet.
122 * [1994/12/12 17:21:56 randys]
123 *
124 * Revision 1.1.1.2 1994/12/11 23:11:23 randys
125 * Initial flipc code checkin
126 *
127 * $EndLog$
128 */
129
130/*
131 * mach/flipc_types.h
132 *
133 * Definitions of those flipc types that need to be visible to both the AIL
134 * and kernel sides of flipc (which is just about everything).
135 */
136
137#ifndef _MACH_FLIPC_TYPES_H_
138#define _MACH_FLIPC_TYPES_H_
139
140#include <mach/port.h>
141
142/*
143 * Define a couple of generally useful types.
144 */
145#include <mach/mach_types.h>
146
147#ifndef MACH_KERNEL
148#define SEMAPHORE_NULL (semaphore_port_t)0
149#endif /* !defined(MACH_KERNEL) */
150
151/*
152 * Basic flipc types; visible to both user and kernel segments of the
153 * flipc implementation.
154 */
155/* Flipc addresses. These name a node-endpoint combination for
156 sending. */
157typedef unsigned int FLIPC_address_t;
158#define FLIPC_ADDRESS_ERROR ((FLIPC_address_t) -1)
159
160/* Flipc endpoints. */
161typedef void *FLIPC_endpoint_t;
162#define FLIPC_ENDPOINT_NULL ((FLIPC_endpoint_t) 0)
163
164/* Buffer pointers (returned by query functions). Users are allowed to
165 copy directly to/from this pointer; it points at their data. */
166typedef void *FLIPC_buffer_t;
167#define FLIPC_BUFFER_NULL ((FLIPC_buffer_t) 0)
168
169/* Endpoint group identifiers. */
170typedef void *FLIPC_epgroup_t;
171#define FLIPC_EPGROUP_NULL ((FLIPC_epgroup_t) 0)
172#define FLIPC_EPGROUP_ERROR ((FLIPC_epgroup_t) -1)
173
174/* Domain index; argument to initialization and attach routines. */
175typedef unsigned int FLIPC_domain_index_t;
176
177/* Domain handle (mach port). */
178typedef mach_port_t FLIPC_domain_t;
179
180/* The different types an endpoint can be. FLIPC_Inactive is used when
181 the endpoint has not been configured and hence is on the freelist. */
182typedef enum {
183 FLIPC_Inactive = -1,
184 FLIPC_Send,
185 FLIPC_Receive
186} FLIPC_endpoint_type_t;
187
188/* Structure for returning performance information about the flipc
189 domain; a placeholder for future entries as needed.
190 This information will only be valid if the kernel is configured to
191 keep flipc performance information. */
192typedef struct FLIPC_domain_performance_info {
193 unsigned long performance_valid; /* Non zero if the other information
194 in this structure is valid. */
195 unsigned long messages_sent; /* Since last init. */
196 unsigned long messages_received; /* Since last init. Includes overruns
197 (because they are marked in the
198 endpoint data structure). Doesn't
199 include other drops (they are
200 marked in other places) */
201} *FLIPC_domain_performance_info_t;
202
203/* Flipc yield function. */
204typedef void (*FLIPC_thread_yield_function)(void);
205
206/* Structure for returning information about the flipc domain. */
207typedef struct FLIPC_domain_info {
208 int max_endpoints;
209 int max_epgroups;
210 int max_buffers;
211 int max_buffers_per_endpoint;
212 int msg_buffer_size;
213 FLIPC_thread_yield_function yield_fn;
214 int policy; /* Allocations lock sched policy.
215 Unused if REAL_TIME_PRIMITIVES are
216 not being used. */
217 struct FLIPC_domain_performance_info performance;
218 int error_log_size; /* In bytes. */
219} *FLIPC_domain_info_t;
220
221/* Structure for returning information about the error state of
222 the flipc domain. Note that this is variable sized; the size
223 of the transport specific information is not known at compile
224 time. */
225typedef struct FLIPC_domain_errors {
226 int error_full_config_p; /* 1 if disabled and badtype below are
227 valid; 0 if only msgdrop_inactive
228 is valid. */
229 int msgdrop_inactive; /* Messages dropped because
230 of the domain being locally
231 inactive. */
232 int msgdrop_disabled; /* Messages dropped because of a
233 disabled endpoint. */
234 int msgdrop_badtype; /* Messages dropped because they
235 were sent to a send endpoint. */
236
237 int transport_error_size; /* Size of the following array of
238 ints, in bytes. */
239 int transport_error_info[1]; /* Really of transport_error_size. */
240} *FLIPC_domain_errors_t;
241
242/* Structure for returning information about endpoints. */
243typedef struct FLIPC_endpoint_info {
244 FLIPC_endpoint_type_t type;
245 unsigned int processed_buffers_dropped_p;
246 unsigned long number_buffers;
247 FLIPC_epgroup_t epgroup;
248} *FLIPC_endpoint_info_t;
249
250typedef struct FLIPC_epgroup_info {
251 unsigned long msgs_per_wakeup;
252} *FLIPC_epgroup_info_t;
253
254#endif /* _MACH_FLIPC_TYPES_H_ */