|
|
1.1 root 1: /*
2: * Mach Operating System
3: * Copyright (c) 1991,1990,1989 Carnegie Mellon University.
4: * Copyright (c) 1993,1994 The University of Utah and
5: * the Computer Systems Laboratory (CSL).
6: * All rights reserved.
7: *
8: * Permission to use, copy, modify and distribute this software and its
9: * documentation is hereby granted, provided that both the copyright
10: * notice and this permission notice appear in all copies of the
11: * software, derivative works or modified versions, and any portions
12: * thereof, and that both notices appear in supporting documentation.
13: *
14: * CARNEGIE MELLON, THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF
15: * THIS SOFTWARE IN ITS "AS IS" CONDITION, AND DISCLAIM ANY LIABILITY
16: * OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF
17: * THIS SOFTWARE.
18: *
19: * Carnegie Mellon requests users of this software to return to
20: *
21: * Software Distribution Coordinator or [email protected]
22: * School of Computer Science
23: * Carnegie Mellon University
24: * Pittsburgh PA 15213-3890
25: *
26: * any improvements or extensions that they make and grant Carnegie Mellon
27: * the rights to redistribute these changes.
28: */
29: /*
30: */
31: /*
1.1.1.2 root 32: * File: ipc/port.h
1.1 root 33: * Author: Rich Draves
34: * Date: 1989
35: *
36: * Implementation specific complement to mach/port.h.
37: */
38:
39: #ifndef _IPC_PORT_H_
40: #define _IPC_PORT_H_
41:
42: #include <mach/port.h>
43:
44: /*
45: * mach_port_t must be an unsigned type. Port values
46: * have two parts, a generation number and an index.
47: * These macros encapsulate all knowledge of how
1.1.1.3 ! root 48: * a mach_port_t is laid out.
1.1 root 49: *
50: * If the size of generation numbers changes,
51: * be sure to update IE_BITS_GEN_MASK and friends
52: * in ipc/ipc_entry.h.
53: */
54:
55: #if PORT_GENERATIONS
56: #define MACH_PORT_INDEX(name) ((name) >> 8)
57: #define MACH_PORT_GEN(name) (((name) & 0xff) << 24)
58: #define MACH_PORT_MAKE(index, gen) (((index) << 8) | ((gen) >> 24))
59: #else
60: #define MACH_PORT_INDEX(name) (name)
61: #define MACH_PORT_GEN(name) 0
62: #define MACH_PORT_MAKE(index, gen) (index)
63: #endif
64:
65: #define MACH_PORT_NGEN(name) MACH_PORT_MAKE(0, MACH_PORT_GEN(name))
66: #define MACH_PORT_MAKEB(index, bits) MACH_PORT_MAKE(index, IE_BITS_GEN(bits))
67:
68: /*
69: * Typedefs for code cleanliness. These must all have
70: * the same (unsigned) type as mach_port_t.
71: */
72:
73: typedef mach_port_t mach_port_index_t; /* index values */
74: typedef mach_port_t mach_port_gen_t; /* generation numbers */
75:
76:
77: #define MACH_PORT_UREFS_MAX ((mach_port_urefs_t) ((1 << 16) - 1))
78:
79: #define MACH_PORT_UREFS_OVERFLOW(urefs, delta) \
80: (((delta) > 0) && \
81: ((((urefs) + (delta)) <= (urefs)) || \
82: (((urefs) + (delta)) > MACH_PORT_UREFS_MAX)))
83:
84: #define MACH_PORT_UREFS_UNDERFLOW(urefs, delta) \
85: (((delta) < 0) && (-(delta) > (urefs)))
86:
87: #endif /* _IPC_PORT_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.