]> git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/port.h
xnu-7195.101.1.tar.gz
[apple/xnu.git] / osfmk / mach / port.h
1 /*
2 * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28 /*
29 * @OSF_COPYRIGHT@
30 */
31 /*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56 /*
57 * NOTICE: This file was modified by McAfee Research in 2004 to introduce
58 * support for mandatory and extensible security protections. This notice
59 * is included in support of clause 2.2 (b) of the Apple Public License,
60 * Version 2.0.
61 */
62 /*
63 */
64 /*
65 * File: mach/port.h
66 *
67 * Definition of a Mach port
68 *
69 * Mach ports are the endpoints to Mach-implemented communications
70 * channels (usually uni-directional message queues, but other types
71 * also exist).
72 *
73 * Unique collections of these endpoints are maintained for each
74 * Mach task. Each Mach port in the task's collection is given a
75 * [task-local] name to identify it - and the the various "rights"
76 * held by the task for that specific endpoint.
77 *
78 * This header defines the types used to identify these Mach ports
79 * and the various rights associated with them. For more info see:
80 *
81 * <mach/mach_port.h> - manipulation of port rights in a given space
82 * <mach/message.h> - message queue [and port right passing] mechanism
83 *
84 */
85
86 #ifndef _MACH_PORT_H_
87 #define _MACH_PORT_H_
88
89 #include <sys/cdefs.h>
90 #include <stdint.h>
91 #include <mach/boolean.h>
92 #include <mach/machine/vm_types.h>
93
94 /*
95 * mach_port_name_t - the local identity for a Mach port
96 *
97 * The name is Mach port namespace specific. It is used to
98 * identify the rights held for that port by the task whose
99 * namespace is implied [or specifically provided].
100 *
101 * Use of this type usually implies just a name - no rights.
102 * See mach_port_t for a type that implies a "named right."
103 *
104 */
105
106 typedef natural_t mach_port_name_t;
107 typedef mach_port_name_t *mach_port_name_array_t;
108
109 #ifdef KERNEL
110
111 /*
112 * mach_port_t - a named port right
113 *
114 * In the kernel, "rights" are represented [named] by pointers to
115 * the ipc port object in question. There is no port namespace for the
116 * rights to be collected.
117 *
118 * Actually, there is namespace for the kernel task. But most kernel
119 * code - including, but not limited to, Mach IPC code - lives in the
120 * limbo between the current user-level task and the "next" task. Very
121 * little of the kernel code runs in full kernel task context. So very
122 * little of it gets to use the kernel task's port name space.
123 *
124 * Because of this implementation approach, all in-kernel rights for
125 * a given port coalesce [have the same name/pointer]. The actual
126 * references are counted in the port itself. It is up to the kernel
127 * code in question to "just remember" how many [and what type of]
128 * rights it holds and handle them appropriately.
129 *
130 */
131
132 #ifndef MACH_KERNEL_PRIVATE
133 /*
134 * For kernel code that resides outside of Mach proper, we opaque the
135 * port structure definition.
136 */
137 struct ipc_port;
138
139 #endif /* MACH_KERNEL_PRIVATE */
140
141 typedef struct ipc_port *ipc_port_t;
142
143 #define IPC_PORT_NULL ((ipc_port_t) NULL)
144 #define IPC_PORT_DEAD ((ipc_port_t)~0UL)
145 #define IPC_PORT_VALID(port) ipc_port_valid(port)
146
147 static inline boolean_t
148 ipc_port_valid(ipc_port_t port)
149 {
150 return port != IPC_PORT_DEAD && port;
151 }
152
153 typedef ipc_port_t mach_port_t;
154
155 /*
156 * Since the 32-bit and 64-bit representations of ~0 are different,
157 * explicitly handle MACH_PORT_DEAD
158 */
159
160 #define CAST_MACH_PORT_TO_NAME(x) ((mach_port_name_t)(uintptr_t)(x))
161 #define CAST_MACH_NAME_TO_PORT(x) ((x) == MACH_PORT_DEAD ? (mach_port_t)IPC_PORT_DEAD : (mach_port_t)(uintptr_t)(x))
162
163 #else /* KERNEL */
164
165 /*
166 * mach_port_t - a named port right
167 *
168 * In user-space, "rights" are represented by the name of the
169 * right in the Mach port namespace. Even so, this type is
170 * presented as a unique one to more clearly denote the presence
171 * of a right coming along with the name.
172 *
173 * Often, various rights for a port held in a single name space
174 * will coalesce and are, therefore, be identified by a single name
175 * [this is the case for send and receive rights]. But not
176 * always [send-once rights currently get a unique name for
177 * each right].
178 *
179 */
180
181 #include <sys/_types.h>
182 #include <sys/_types/_mach_port_t.h>
183
184 #endif /* KERNEL */
185
186 typedef mach_port_t *mach_port_array_t;
187
188 /*
189 * MACH_PORT_NULL is a legal value that can be carried in messages.
190 * It indicates the absence of any port or port rights. (A port
191 * argument keeps the message from being "simple", even if the
192 * value is MACH_PORT_NULL.) The value MACH_PORT_DEAD is also a legal
193 * value that can be carried in messages. It indicates
194 * that a port right was present, but it died.
195 */
196
197 #if defined(XNU_KERNEL_PRIVATE) && defined(__cplusplus)
198 #define MACH_PORT_NULL NULL
199 #else
200 #define MACH_PORT_NULL 0 /* intentional loose typing */
201 #endif
202 #define MACH_PORT_DEAD ((mach_port_name_t) ~0)
203 #define MACH_PORT_VALID(name) \
204 (((name) != MACH_PORT_NULL) && \
205 ((name) != MACH_PORT_DEAD))
206
207
208 /*
209 * For kernel-selected [assigned] port names, the name is
210 * comprised of two parts: a generation number and an index.
211 * This approach keeps the exact same name from being generated
212 * and reused too quickly [to catch right/reference counting bugs].
213 * The dividing line between the constituent parts is exposed so
214 * that efficient "mach_port_name_t to data structure pointer"
215 * conversion implementation can be made. But it is possible
216 * for user-level code to assign their own names to Mach ports.
217 * These are not required to participate in this algorithm. So
218 * care should be taken before "assuming" this model.
219 *
220 */
221
222 #ifndef NO_PORT_GEN
223
224 #define MACH_PORT_INDEX(name) ((name) >> 8)
225 #define MACH_PORT_GEN(name) (((name) & 0xff) << 24)
226 #define MACH_PORT_MAKE(index, gen) \
227 (((index) << 8) | (gen) >> 24)
228
229 #else /* NO_PORT_GEN */
230
231 #define MACH_PORT_INDEX(name) (name)
232 #define MACH_PORT_GEN(name) (0)
233 #define MACH_PORT_MAKE(index, gen) (index)
234
235 #endif /* NO_PORT_GEN */
236
237
238 /*
239 * These are the different rights a task may have for a port.
240 * The MACH_PORT_RIGHT_* definitions are used as arguments
241 * to mach_port_allocate, mach_port_get_refs, etc, to specify
242 * a particular right to act upon. The mach_port_names and
243 * mach_port_type calls return bitmasks using the MACH_PORT_TYPE_*
244 * definitions. This is because a single name may denote
245 * multiple rights.
246 */
247
248 typedef natural_t mach_port_right_t;
249
250 #define MACH_PORT_RIGHT_SEND ((mach_port_right_t) 0)
251 #define MACH_PORT_RIGHT_RECEIVE ((mach_port_right_t) 1)
252 #define MACH_PORT_RIGHT_SEND_ONCE ((mach_port_right_t) 2)
253 #define MACH_PORT_RIGHT_PORT_SET ((mach_port_right_t) 3)
254 #define MACH_PORT_RIGHT_DEAD_NAME ((mach_port_right_t) 4)
255 #define MACH_PORT_RIGHT_LABELH ((mach_port_right_t) 5) /* obsolete right */
256 #define MACH_PORT_RIGHT_NUMBER ((mach_port_right_t) 6) /* right not implemented */
257
258 #ifdef MACH_KERNEL_PRIVATE
259 #define MACH_PORT_RIGHT_VALID_TRANSLATE(right) \
260 ((right) >= MACH_PORT_RIGHT_SEND && (right) <= MACH_PORT_RIGHT_DEAD_NAME)
261 #endif
262
263 typedef natural_t mach_port_type_t;
264 typedef mach_port_type_t *mach_port_type_array_t;
265
266 #define MACH_PORT_TYPE(right) \
267 ((mach_port_type_t)(((mach_port_type_t) 1) \
268 << ((right) + ((mach_port_right_t) 16))))
269 #define MACH_PORT_TYPE_NONE ((mach_port_type_t) 0L)
270 #define MACH_PORT_TYPE_SEND MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND)
271 #define MACH_PORT_TYPE_RECEIVE MACH_PORT_TYPE(MACH_PORT_RIGHT_RECEIVE)
272 #define MACH_PORT_TYPE_SEND_ONCE MACH_PORT_TYPE(MACH_PORT_RIGHT_SEND_ONCE)
273 #define MACH_PORT_TYPE_PORT_SET MACH_PORT_TYPE(MACH_PORT_RIGHT_PORT_SET)
274 #define MACH_PORT_TYPE_DEAD_NAME MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME)
275 #define MACH_PORT_TYPE_LABELH MACH_PORT_TYPE(MACH_PORT_RIGHT_LABELH) /* obsolete */
276
277 #ifdef MACH_KERNEL_PRIVATE
278 /* Holder used to have a receive right - remembered to filter exceptions */
279 #define MACH_PORT_TYPE_EX_RECEIVE MACH_PORT_TYPE_LABELH
280 #endif
281
282 /* Convenient combinations. */
283
284 #define MACH_PORT_TYPE_SEND_RECEIVE \
285 (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_RECEIVE)
286 #define MACH_PORT_TYPE_SEND_RIGHTS \
287 (MACH_PORT_TYPE_SEND|MACH_PORT_TYPE_SEND_ONCE)
288 #define MACH_PORT_TYPE_PORT_RIGHTS \
289 (MACH_PORT_TYPE_SEND_RIGHTS|MACH_PORT_TYPE_RECEIVE)
290 #define MACH_PORT_TYPE_PORT_OR_DEAD \
291 (MACH_PORT_TYPE_PORT_RIGHTS|MACH_PORT_TYPE_DEAD_NAME)
292 #define MACH_PORT_TYPE_ALL_RIGHTS \
293 (MACH_PORT_TYPE_PORT_OR_DEAD|MACH_PORT_TYPE_PORT_SET)
294
295 /* Dummy type bits that mach_port_type/mach_port_names can return. */
296
297 #define MACH_PORT_TYPE_DNREQUEST 0x80000000
298 #define MACH_PORT_TYPE_SPREQUEST 0x40000000
299 #define MACH_PORT_TYPE_SPREQUEST_DELAYED 0x20000000
300
301 /* User-references for capabilities. */
302
303 typedef natural_t mach_port_urefs_t;
304 typedef integer_t mach_port_delta_t; /* change in urefs */
305
306 /* Attributes of ports. (See mach_port_get_receive_status.) */
307
308 typedef natural_t mach_port_seqno_t; /* sequence number */
309 typedef natural_t mach_port_mscount_t; /* make-send count */
310 typedef natural_t mach_port_msgcount_t; /* number of msgs */
311 typedef natural_t mach_port_rights_t; /* number of rights */
312
313 /*
314 * Are there outstanding send rights for a given port?
315 */
316 #define MACH_PORT_SRIGHTS_NONE 0 /* no srights */
317 #define MACH_PORT_SRIGHTS_PRESENT 1 /* srights */
318 typedef unsigned int mach_port_srights_t; /* status of send rights */
319
320 typedef struct mach_port_status {
321 mach_port_rights_t mps_pset; /* count of containing port sets */
322 mach_port_seqno_t mps_seqno; /* sequence number */
323 mach_port_mscount_t mps_mscount; /* make-send count */
324 mach_port_msgcount_t mps_qlimit; /* queue limit */
325 mach_port_msgcount_t mps_msgcount; /* number in the queue */
326 mach_port_rights_t mps_sorights; /* how many send-once rights */
327 boolean_t mps_srights; /* do send rights exist? */
328 boolean_t mps_pdrequest; /* port-deleted requested? */
329 boolean_t mps_nsrequest; /* no-senders requested? */
330 natural_t mps_flags; /* port flags */
331 } mach_port_status_t;
332
333 /* System-wide values for setting queue limits on a port */
334 #define MACH_PORT_QLIMIT_ZERO (0)
335 #define MACH_PORT_QLIMIT_BASIC (5)
336 #define MACH_PORT_QLIMIT_SMALL (16)
337 #define MACH_PORT_QLIMIT_LARGE (1024)
338 #define MACH_PORT_QLIMIT_KERNEL (65534)
339 #define MACH_PORT_QLIMIT_MIN MACH_PORT_QLIMIT_ZERO
340 #define MACH_PORT_QLIMIT_DEFAULT MACH_PORT_QLIMIT_BASIC
341 #define MACH_PORT_QLIMIT_MAX MACH_PORT_QLIMIT_LARGE
342
343 typedef struct mach_port_limits {
344 mach_port_msgcount_t mpl_qlimit; /* number of msgs */
345 } mach_port_limits_t;
346
347 /* Possible values for mps_flags (part of mach_port_status_t) */
348 #define MACH_PORT_STATUS_FLAG_TEMPOWNER 0x01
349 #define MACH_PORT_STATUS_FLAG_GUARDED 0x02
350 #define MACH_PORT_STATUS_FLAG_STRICT_GUARD 0x04
351 #define MACH_PORT_STATUS_FLAG_IMP_DONATION 0x08
352 #define MACH_PORT_STATUS_FLAG_REVIVE 0x10
353 #define MACH_PORT_STATUS_FLAG_TASKPTR 0x20
354 #define MACH_PORT_STATUS_FLAG_GUARD_IMMOVABLE_RECEIVE 0x40
355 #define MACH_PORT_STATUS_FLAG_NO_GRANT 0x80
356
357 typedef struct mach_port_info_ext {
358 mach_port_status_t mpie_status;
359 mach_port_msgcount_t mpie_boost_cnt;
360 uint32_t reserved[6];
361 } mach_port_info_ext_t;
362
363 typedef integer_t *mach_port_info_t; /* varying array of natural_t */
364
365 /* Flavors for mach_port_get/set_attributes() */
366 typedef int mach_port_flavor_t;
367 #define MACH_PORT_LIMITS_INFO 1 /* uses mach_port_limits_t */
368 #define MACH_PORT_RECEIVE_STATUS 2 /* uses mach_port_status_t */
369 #define MACH_PORT_DNREQUESTS_SIZE 3 /* info is int */
370 #define MACH_PORT_TEMPOWNER 4 /* indicates receive right will be reassigned to another task */
371 #define MACH_PORT_IMPORTANCE_RECEIVER 5 /* indicates recieve right accepts priority donation */
372 #define MACH_PORT_DENAP_RECEIVER 6 /* indicates receive right accepts de-nap donation */
373 #define MACH_PORT_INFO_EXT 7 /* uses mach_port_info_ext_t */
374
375 #define MACH_PORT_LIMITS_INFO_COUNT ((natural_t) \
376 (sizeof(mach_port_limits_t)/sizeof(natural_t)))
377 #define MACH_PORT_RECEIVE_STATUS_COUNT ((natural_t) \
378 (sizeof(mach_port_status_t)/sizeof(natural_t)))
379 #define MACH_PORT_DNREQUESTS_SIZE_COUNT 1
380 #define MACH_PORT_INFO_EXT_COUNT ((natural_t) \
381 (sizeof(mach_port_info_ext_t)/sizeof(natural_t)))
382 /*
383 * Structure used to pass information about port allocation requests.
384 * Must be padded to 64-bits total length.
385 */
386 typedef struct mach_port_qos {
387 unsigned int name:1; /* name given */
388 unsigned int prealloc:1; /* prealloced message */
389 boolean_t pad1:30;
390 natural_t len;
391 } mach_port_qos_t;
392
393 /* Mach Port Guarding definitions */
394
395 /*
396 * Flags for mach_port_options (used for
397 * invocation of mach_port_construct).
398 * Indicates attributes to be set for the newly
399 * allocated port.
400 */
401 #define MPO_CONTEXT_AS_GUARD 0x01 /* Add guard to the port */
402 #define MPO_QLIMIT 0x02 /* Set qlimit for the port msg queue */
403 #define MPO_TEMPOWNER 0x04 /* Set the tempowner bit of the port */
404 #define MPO_IMPORTANCE_RECEIVER 0x08 /* Mark the port as importance receiver */
405 #define MPO_INSERT_SEND_RIGHT 0x10 /* Insert a send right for the port */
406 #define MPO_STRICT 0x20 /* Apply strict guarding for port */
407 #define MPO_DENAP_RECEIVER 0x40 /* Mark the port as App de-nap receiver */
408 #define MPO_IMMOVABLE_RECEIVE 0x80 /* Mark the port as immovable; protected by the guard context */
409 #define MPO_FILTER_MSG 0x100 /* Allow message filtering */
410 #define MPO_TG_BLOCK_TRACKING 0x200 /* Track blocking relationship for thread group during sync IPC */
411
412 /*
413 * Structure to define optional attributes for a newly
414 * constructed port.
415 */
416 typedef struct mach_port_options {
417 uint32_t flags; /* Flags defining attributes for port */
418 mach_port_limits_t mpl; /* Message queue limit for port */
419 union {
420 uint64_t reserved[2]; /* Reserved */
421 mach_port_name_t work_interval_port; /* Work interval port */
422 };
423 }mach_port_options_t;
424
425 typedef mach_port_options_t *mach_port_options_ptr_t;
426
427 /*
428 * EXC_GUARD represents a guard violation for both
429 * mach ports and file descriptors. GUARD_TYPE_ is used
430 * to differentiate among them.
431 */
432 #define GUARD_TYPE_MACH_PORT 0x1
433
434 /* Reasons for exception for a guarded mach port */
435 enum mach_port_guard_exception_codes {
436 kGUARD_EXC_DESTROY = 1u << 0,
437 kGUARD_EXC_MOD_REFS = 1u << 1,
438 kGUARD_EXC_SET_CONTEXT = 1u << 2,
439 kGUARD_EXC_UNGUARDED = 1u << 3,
440 kGUARD_EXC_INCORRECT_GUARD = 1u << 4,
441 kGUARD_EXC_IMMOVABLE = 1u << 5,
442 kGUARD_EXC_STRICT_REPLY = 1u << 6,
443 kGUARD_EXC_MSG_FILTERED = 1u << 7,
444 /* start of [optionally] non-fatal guards */
445 kGUARD_EXC_INVALID_RIGHT = 1u << 8,
446 kGUARD_EXC_INVALID_NAME = 1u << 9,
447 kGUARD_EXC_INVALID_VALUE = 1u << 10,
448 kGUARD_EXC_INVALID_ARGUMENT = 1u << 11,
449 kGUARD_EXC_RIGHT_EXISTS = 1u << 12,
450 kGUARD_EXC_KERN_NO_SPACE = 1u << 13,
451 kGUARD_EXC_KERN_FAILURE = 1u << 14,
452 kGUARD_EXC_KERN_RESOURCE = 1u << 15,
453 kGUARD_EXC_SEND_INVALID_REPLY = 1u << 16,
454 kGUARD_EXC_SEND_INVALID_VOUCHER = 1u << 17,
455 kGUARD_EXC_SEND_INVALID_RIGHT = 1u << 18,
456 kGUARD_EXC_RCV_INVALID_NAME = 1u << 19,
457 kGUARD_EXC_RCV_GUARDED_DESC = 1u << 20, /* should never be fatal; for development only */
458 kGUARD_EXC_MOD_REFS_NON_FATAL = 1u << 21,
459 kGUARD_EXC_IMMOVABLE_NON_FATAL = 1u << 22,
460 };
461
462 #define MAX_FATAL_kGUARD_EXC_CODE (1u << 7)
463
464 /*
465 * Mach port guard flags.
466 */
467 #define MPG_FLAGS_NONE (0x00ull)
468
469 /*
470 * These flags are used as bits in the subcode of kGUARD_EXC_STRICT_REPLY exceptions.
471 */
472 #define MPG_FLAGS_STRICT_REPLY_INVALID_REPLY_DISP (0x01ull << 56)
473 #define MPG_FLAGS_STRICT_REPLY_INVALID_REPLY_PORT (0x02ull << 56)
474 #define MPG_FLAGS_STRICT_REPLY_INVALID_VOUCHER (0x04ull << 56)
475 #define MPG_FLAGS_STRICT_REPLY_NO_BANK_ATTR (0x08ull << 56)
476 #define MPG_FLAGS_STRICT_REPLY_MISMATCHED_PERSONA (0x10ull << 56)
477 #define MPG_FLAGS_STRICT_REPLY_MASK (0xffull << 56)
478
479 /*
480 * These flags are used as bits in the subcode of kGUARD_EXC_MOD_REFS exceptions.
481 */
482 #define MPG_FLAGS_MOD_REFS_PINNED_DEALLOC (0x01ull << 56)
483
484 /*
485 * These flags are used as bits in the subcode of kGUARD_EXC_IMMOVABLE exceptions.
486 */
487 #define MPG_FLAGS_IMMOVABLE_PINNED (0x01ull << 56)
488
489 /*
490 * Flags for mach_port_guard_with_flags. These flags extend
491 * the attributes associated with a guarded port.
492 */
493 #define MPG_STRICT 0x01 /* Apply strict guarding for a port */
494 #define MPG_IMMOVABLE_RECEIVE 0x02 /* Receive right cannot be moved out of the space */
495
496 #if !__DARWIN_UNIX03 && !defined(_NO_PORT_T_FROM_MACH)
497 /*
498 * Mach 3.0 renamed everything to have mach_ in front of it.
499 * These types and macros are provided for backward compatibility
500 * but are deprecated.
501 */
502 typedef mach_port_t port_t;
503 typedef mach_port_name_t port_name_t;
504 typedef mach_port_name_t *port_name_array_t;
505
506 #define PORT_NULL ((port_t) 0)
507 #define PORT_DEAD ((port_t) ~0)
508 #define PORT_VALID(name) \
509 ((port_t)(name) != PORT_NULL && (port_t)(name) != PORT_DEAD)
510
511 #endif /* !__DARWIN_UNIX03 && !_NO_PORT_T_FROM_MACH */
512
513 #endif /* _MACH_PORT_H_ */