]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/ipc_subsystem.c
125a0b6f5cd459d45302201d80541291c8dcc629
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
28 * Revision 1.1.1.1 1998/09/22 21:05:34 wsanchez
29 * Import of Mac OS X kernel (~semeria)
31 * Revision 1.2 1998/04/29 17:35:56 mburg
34 * Revision 1.1.10.1 1998/02/03 09:28:28 gdt
36 * [1998/02/03 09:13:40 gdt]
38 * Revision 1.1.8.1 1997/06/17 02:57:46 devrcs
39 * Added `ipc_subsystem_terminate().'
40 * [1997/03/18 18:25:52 rkc]
42 * Revision 1.1.5.1 1994/09/23 02:19:57 ezf
43 * change marker to not FREE
44 * [1994/09/22 21:33:39 ezf]
46 * Revision 1.1.3.1 1994/01/20 11:05:46 emcmanus
47 * Copied for submission.
48 * [1994/01/20 11:04:25 emcmanus]
50 * Revision 1.1.1.2 1994/01/13 02:40:32 condict
51 * IPC support for the RPC subsytem object (server co-location).
57 * File: kern/ipc_subsystem.c
58 * Purpose: Routines to support ipc semantics of new kernel
59 * RPC subsystem descriptions
62 #include <mach/message.h>
63 #include <kern/ipc_kobject.h>
64 #include <kern/task.h>
65 #include <kern/ipc_subsystem.h>
66 #include <kern/subsystem.h>
67 #include <kern/misc_protos.h>
68 #include <ipc/ipc_port.h>
69 #include <ipc/ipc_space.h>
72 * Routine: ipc_subsystem_init
74 * Initialize ipc control of a subsystem.
78 subsystem_t subsystem
)
82 port
= ipc_port_alloc_kernel();
84 panic("ipc_subsystem_init");
85 subsystem
->ipc_self
= port
;
89 * Routine: ipc_subsystem_enable
91 * Enable ipc access to a subsystem.
95 subsystem_t subsystem
)
97 ipc_kobject_set(subsystem
->ipc_self
,
98 (ipc_kobject_t
) subsystem
, IKOT_SUBSYSTEM
);
103 * Routine: ipc_subsystem_disable
105 * Disable IPC access to a subsystem.
111 ipc_subsystem_disable(
112 subsystem_t subsystem
)
116 kport
= subsystem
->ipc_self
;
117 if (kport
!= IP_NULL
)
118 ipc_kobject_set(kport
, IKO_NULL
, IKOT_NONE
);
122 * Routine: ipc_subsystem_terminate
124 * Clean up and destroy a subsystem's IPC state.
127 ipc_subsystem_terminate(
128 subsystem_t subsystem
)
130 ipc_port_dealloc_kernel(subsystem
->ipc_self
);
135 * Routine: convert_port_to_subsystem
137 * Convert from a port to a subsystem.
138 * Doesn't consume the port ref; produces a subsystem ref,
144 convert_port_to_subsystem(
147 subsystem_t subsystem
= SUBSYSTEM_NULL
;
149 if (IP_VALID(port
)) {
151 if (ip_active(port
) &&
152 (ip_kotype(port
) == IKOT_SUBSYSTEM
)) {
153 subsystem
= (subsystem_t
) port
->ip_kobject
;
162 * Routine: convert_subsystem_to_port
164 * Convert from a subsystem to a port.
165 * Produces a naked send right which may be invalid.
170 convert_subsystem_to_port(
171 subsystem_t subsystem
)
175 port
= ipc_port_make_send(subsystem
->ipc_self
);