summaryrefslogtreecommitdiff
path: root/debian/patches/0009-moar-cleanups.patch
blob: a37d69ef1cda8e79cb4aa43a1c8f04f1da9d731c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
From 92d75b7be4758e49ee5c5934f158cbd17e55b3a5 Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Sun, 17 May 2015 15:15:48 +0200
Subject: [PATCH gnumach 09/10] moar cleanups

---
 include/mach_debug/ipc_info.h            |  20 ----
 include/mach_debug/mach_debug.defs       |  21 +---
 include/mach_debug/mach_debug_types.defs |   5 -
 ipc/mach_debug.c                         | 158 -------------------------------
 4 files changed, 2 insertions(+), 202 deletions(-)

diff --git a/include/mach_debug/ipc_info.h b/include/mach_debug/ipc_info.h
index 8c5bc5a..a47ae7b 100644
--- a/include/mach_debug/ipc_info.h
+++ b/include/mach_debug/ipc_info.h
@@ -43,17 +43,6 @@
  *	in mach_debug_types.defs when adding/removing fields.
  */
 
-
-typedef struct ipc_info_space {
-	natural_t iis_genno_mask;	/* generation number mask */
-	natural_t iis_table_size;	/* size of table */
-	natural_t iis_table_next;	/* next possible size of table */
-	natural_t iis_tree_size;	/* size of tree */
-	natural_t iis_tree_small;	/* # of small entries in tree */
-	natural_t iis_tree_hash;	/* # of hashed entries in tree */
-} ipc_info_space_t;
-
-
 typedef struct ipc_info_name {
 	mach_port_t iin_name;		/* port name, including gen number */
 /*boolean_t*/integer_t iin_marequest;	/* extant msg-accepted request? */
@@ -65,15 +54,6 @@ typedef struct ipc_info_name {
 
 typedef ipc_info_name_t *ipc_info_name_array_t;
 
-
-typedef struct ipc_info_tree_name {
-	ipc_info_name_t iitn_name;
-	mach_port_t iitn_lchild;	/* name of left child */
-	mach_port_t iitn_rchild;	/* name of right child */
-} ipc_info_tree_name_t;
-
-typedef ipc_info_tree_name_t *ipc_info_tree_name_array_t;
-
 /*
  *	Type definitions for mach_port_kernel_object.
  *	By remarkable coincidence, these closely resemble
diff --git a/include/mach_debug/mach_debug.defs b/include/mach_debug/mach_debug.defs
index fb6e3a9..c8e8b1b 100644
--- a/include/mach_debug/mach_debug.defs
+++ b/include/mach_debug/mach_debug.defs
@@ -57,14 +57,7 @@ routine	mach_port_get_srights(
 		name		: mach_port_name_t;
 	out	srights		: mach_port_rights_t);
 
-/*
- *	Returns information about the global reverse hash table.
- */
-
-routine host_ipc_hash_info(
-		host		: host_t;
-	out	info		: hash_info_bucket_array_t,
-					CountInOut, Dealloc);
+skip;	/* host_ipc_hash_info */
 
 /*
  *	Returns information about the marequest hash table.
@@ -76,17 +69,7 @@ routine host_ipc_marequest_info(
 	out	info		: hash_info_bucket_array_t,
 					CountInOut, Dealloc);
 
-/*
- *	Returns information about an IPC space.
- */
-
-routine mach_port_space_info(
-		task		: ipc_space_t;
-	out	info		: ipc_info_space_t;
-	out	table_info	: ipc_info_name_array_t,
-					CountInOut, Dealloc;
-	out	tree_info	: ipc_info_tree_name_array_t,
-					CountInOut, Dealloc);
+skip;	/* mach_port_space_info */
 
 /*
  *	Returns information about the dead-name requests
diff --git a/include/mach_debug/mach_debug_types.defs b/include/mach_debug/mach_debug_types.defs
index e8399d6..8df2f34 100644
--- a/include/mach_debug/mach_debug_types.defs
+++ b/include/mach_debug/mach_debug_types.defs
@@ -38,14 +38,9 @@ type cache_info_array_t = array[] of cache_info_t;
 type hash_info_bucket_t = struct[1] of natural_t;
 type hash_info_bucket_array_t = array[] of hash_info_bucket_t;
 
-type ipc_info_space_t = struct[6] of natural_t;
-
 type ipc_info_name_t = struct[6] of natural_t;
 type ipc_info_name_array_t = array[] of ipc_info_name_t;
 
-type ipc_info_tree_name_t = struct[11] of natural_t;
-type ipc_info_tree_name_array_t = array[] of ipc_info_tree_name_t;
-
 type vm_region_info_t = struct[11] of natural_t;
 type vm_region_info_array_t = array[] of vm_region_info_t;
 
diff --git a/ipc/mach_debug.c b/ipc/mach_debug.c
index 9d01d84..efb07a4 100644
--- a/ipc/mach_debug.c
+++ b/ipc/mach_debug.c
@@ -93,28 +93,6 @@ mach_port_get_srights(
 }
 
 /*
- *	Routine:	host_ipc_hash_info
- *	Purpose:
- *		Return information about the global reverse hash table.
- *	Conditions:
- *		Nothing locked.  Obeys CountInOut protocol.
- *	Returns:
- *		KERN_SUCCESS		Returned information.
- *		KERN_INVALID_HOST	The host is null.
- *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
- */
-
-kern_return_t
-host_ipc_hash_info(
-	host_t				host,
-	hash_info_bucket_array_t	*infop,
-	mach_msg_type_number_t 		*countp)
-{
-	*countp = 0;
-	return KERN_SUCCESS;
-}
-
-/*
  *	Routine:	host_ipc_marequest_info
  *	Purpose:
  *		Return information about the marequest hash table.
@@ -195,142 +173,6 @@ host_ipc_marequest_info(
 }
 
 /*
- *	Routine:	mach_port_space_info
- *	Purpose:
- *		Returns information about an IPC space.
- *	Conditions:
- *		Nothing locked.  Obeys CountInOut protocol.
- *	Returns:
- *		KERN_SUCCESS		Returned information.
- *		KERN_INVALID_TASK	The space is null.
- *		KERN_INVALID_TASK	The space is dead.
- *		KERN_RESOURCE_SHORTAGE	Couldn't allocate memory.
- */
-
-kern_return_t
-mach_port_space_info(
-	ipc_space_t			space,
-	ipc_info_space_t		*infop,
-	ipc_info_name_array_t		*tablep,
-	mach_msg_type_number_t 		*tableCntp,
-	ipc_info_tree_name_array_t	*treep,
-	mach_msg_type_number_t 		*treeCntp)
-{
-	ipc_info_name_t *table_info;
-	unsigned int table_potential, table_actual;
-	vm_offset_t table_addr;
-	vm_size_t table_size = 0;	/* Suppress gcc warning */
-	mach_port_index_t index;
-	kern_return_t kr;
-
-	if (space == IS_NULL)
-		return KERN_INVALID_TASK;
-
-	/* start with in-line memory */
-
-	table_info = *tablep;
-	table_potential = *tableCntp;
-
-	for (;;) {
-		is_read_lock(space);
-		if (!space->is_active) {
-			is_read_unlock(space);
-			if (table_info != *tablep)
-				kmem_free(ipc_kernel_map,
-					  table_addr, table_size);
-			return KERN_INVALID_TASK;
-		}
-
-		table_actual = space->is_size;
-
-		if (table_actual <= table_potential)
-			break;
-
-		is_read_unlock(space);
-
-		if (table_actual > table_potential) {
-			if (table_info != *tablep)
-				kmem_free(ipc_kernel_map,
-					  table_addr, table_size);
-
-			table_size = round_page(table_actual *
-						sizeof *table_info);
-			kr = kmem_alloc(ipc_kernel_map,
-					&table_addr, table_size);
-			if (kr != KERN_SUCCESS)
-				return KERN_RESOURCE_SHORTAGE;
-
-			table_info = (ipc_info_name_t *) table_addr;
-			table_potential = table_size/sizeof *table_info;
-		}
-	}
-	/* space is read-locked and active; we have enough wired memory */
-
-	infop->iis_genno_mask = MACH_PORT_NGEN(MACH_PORT_DEAD);
-	infop->iis_table_size = 0;
-	infop->iis_table_next = 0;
-	infop->iis_tree_size = 0;
-	infop->iis_tree_small = 0;
-	infop->iis_tree_hash = 0;
-
-	ipc_entry_t entry;
-	struct rdxtree_iter iter;
-	index = 0;
-	rdxtree_for_each(&space->is_map, &iter, entry) {
-		ipc_info_name_t *iin = &table_info[index];
-		ipc_entry_bits_t bits = entry->ie_bits;
-
-		iin->iin_name = MACH_PORT_MAKEB(entry->ie_name, bits);
-		iin->iin_marequest = (bits & IE_BITS_MAREQUEST) ? TRUE : FALSE;
-		iin->iin_type = IE_BITS_TYPE(bits);
-		iin->iin_urefs = IE_BITS_UREFS(bits);
-		iin->iin_object = (vm_offset_t) entry->ie_object;
-		iin->iin_next = entry->ie_request;
-		index += 1;
-	}
-	is_read_unlock(space);
-
-	if (table_info == *tablep) {
-		/* data fit in-line; nothing to deallocate */
-
-		*tableCntp = table_actual;
-	} else if (table_actual == 0) {
-		kmem_free(ipc_kernel_map, table_addr, table_size);
-
-		*tableCntp = 0;
-	} else {
-		vm_size_t size_used, rsize_used;
-		vm_map_copy_t copy;
-
-		/* kmem_alloc doesn't zero memory */
-
-		size_used = table_actual * sizeof *table_info;
-		rsize_used = round_page(size_used);
-
-		if (rsize_used != table_size)
-			kmem_free(ipc_kernel_map,
-				  table_addr + rsize_used,
-				  table_size - rsize_used);
-
-		if (size_used != rsize_used)
-			memset((void *) (table_addr + size_used), 0,
-			      rsize_used - size_used);
-
-		kr = vm_map_copyin(ipc_kernel_map, table_addr, rsize_used,
-				   TRUE, &copy);
-
-		assert(kr == KERN_SUCCESS);
-
-		*tablep = (ipc_info_name_t *) copy;
-		*tableCntp = table_actual;
-	}
-
-	/* The splay tree is gone.  */
-	*treeCntp = 0;
-	return KERN_SUCCESS;
-}
-
-/*
  *	Routine:	mach_port_dnrequest_info
  *	Purpose:
  *		Returns information about the dead-name requests
-- 
2.1.4