]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
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. | |
11 | * | |
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 | |
18 | * under the License. | |
19 | * | |
20 | * @APPLE_LICENSE_HEADER_END@ | |
21 | */ | |
22 | /* | |
23 | * @OSF_COPYRIGHT@ | |
24 | */ | |
25 | /* | |
26 | * Definitions for RPC subsystems. | |
27 | */ | |
28 | ||
29 | #ifndef _IPC_IPC_SUBSYSTEM_H_ | |
30 | #define _IPC_IPC_SUBSYSTEM_H_ | |
31 | ||
32 | #include <mach/kern_return.h> | |
33 | #include <mach/mach_types.h> | |
34 | #include <mach/std_types.h> | |
35 | #include <mach/rpc.h> | |
36 | ||
37 | #ifdef MACH_KERNEL_PRIVATE | |
38 | #include <kern/kern_types.h> | |
39 | #include <kern/lock.h> | |
40 | ||
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) | |
45 | ||
46 | /* | |
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. | |
50 | */ | |
51 | struct subsystem { | |
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 */ | |
61 | ||
62 | /* IPC stuff: */ | |
63 | struct ipc_port *ipc_self; /* Port naming this subsystem */ | |
64 | ||
65 | struct rpc_subsystem user; /* MIG-generated subsystem descr */ | |
66 | }; | |
67 | ||
68 | extern void subsystem_init(void); | |
69 | ||
70 | #endif /* MACH_KERNEL_PRIVATE */ | |
71 | ||
72 | /* Subsystem create, with 1 reference. */ | |
73 | extern kern_return_t mach_subsystem_create( | |
74 | task_t parent_task, | |
75 | user_subsystem_t user_subsys, | |
76 | mach_msg_type_number_t user_subsysCount, | |
77 | subsystem_t *subsystem); | |
78 | ||
79 | /* Take additional reference on subsystem (make sure it doesn't go away) */ | |
80 | extern void subsystem_reference( | |
81 | subsystem_t subsystem); | |
82 | ||
83 | /* Remove one reference on subsystem (it is destroyed if 0 refs remain) */ | |
84 | extern void subsystem_deallocate( | |
85 | subsystem_t subsystem); | |
86 | ||
87 | #if MACH_KDB | |
88 | extern void subsystem_print( | |
89 | subsystem_t subsystem); | |
90 | #endif /* MACH_KDB */ | |
91 | ||
92 | #endif /* _IPC_IPC_SUBSYSTEM_H_ */ |