1 .\"
2 .\" Mach Operating System
3 .\" Copyright (c) 1991,1990 Carnegie Mellon University
4 .\" All Rights Reserved.
5 .\"
6 .\" Permission to use, copy, modify and distribute this software and its
7 .\" documentation is hereby granted, provided that both the copyright
8 .\" notice and this permission notice appear in all copies of the
9 .\" software, derivative works or modified versions, and any portions
10 .\" thereof, and that both notices appear in supporting documentation.
11 .\"
12 .\" CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 .\" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 .\" ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 .\"
16 .\" Carnegie Mellon requests users of this software to return to
17 .\"
18 .\" Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 .\" School of Computer Science
20 .\" Carnegie Mellon University
21 .\" Pittsburgh PA 15213-3890
22 .\"
23 .\" any improvements or extensions that they make and grant Carnegie Mellon
24 .\" the rights to redistribute these changes.
25 .\"
26 .\"
27 .\" HISTORY
28 .\" $Log: mach_ports.man,v $
29 .\" Revision 2.4 91/05/14 17:07:59 mrt
30 .\" Correcting copyright
31 .\"
32 .\" Revision 2.3 91/02/14 14:12:14 mrt
33 .\" Changed to new Mach copyright
34 .\" [91/02/12 18:12:24 mrt]
35 .\"
36 .\" Revision 2.2 90/08/07 18:38:36 rpd
37 .\" Created.
38 .\"
39 .TH mach_ports 2 9/19/86
40 .CM 4
41 .SH NAME
42 .nf
43 mach_ports_register \- manipulate the inherited ports array
44 mach_ports_lookup \- child port acquires specific parent ports
45 .SH SYNOPSIS
46 .nf
47 .ft B
48 #include <mach.h>
49
50 .nf
51 .ft B
52 kern_return_t mach_ports_register(target_task,
53 init_port_set, init_port_array_count)
54 task_t target_task;
55 port_array_t init_port_set; /* array */
56 int init_port_array_count;
57
58
59 .fi
60 .ft P
61 .nf
62 .ft B
63 kern_return_t mach_ports_lookup(target_task,
64 init_port_set, init_port_array_count)
65 task_t target_task;
66 port_array_t *init_port_set; /* out array */
67 int *init_port_array_count; /* out */
68
69
70 .fi
71 .ft P
72 .SH ARGUMENTS
73 .TP 15
74 .B
75 target_task
76 Task to be affected.
77 .TP 15
78 .B
79 init_port_set
80 An array of system ports to be registered, or returned.
81 Although the array size is given as variable, the kernel will only accept a limited number of ports.
82 .TP 15
83 .B
84 init_port_array_count
85 The number of ports returned in
86 .B init_port_set.
87
88 .SH DESCRIPTION
89 .B mach_ports_register
90 registers an array of well-known system ports with the
91 kernel on behalf of a specific task. Currently the ports to be
92 registered are: the port to the Network Name Server, the port to the Environment
93 Manager, and a port to the Service server. These port values must be placed
94 in specific slots in the
95 .B init_port_set.
96 The slot numbers are given by the
97 global constants defined in
98 .B mach_init.h
99 :
100 .B NAME_SERVER_SLOT
101 ,
102 .B ENVIRONMENT_SLOT
103 ,
104 and
105 .B SERVICE_SLOT.
106 These
107 ports may later be retrieved with
108 .B mach_ports_lookup.
109
110 When a new task is created (see
111 .B task_create
112 ), the
113 child task will be given access to these ports.
114 Only port send rights may be registered.
115 Furthermore, the number of ports which may be registered is
116 fixed and given by the global constant
117 .B MACH_PORT_SLOTS_USED
118 .
119 Attempts to register too many ports will fail.
120
121 It is intended that this mechanism be used only for task
122 initialization, and then only by runtime support modules.
123 A parent task has three choices in passing these system ports to
124 a child task. Most commonly it can do nothing and its child will
125 inherit access to the same
126 .B init_port_set
127 that the parent has;
128 or a parent task may register a set of ports it wishes to have passed
129 to all of its children by calling
130 .B mach_ports_register
131 using
132 its task port; or it may make necessary modifications
133 to the set of ports it wishes its child to see, and then register
134 those ports using the child's task port prior to starting the
135 child's thread(s).
136 The
137 .B mach_ports_lookup
138 call which is done by
139 .B mach_init
140 in the child task will acquire these initial ports
141 for the child.
142
143 Tasks other than the Network Name Server and the
144 Environment Mangager should not need access to the Service port. The Network
145 Name Server port is the same for all tasks on a given machine. The Environment port
146 is the only port likely to have different values for different tasks.
147
148 Since the number of ports which may be registered is limited,
149 ports other than those used by the runtime system to initialize
150 a task should be passed to children either through an initial
151 message, or through the Network Name Server for public ports,
152 or the Environment Manager for private ports.
153
154 .SH DIAGNOSTICS
155 .TP 25
156 KERN_SUCCESS
157 Memory allocated.
158 .TP 25
159 KERN_INVALID_ARGUMENT
160 An attempt was made to register more ports than the
161 current kernel implementation allows.
162
163 .SH SEE ALSO
164 .B mach_init, netname, env_mgr, service
165
Cache object: dcd4f7007c458d56959c8bda54f7d6f9
|