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@
26 * Definitions for RPC subsystems.
29 #ifndef _IPC_IPC_SUBSYSTEM_H_
30 #define _IPC_IPC_SUBSYSTEM_H_
32 #include <mach/kern_return.h>
33 #include <mach/mach_types.h>
34 #include <mach/std_types.h>
37 #ifdef MACH_KERNEL_PRIVATE
38 #include <kern/kern_types.h>
39 #include <kern/lock.h>
41 #define subsystem_lock_init(subsys) \
42 simple_lock_init(&(subsys)->lock, ETAP_MISC_RPC_SUBSYS)
43 #define subsystem_lock(subsys) simple_lock(&(subsys)->lock)
44 #define subsystem_unlock(subsys) simple_unlock(&(subsys)->lock)
47 * A subsystem describes a set of server routines that can be invoked by
48 * mach_rpc() on the ports that are registered with the subsystem.
49 * See struct rpc_subsystem in mach/rpc.h, for more details.
52 /* Synchronization/destruction information */
53 decl_simple_lock_data(,lock
) /* Subsystem lock */
54 int ref_count
; /* Number of references to me */
55 vm_size_t size
; /* Number of bytes in this structure */
56 /* including the variable length */
57 /* user_susbystem description */
58 /* Task information */
59 task_t task
; /* Task to which I belong */
60 queue_chain_t subsystem_list
; /* list of subsystems in task */
63 struct ipc_port
*ipc_self
; /* Port naming this subsystem */
65 struct rpc_subsystem user
; /* MIG-generated subsystem descr */
68 extern void subsystem_init(void);
70 #endif /* MACH_KERNEL_PRIVATE */
72 /* Subsystem create, with 1 reference. */
73 extern kern_return_t
mach_subsystem_create(
75 user_subsystem_t user_subsys
,
76 mach_msg_type_number_t user_subsysCount
,
77 subsystem_t
*subsystem
);
79 /* Take additional reference on subsystem (make sure it doesn't go away) */
80 extern void subsystem_reference(
81 subsystem_t subsystem
);
83 /* Remove one reference on subsystem (it is destroyed if 0 refs remain) */
84 extern void subsystem_deallocate(
85 subsystem_t subsystem
);
88 extern void subsystem_print(
89 subsystem_t subsystem
);
92 #endif /* _IPC_IPC_SUBSYSTEM_H_ */