summaryrefslogtreecommitdiff
path: root/debian/patches/feature-proc-set-task-name-to-pid.patch
blob: 73506883ab3e7f83cd181cffa9be1c432fe6a2cd (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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
--- a/proc/Makefile
+++ b/proc/Makefile
@@ -29,7 +29,7 @@ MIGSFLAGS="-DPROCESS_INTRAN=pstruct_t reqport_find (process_t)" \
 	"-DPROCESS_IMPORTS=import \"proc.h\";"
 
 MIGSTUBS = processServer.o notifyServer.o \
-	ourmsgUser.o proc_excUser.o proc_excServer.o
+	ourmsgUser.o proc_excUser.o proc_excServer.o gnumachUser.o
 OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
 HURDLIBS = ihash ports shouldbeinlibc
 OTHERLIBS = -lpthread
diff --git a/proc/gnumach.defs b/proc/gnumach.defs
new file mode 100644
index 0000000..6cfbb0d
--- /dev/null
+++ b/proc/gnumach.defs
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2012 Free Software Foundation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+#if	KERNEL_USER
+	  KernelUser
+#endif	/* KERNEL_USER */
+		       gnumach 4200;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <mach_debug/mach_debug_types.defs>
+
+type vm_cache_statistics_data_t = struct[11] of integer_t;
+
+/*
+ * Return page cache statistics for the host on which the target task
+ * resides.
+ */
+routine vm_cache_statistics(
+		target_task	: vm_task_t;
+	out	vm_cache_stats	: vm_cache_statistics_data_t);
+
+/*
+ * Terminate a thread and release rights and memory.
+ *
+ * Intended to be used by threading libraries to provide a clean way for
+ * threads to terminate themselves. The resources a thread wouldn't be able
+ * to release without this call when terminating itself are its
+ * last reference to its kernel port, its reply port, and its stack.
+ *
+ * This call is semantically equivalent to :
+ *  - mach_port_deallocate(task, thread_name);
+ *  - if (reply_port != MACH_PORT_NULL)
+ *      mach_port_destroy(task, reply_port);
+ *  - if ((address != 0) || (size != 0))
+ *      vm_deallocate(task, address, size)
+ *  - thread_terminate(thread)
+ *
+ * Implemented as a simple routine so a reply port isn't required.
+ */
+simpleroutine thread_terminate_release(
+		thread		: thread_t;
+		task		: task_t;
+		thread_name	: mach_port_name_t;
+		reply_port	: mach_port_name_t;
+		address		: vm_address_t;
+		size		: vm_size_t);
+
+/*
+ *	Set the name of task TASK to NAME.  This is a debugging aid.
+ *	NAME will be used in error messages printed by the kernel.
+ */
+simpleroutine task_set_name(
+		task	: task_t;
+		name	: kernel_debug_name_t);
diff --git a/proc/mach_debug/hash_info.h b/proc/mach_debug/hash_info.h
new file mode 100644
index 0000000..6944277
--- /dev/null
+++ b/proc/mach_debug/hash_info.h
@@ -0,0 +1,41 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+
+#ifndef	_MACH_DEBUG_HASH_INFO_H_
+#define _MACH_DEBUG_HASH_INFO_H_
+
+/*
+ *	Remember to update the mig type definitions
+ *	in mach_debug_types.defs when adding/removing fields.
+ */
+
+typedef struct hash_info_bucket {
+	natural_t	hib_count;	/* number of records in bucket */
+} hash_info_bucket_t;
+
+typedef hash_info_bucket_t *hash_info_bucket_array_t;
+
+#endif	/* _MACH_DEBUG_HASH_INFO_H_ */
diff --git a/proc/mach_debug/ipc_info.h b/proc/mach_debug/ipc_info.h
new file mode 100644
index 0000000..ef0b0c6
--- /dev/null
+++ b/proc/mach_debug/ipc_info.h
@@ -0,0 +1,100 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ *	File:	mach_debug/ipc_info.h
+ *	Author:	Rich Draves
+ *	Date:	March, 1990
+ *
+ *	Definitions for the IPC debugging interface.
+ */
+
+#ifndef	_MACH_DEBUG_IPC_INFO_H_
+#define _MACH_DEBUG_IPC_INFO_H_
+
+#include <mach/boolean.h>
+#include <mach/port.h>
+#include <mach/machine/vm_types.h>
+
+/*
+ *	Remember to update the mig type definitions
+ *	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_collision;	/* collision at this entry? */
+/*boolean_t*/integer_t iin_compat;	/* is this a compat-mode entry? */
+/*boolean_t*/integer_t iin_marequest;	/* extant msg-accepted request? */
+	mach_port_type_t iin_type;	/* straight port type */
+	mach_port_urefs_t iin_urefs;	/* user-references */
+	vm_offset_t iin_object;		/* object pointer */
+	natural_t iin_next;		/* marequest/next in free list */
+	natural_t iin_hash;		/* hash index */
+} ipc_info_name_t;
+
+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
+ *	the IKOT_* definitions in ipc/ipc_kobject.h.
+ */
+
+#define	IPC_INFO_TYPE_NONE		0
+#define IPC_INFO_TYPE_THREAD		1
+#define	IPC_INFO_TYPE_TASK		2
+#define	IPC_INFO_TYPE_HOST		3
+#define	IPC_INFO_TYPE_HOST_PRIV		4
+#define	IPC_INFO_TYPE_PROCESSOR		5
+#define	IPC_INFO_TYPE_PSET		6
+#define	IPC_INFO_TYPE_PSET_NAME		7
+#define	IPC_INFO_TYPE_PAGER		8
+#define	IPC_INFO_TYPE_PAGING_REQUEST	9
+#define	IPC_INFO_TYPE_DEVICE		10
+#define	IPC_INFO_TYPE_XMM_PAGER		11
+#define IPC_INFO_TYPE_PAGING_NAME	12
+
+#endif	/* _MACH_DEBUG_IPC_INFO_H_ */
diff --git a/proc/mach_debug/mach_debug.defs b/proc/mach_debug/mach_debug.defs
new file mode 100644
index 0000000..053c3fe
--- /dev/null
+++ b/proc/mach_debug/mach_debug.defs
@@ -0,0 +1,233 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ *	Matchmaker definitions file for Mach kernel debugging interface.
+ */
+
+subsystem
+#if	KERNEL_SERVER
+	  KernelServer
+#endif	/* KERNEL_SERVER */
+		       mach_debug 3000;
+
+#include <mach/std_types.defs>
+#include <mach/mach_types.defs>
+#include <mach_debug/mach_debug_types.defs>
+
+skip;	/* host_ipc_statistics */
+skip;	/* host_ipc_statistics_reset */
+skip;	/* host_callout_info */
+skip;	/* host_callout_statistics */
+skip;	/* host_callout_statistics_reset */
+skip;	/* host_zone_info */
+skip;	/* host_ipc_bucket_info */
+
+#if	!defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG
+
+/*
+ *	Returns the exact number of extant send rights
+ *	for the given receive right.
+ */
+
+routine	mach_port_get_srights(
+		task		: ipc_space_t;
+		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);
+
+/*
+ *	Returns information about the marequest hash table.
+ */
+
+routine host_ipc_marequest_info(
+		host		: host_t;
+	out	max_requests	: unsigned;
+	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);
+
+/*
+ *	Returns information about the dead-name requests
+ *	registered with the named receive right.
+ */
+
+routine mach_port_dnrequest_info(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	total		: unsigned;	/* total size of table */
+	out	used		: unsigned);	/* amount used */
+
+#else	/* !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG */
+skip;	/* mach_port_get_srights */
+skip;	/* host_ipc_hash_info */
+skip;	/* host_ipc_marequest_info */
+skip;	/* mach_port_space_info */
+skip;	/* mach_port_dnrequest_info */
+#endif	/* !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG */
+
+skip;	/* mach_vm_region_info */
+skip;	/* vm_mapped_pages_info */
+
+/*
+ *	Returns stack usage information:
+ *		reserved	Amount of stack space reserved for pcb.
+ *		total		Number of stacks.
+ *		space		Total VM space for stacks.
+ *		resident	Resident VM space for stacks.
+ *		maxusage	Maximum amount of stack used.
+ *		maxstack	Address in the kernel of the largest stack.
+ */
+
+routine host_stack_usage(
+		host		: host_t;
+	out	reserved	: vm_size_t;
+	out	total		: unsigned;
+	out	space		: vm_size_t;
+	out	resident	: vm_size_t;
+	out	maxusage	: vm_size_t;
+	out	maxstack	: vm_offset_t);
+
+routine processor_set_stack_usage(
+		pset		: processor_set_name_t;
+	out	total		: unsigned;
+	out	space		: vm_size_t;
+	out	resident	: vm_size_t;
+	out	maxusage	: vm_size_t;
+	out	maxstack	: vm_offset_t);
+
+#if	!defined(MACH_VM_DEBUG) || MACH_VM_DEBUG
+
+/*
+ *	Returns information about the global VP table.
+ */
+
+routine host_virtual_physical_table_info(
+		host		: host_t;
+	out	info		: hash_info_bucket_array_t,
+					CountInOut, Dealloc);
+
+#else	/* !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG */
+skip;	/* host_virtual_physical_table_info */
+#endif	/* !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG */
+
+#if	!defined(MACH_KDB) || MACH_KDB
+/*
+ *	Loads a symbol table for an external file into the kernel debugger.
+ *	The symbol table data is an array of characters.  It is assumed that
+ *	the caller and the kernel debugger agree on its format.
+ */
+
+routine host_load_symbol_table(
+		host		: host_priv_t;
+		task		: task_t;
+		name		: symtab_name_t;
+		symtab		: pointer_t);
+
+#else	/* !defined(MACH_KDB) || MACH_KDB */
+skip;	/* host_load_symbol_table */
+#endif	/* !defined(MACH_KDB) || MACH_KDB */
+
+#if	!defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG
+
+/*
+ *	Return the type and address of the kernel object
+ *	that the given send/receive right represents.
+ */
+
+routine	mach_port_kernel_object(
+		task		: ipc_space_t;
+		name		: mach_port_name_t;
+	out	object_type	: unsigned;
+	out	object_addr	: vm_offset_t);
+
+#else	/* !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG */
+skip;	/* mach_port_kernel_object */
+#endif	/* !defined(MACH_IPC_DEBUG) || MACH_IPC_DEBUG */
+
+#if	!defined(MACH_VM_DEBUG) || MACH_VM_DEBUG
+
+/*
+ *	Returns information about a region of memory.
+ */
+
+routine mach_vm_region_info(
+		task		: vm_task_t;
+		address		: vm_address_t;
+	out	region		: vm_region_info_t;
+	/* avoid out-translation of the argument */
+	out	object		: memory_object_name_t =
+					MACH_MSG_TYPE_MOVE_SEND
+					ctype: mach_port_t);
+
+routine mach_vm_object_info(
+		object		: memory_object_name_t;
+	out	info		: vm_object_info_t;
+	/* avoid out-translation of the argument */
+	out	shadow		: memory_object_name_t =
+					MACH_MSG_TYPE_MOVE_SEND
+					ctype: mach_port_t;
+	/* avoid out-translation of the argument */
+	out	copy		: memory_object_name_t =
+					MACH_MSG_TYPE_MOVE_SEND
+					ctype: mach_port_t);
+
+routine mach_vm_object_pages(
+		object		: memory_object_name_t;
+	out	pages		: vm_page_info_array_t,
+					CountInOut, Dealloc);
+
+/*
+ *	Returns information about the memory allocation caches.
+ */
+routine host_slab_info(
+		host		: host_t;
+	out	info		: cache_info_array_t,
+					CountInOut, Dealloc);
+
+#else	/* !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG */
+skip;	/* mach_vm_region_info */
+skip;	/* mach_vm_object_info */
+skip;	/* mach_vm_object_pages */
+#endif	/* !defined(MACH_VM_DEBUG) || MACH_VM_DEBUG */
diff --git a/proc/mach_debug/mach_debug_types.defs b/proc/mach_debug/mach_debug_types.defs
new file mode 100644
index 0000000..d24b6f9
--- /dev/null
+++ b/proc/mach_debug/mach_debug_types.defs
@@ -0,0 +1,64 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ *	Mach kernel debugging interface type declarations
+ */
+
+#ifndef	_MACH_DEBUG_MACH_DEBUG_TYPES_DEFS_
+#define _MACH_DEBUG_MACH_DEBUG_TYPES_DEFS_
+
+#include <mach/std_types.defs>
+
+type cache_info_t = struct[19] of integer_t;
+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[9] 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;
+
+type vm_object_info_t = struct[14] of natural_t;
+type vm_object_info_array_t = array[] of vm_object_info_t;
+
+type vm_page_info_t = struct[6] of natural_t;
+type vm_page_info_array_t = array[] of vm_page_info_t;
+
+type symtab_name_t = (MACH_MSG_TYPE_STRING_C, 8*32);
+
+type kernel_debug_name_t = c_string[*: 64];
+
+import <mach_debug/mach_debug_types.h>;
+
+#endif	/* _MACH_DEBUG_MACH_DEBUG_TYPES_DEFS_ */
diff --git a/proc/mach_debug/mach_debug_types.h b/proc/mach_debug/mach_debug_types.h
new file mode 100644
index 0000000..9c7d1fd
--- /dev/null
+++ b/proc/mach_debug/mach_debug_types.h
@@ -0,0 +1,51 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ *	Mach kernel debugging interface type declarations
+ */
+
+#ifndef	_MACH_DEBUG_MACH_DEBUG_TYPES_H_
+#define _MACH_DEBUG_MACH_DEBUG_TYPES_H_
+
+#include <mach_debug/ipc_info.h>
+#include <mach_debug/vm_info.h>
+#include <mach_debug/slab_info.h>
+#include <mach_debug/hash_info.h>
+
+typedef	char	symtab_name_t[32];
+
+/*
+ *	A fixed-length string data type intended for names given to
+ *	kernel objects.
+ *
+ *	Note that it is not guaranteed that the in-kernel data
+ *	structure will hold KERNEL_DEBUG_NAME_MAX bytes.  The given
+ *	name will be truncated to fit into the target data structure.
+ */
+#define KERNEL_DEBUG_NAME_MAX (64)
+typedef char	kernel_debug_name_t[KERNEL_DEBUG_NAME_MAX];
+
+#endif	/* _MACH_DEBUG_MACH_DEBUG_TYPES_H_ */
diff --git a/proc/mach_debug/pc_info.h b/proc/mach_debug/pc_info.h
new file mode 100644
index 0000000..bc43fa8
--- /dev/null
+++ b/proc/mach_debug/pc_info.h
@@ -0,0 +1,43 @@
+/* 
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ * 
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ * 
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ *	File:	mach_debug/pc_info.h
+ *	Author:	Brian Bershad
+ *	Date:	January 1992
+ *
+ *	Definitions for the PC sampling interface.
+ */
+
+#ifndef	_MACH_DEBUG_PC_INFO_H_
+#define _MACH_DEBUG_PC_INFO_H_
+
+
+typedef struct sampled_pc {
+    task_t 	task;
+    thread_t 	thread;
+    vm_offset_t pc;
+} sampled_pc_t;
+
+typedef sampled_pc_t *sampled_pc_array_t;
+typedef unsigned int sampled_pc_seqno_t;
+
+#endif	_MACH_DEBUG_PC_INFO_H_
diff --git a/proc/mach_debug/slab_info.h b/proc/mach_debug/slab_info.h
new file mode 100644
index 0000000..37dcb8c
--- /dev/null
+++ b/proc/mach_debug/slab_info.h
@@ -0,0 +1,62 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990,1989 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+
+#ifndef _MACH_DEBUG_SLAB_INFO_H_
+#define _MACH_DEBUG_SLAB_INFO_H_
+
+#include <sys/types.h>
+
+/*
+ *	Remember to update the mig type definitions
+ *	in mach_debug_types.defs when adding/removing fields.
+ */
+
+#define CACHE_NAME_MAX_LEN 32
+
+#define CACHE_FLAGS_NO_CPU_POOL		0x01
+#define CACHE_FLAGS_SLAB_EXTERNAL	0x02
+#define CACHE_FLAGS_NO_RECLAIM		0x04
+#define CACHE_FLAGS_VERIFY		0x08
+#define CACHE_FLAGS_DIRECT		0x10
+
+typedef struct cache_info {
+	int flags;
+	size_t cpu_pool_size;
+	size_t obj_size;
+	size_t align;
+	size_t buf_size;
+	size_t slab_size;
+	unsigned long bufs_per_slab;
+	unsigned long nr_objs;
+	unsigned long nr_bufs;
+	unsigned long nr_slabs;
+	unsigned long nr_free_slabs;
+	char name[CACHE_NAME_MAX_LEN];
+} cache_info_t;
+
+typedef cache_info_t *cache_info_array_t;
+
+#endif	/* _MACH_DEBUG_SLAB_INFO_H_ */
diff --git a/proc/mach_debug/vm_info.h b/proc/mach_debug/vm_info.h
new file mode 100644
index 0000000..70ba887
--- /dev/null
+++ b/proc/mach_debug/vm_info.h
@@ -0,0 +1,132 @@
+/*
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie Mellon
+ * the rights to redistribute these changes.
+ */
+/*
+ *	File:	mach_debug/vm_info.h
+ *	Author:	Rich Draves
+ *	Date:	March, 1990
+ *
+ *	Definitions for the VM debugging interface.
+ */
+
+#ifndef	_MACH_DEBUG_VM_INFO_H_
+#define _MACH_DEBUG_VM_INFO_H_
+
+#include <mach/boolean.h>
+#include <mach/machine/vm_types.h>
+#include <mach/vm_inherit.h>
+#include <mach/vm_prot.h>
+#include <mach/memory_object.h>
+
+/*
+ *	Remember to update the mig type definitions
+ *	in mach_debug_types.defs when adding/removing fields.
+ */
+
+typedef struct vm_region_info {
+	vm_offset_t vri_start;		/* start of region */
+	vm_offset_t vri_end;		/* end of region */
+
+/*vm_prot_t*/natural_t vri_protection;	/* protection code */
+/*vm_prot_t*/natural_t vri_max_protection;	/* maximum protection */
+/*vm_inherit_t*/natural_t vri_inheritance;	/* inheritance */
+	natural_t vri_wired_count;	/* number of times wired */
+	natural_t vri_user_wired_count; /* number of times user has wired */
+
+	vm_offset_t vri_object;		/* the mapped object */
+	vm_offset_t vri_offset;		/* offset into object */
+/*boolean_t*/integer_t vri_needs_copy;	/* does object need to be copied? */
+	natural_t vri_sharing;	/* share map references */
+} vm_region_info_t;
+
+typedef vm_region_info_t *vm_region_info_array_t;
+
+
+typedef natural_t vm_object_info_state_t;
+
+#define VOI_STATE_PAGER_CREATED		0x00000001
+#define VOI_STATE_PAGER_INITIALIZED	0x00000002
+#define VOI_STATE_PAGER_READY		0x00000004
+#define VOI_STATE_CAN_PERSIST		0x00000008
+#define VOI_STATE_INTERNAL		0x00000010
+#define VOI_STATE_TEMPORARY		0x00000020
+#define VOI_STATE_ALIVE			0x00000040
+#define VOI_STATE_LOCK_IN_PROGRESS	0x00000080
+#define VOI_STATE_LOCK_RESTART		0x00000100
+#define VOI_STATE_USE_OLD_PAGEOUT	0x00000200
+
+typedef struct vm_object_info {
+	vm_offset_t voi_object;		/* this object */
+	vm_size_t voi_pagesize;		/* object's page size */
+	vm_size_t voi_size;		/* object size (valid if internal) */
+	natural_t voi_ref_count;	/* number of references */
+	natural_t voi_resident_page_count; /* number of resident pages */
+	natural_t voi_absent_count;	/* number requested but not filled */
+	vm_offset_t voi_copy;		/* copy object */
+	vm_offset_t voi_shadow;		/* shadow object */
+	vm_offset_t voi_shadow_offset;	/* offset into shadow object */
+	vm_offset_t voi_paging_offset;	/* offset into memory object */
+/*memory_object_copy_strategy_t*/integer_t voi_copy_strategy;
+					/* how to handle data copy */
+	vm_offset_t voi_last_alloc;	/* offset of last allocation */
+	natural_t voi_paging_in_progress; /* paging references */
+	vm_object_info_state_t voi_state; /* random state bits */
+} vm_object_info_t;
+
+typedef vm_object_info_t *vm_object_info_array_t;
+
+
+typedef natural_t vm_page_info_state_t;
+
+#define VPI_STATE_BUSY		0x00000001
+#define VPI_STATE_WANTED	0x00000002
+#define VPI_STATE_TABLED	0x00000004
+#define VPI_STATE_FICTITIOUS	0x00000008
+#define VPI_STATE_PRIVATE	0x00000010
+#define VPI_STATE_ABSENT	0x00000020
+#define VPI_STATE_ERROR		0x00000040
+#define VPI_STATE_DIRTY		0x00000080
+#define VPI_STATE_PRECIOUS	0x00000100
+#define VPI_STATE_OVERWRITING	0x00000200
+#define VPI_STATE_INACTIVE	0x00000400
+#define VPI_STATE_ACTIVE	0x00000800
+#define VPI_STATE_LAUNDRY	0x00001000
+#define VPI_STATE_FREE		0x00002000
+#define VPI_STATE_REFERENCE	0x00004000
+
+#define VPI_STATE_PAGER		0x80000000	/* pager has the page */
+
+typedef struct vm_page_info {
+	vm_offset_t vpi_offset;		/* offset in object */
+	vm_offset_t vpi_phys_addr;	/* physical address */
+	natural_t vpi_wire_count;	/* number of times wired */
+/*vm_prot_t*/natural_t vpi_page_lock;	/* XP access restrictions */
+/*vm_prot_t*/natural_t vpi_unlock_request;	/* outstanding unlock requests */
+	vm_page_info_state_t vpi_state;	/* random state bits */
+} vm_page_info_t;
+
+typedef vm_page_info_t *vm_page_info_array_t;
+
+#endif	/* _MACH_DEBUG_VM_INFO_H_ */
diff --git a/proc/mgt.c b/proc/mgt.c
index 5e0accd..61a45a6 100644
--- a/proc/mgt.c
+++ b/proc/mgt.c
@@ -663,6 +663,10 @@ complete_proc (struct proc *p, pid_t pid)
 
   p->p_pid = pid;
 
+  char name[20];	/* prefix + 10 digits + \0 */
+  snprintf (name, sizeof name, "with pid %i", pid);
+  task_set_name (p->p_task, name);
+
   ids_ref (&nullids);
   p->p_id = &nullids;